Control Failure: failed_when & ignore_errors
Define what counts as a failure.
You Decide What Failure Means
Ansible fails a task on a nonzero return code, but you can override that. Two keywords let you redefine failure. 🎛️
ignore_errors Keeps Going
Set ignore_errors to true and a failed task is logged but does not stop the play. The host stays in play.
- name: Try optional cleanup
ansible.builtin.command: /opt/maybe-missing
ignore_errors: trueAll 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