Pcornel
Automation · Ansible

Ansible Troubleshooting

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

Back to the Topic

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> — verbose
  • ANSIBLE_DEBUG=1 ansible <h> -m ping — deep debug
  • ansible-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

BoundaryHealthy evidenceSuspicious evidence
Inputs / selectionCorrect inventory, hosts, variables/facts and content are explicitWrong scope, stale facts, hidden precedence or content-version drift
ExecutionConnection, privilege, module/task context and ordering match intentUnreachable, wrong execution host, privilege/plugin failure or misleading skip/change state
Result semanticsPer-host/item results are preserved and interpreted correctlyAggregate recap hides partial/skipped/handled failures
Target proofResource/workload read-back and rerun confirm convergenceGreen 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

Confirmation

Confirm action

Continue?