Custom Assertions with the fail Module
Stop a play with a clear message.
Stop With a Clear Message
Sometimes you want to halt a play on purpose with a helpful reason. The fail module does exactly that. 🛑
The fail Module
ansible.builtin.fail stops the current host with a custom message you write, instead of a cryptic error.
- name: Refuse unsupported OS
ansible.builtin.fail:
msg: "This playbook supports Ubuntu only"All lessons in this course
- Group Tasks with block
- Try / Catch with rescue & always
- Control Failure: failed_when & ignore_errors
- Custom Assertions with the fail Module