Interview Prep/Ansible/Vault, Privilege Escalation and Error Handling

What are the exit codes of `ansible-playbook`?

IntermediateConceptVault, Privilege Escalation and Error Handling
Answer
  • 0 — success
  • 1 — error (generic)
  • 2 — one or more hosts failed
  • 3 — one or more hosts were unreachable
  • 4 — parser error
  • 5 — bad or incomplete options
  • 99 — interrupted by the user
  • 250 — unexpected error

CI jobs rely on these. Note that ignore_errors and rescued failures still return 0, and a run where every host is unreachable returns 3, not 2.

All Ansible questions Roadmap: Ansible

More on Vault, Privilege Escalation and Error Handling