Ansible Troubleshooting
Cheat sheet · https://pcornel.dk/topic.php?topic=5420
Answer
Ansible Troubleshooting isolates automation failures across controller/runtime, configuration, inventory/selection, variables/facts, content/plugin resolution, transport/authentication, privilege, module execution, ordering/concurrency and target-state verification.
Remember
- Play recap failure ≠ root cause location; the first failed boundary can be inventory, variable, plugin, transport, privilege, module or target state.
- Retry success ≠ cause understood; transient network/API/capacity conditions may disappear without remediation.
- Verbose output ≠ safe to share; credentials/secrets can appear in arguments, vars or remote errors.
- changed symptom ≠ original issue fixed; validate the same host/task and target acceptance path.
First checks
ansible-playbook site.yml -vvvv --limit <h>— verboseANSIBLE_DEBUG=1 ansible <h> -m ping— deep debugansible-playbook site.yml --step— interactive step
Commands
ansible-playbook --syntax-check <playbook.yml>- Read-only/validation observation for Ansible playbook YAML/parser/module-reference syntax before execution.
debug
Verify in this order
connection → become → module → result
Where it usually breaks
A rerun that passes proves the original Ansible path now succeeds; root cause closes only when the first failed boundary is explained and target plus regression/idempotency checks support the fix.
Inventory/vars → play/task selection → connection/become → module request → module result → target object read-back → handler/service effective state → workload verification.
Ansible Troubleshooting Ansible boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Inputs / selection | Correct inventory, hosts, variables/facts and content are explicit | Wrong scope, stale facts, hidden precedence or content-version drift |
| Execution | Connection, privilege, module/task context and ordering match intent | Unreachable, wrong execution host, privilege/plugin failure or misleading skip/change state |
| Result semantics | Per-host/item results are preserved and interpreted correctly | Aggregate recap hides partial/skipped/handled failures |
| Target proof | Resource/workload read-back and rerun confirm convergence | Green Ansible status treated as end-to-end acceptance |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5420