Skip to content

fail

Collection Note

This module is part of the ansible.builtin collection. To install the collection, use:

ansible-galaxy collection install ansible.builtin
Added in version 0.8.

Synopsis

  • This module fails the progress with a custom message.
  • It can be useful for bailing out when a certain condition is met using C(when).
  • This module is also supported for Windows targets.

Parameters

Parameter Defaults / Choices Comments
msg
str
Default: Failed as requested from task
The customized message used for failing execution.
If omitted, fail will simply bail out with a generic message.

Examples

- name: Example using fail and when together
  ansible.builtin.fail:
    msg: The system may not be provisioned according to the CMDB status.
  when: cmdb_status != "to-be-staged"

Authors

  • Dag Wieers (@dagwieers)