Interview Prep/Ansible/Playbooks, Plays, Tasks and Handlers

How do `any_errors_fatal` and `max_fail_percentage` control failure scope?

AdvancedConceptPlaybooks, Plays, Tasks and Handlers
Answer

By default one host failing only removes that host; others carry on. any_errors_fatal: true makes any failure stop the entire play for every host after the current task, useful for coordinated changes. max_fail_percentage aborts the play once more than that share of hosts in a batch has failed.

- hosts: web
  serial: 5
  max_fail_percentage: 20
  tasks: [...]

The percentage is checked per serial batch, and uses "greater than", so with batch size 5 and max_fail_percentage: 20, two failures abort but one does not. Without serial, the whole inventory is the single batch.

All Ansible questions Roadmap: Ansible

More on Playbooks, Plays, Tasks and Handlers