How does `ignore_errors` for all tasks interact with a task's `failed_when` condition?

Question

Grade: Education Subject: Help
How does `ignore_errors` for all tasks interact with a task's `failed_when` condition?
Asked by:
86 Viewed 86 Answers

Answer (86)

Best Answer
(568)
The `failed_when` condition is evaluated *before* `ignore_errors`. If a task's result meets the `failed_when` criteria, the task is marked as 'failed' internally. However, if `ignore_errors: true` is set at the play level (or for that specific task), this 'failure' status will then be disregarded by Ansible's playbook execution logic, allowing the playbook to continue to the next task. In essence, `failed_when` determines *if* a task failed based on its output, and `ignore_errors` determines *what happens next* if it failed, preventing the playbook from halting.