Interview Prep/Ansible/Playbook Design, Handlers and Idempotency

A deployment must stop on the first host that fails and not touch the rest.

IntermediateScenarioPlaybook Design, Handlers and Idempotency
Answer

Situation read → Fail-fast rollout.

What I'd do →

- hosts: web
  serial: 1
  max_fail_percentage: 0
  any_errors_fatal: true

Why → serial: 1 isolates risk, and any_errors_fatal aborts the play for all hosts when any task fails.

Interview tip → Without serial, max_fail_percentage is evaluated across the whole play, so it behaves differently.

All Ansible questions Roadmap: Ansible

More on Playbook Design, Handlers and Idempotency