W3cubDocs

/Ansible

assert - Asserts given expressions are true

New in version 1.5.

Synopsis

This module asserts that given expressions are true with an optional custom message.

Options

parameter required default choices comments
msg
no
The customized message used for a failing assertion
that
yes
A string expression of the same form that can be passed to the 'when' statement
Alternatively, a list of string expressions

Examples

- assert: { that: "ansible_os_family != 'RedHat'" }

- assert:
    that:
      - "'foo' in some_command_result.stdout"
      - "number_of_the_counting == 3"

- assert:
    that:
      - "my_param <= 100"
      - "my_param >= 0"
    msg: "'my_param' must be between 0 and 100"

This is a Core Module

For more information on what this means please read Core Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/assert_module.html