0Pricing
Ansible Academy · Lesson

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: true

All lessons in this course

  1. Group Tasks with block
  2. Try / Catch with rescue & always
  3. Control Failure: failed_when & ignore_errors
  4. Custom Assertions with the fail Module
← Back to Ansible Academy