.. _fail: fail `````````````````````````````` .. versionadded:: 0.8 This module fails the progress with a custom message. It can be useful for bailing out when a certain condition is met using only_if. .. raw:: html
parameter | required | default | choices | comments |
---|---|---|---|---|
msg | no | Failed because only_if condition is true | The customized message used for failing execution. If ommited, fail will simple bail out with a generic message. | |
rc | no | 1 | The return code of the failure. This is currently not used by Ansible, but might be used in the future. |
Example of how a playbook may fail when a condition is not met
[{'action': 'fail msg="The system may not be provisioned according to the CMDB status."', 'only_if': "'$cmdb_status' != 'to-be-staged'"}]