Pcornel
Automation · Automation Troubleshooting

Ansible Playbook Failure

Cheat sheet · https://pcornel.dk/topic.php?topic=6062

Back to the Topic

Answer

Ansible Playbook Failure isolates failures across inventory/host selection, variable precedence, collection/module resolution, connection/become, task execution, handlers and target convergence for a specific playbook run.

Remember

  • One host failed ≠ every host remained unchanged.
  • Task ok/changed ≠ service/workload is healthy.
  • Play recap failed=0 ≠ desired state is correct.
  • Rerun entire inventory ≠ safest recovery for partial deployment.

First checks

  • ansible-playbook site.yml -vvv --limit <h> — verbose
  • ansible-playbook site.yml --syntax-check — syntax
  • ansible-playbook site.yml --start-at-task '<task>' — resume

Commands

ansible-playbook --syntax-check <playbook.yml>
Read-only/validation observation for Ansible playbook YAML/parser/module-reference syntax before execution.

Verify in this order

connection → become → task/module → error

Where it usually breaks

Ansible recap and task results are controller evidence; they do not by themselves prove target runtime behavior or that partially completed hosts are consistent.

Inventory/vars → play/task selection → connection/become → module request → module result → target object read-back → handler/service effective state → workload verification. Preserve at least three independent checks: prerequisite/interface or identity/transport state; the owning control/service/policy state; then effective data-plane, backend or workload state. A healthy upstream boundary does not prove the downstream consumer or return path.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=6062

Confirmation

Confirm action

Continue?