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.
  • This module is also supported for Windows targets.

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"

Notes

Note

  • This module is also supported for Windows targets.

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.

Maintenance Info

For more information about Red Hat’s this support of this module, please refer to this knowledge base article<https://access.redhat.com/articles/rhel-top-support-policies>

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

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