Documentation

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"

Status

This module is flagged as stableinterface which means that the maintainers for this module guarantee that no backward incompatible interface changes will be made.

Support

This module is maintained by those with core commit privileges

For more information on what this means please read Module Support

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