Note
This module is part of ansible-base
and included in all Ansible installations. In most cases, you can use the short module name assert even without specifying the collections:
keyword. Despite that, we recommend you use the FQCN for easy linking to the module documentation and to avoid conflicting with other collections that may have the same module name.
New in version 1.5: of ansible.builtin
Note
This module has a corresponding action plugin.
Parameter | Choices/Defaults | Comments |
---|---|---|
fail_msg string added in 2.7 of ansible.builtin | The customized message used for a failing assertion. This argument was called 'msg' before Ansible 2.7, now it is renamed to 'fail_msg' with alias 'msg'. aliases: msg | |
quiet boolean added in 2.8 of ansible.builtin |
| Set this to yes to avoid verbose output. |
success_msg string added in 2.7 of ansible.builtin | The customized message used for a successful assertion. | |
that list / elements=string / required | A list of string expressions of the same form that can be passed to the 'when' statement. |
Note
See also
The official documentation on the ansible.builtin.debug module.
The official documentation on the ansible.builtin.fail module.
The official documentation on the ansible.builtin.meta module.
- assert: { that: "ansible_os_family != 'RedHat'" } - assert: that: - "'foo' in some_command_result.stdout" - number_of_the_counting == 3 - name: After version 2.7 both 'msg' and 'fail_msg' can customize failing assertion message assert: that: - my_param <= 100 - my_param >= 0 fail_msg: "'my_param' must be between 0 and 100" success_msg: "'my_param' is between 0 and 100" - name: Please use 'msg' when ansible version is smaller than 2.7 assert: that: - my_param <= 100 - my_param >= 0 msg: "'my_param' must be between 0 and 100" - name: Use quiet to avoid verbose output assert: that: - my_param <= 100 - my_param >= 0 quiet: true
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.10/collections/ansible/builtin/assert_module.html