Documentation

assert - Fail with custom message

New in version 1.5.

Synopsis

This module asserts that a given expression is true and can be a simpler alternative to the ‘fail’ module in some cases.

Options

parameter required default choices comments
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"
    

    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, Helping Testing PRs and Developing Modules.