Use this when configuration management runs fail or give wrong results.
Configuration Management Troubleshooting
Troubleshoot configuration management by running in check or verbose mode, reading which resource or task failed, checking variable precedence, facts and inventory, and connectivity and privileges on the target.
1. Failures: connectivity, privilege, missing facts, template errors, module args.
2. Run verbose on one host.
3. Check vars precedence.
4. Read module return values.
5. Fix and add tests.
controller → host → task → module → error
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
ansible-inventory --listPrimary Commands
Configuration and operational commands for this Topic.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Close configuration management with read-back and a no-op rerun Verify boundary
After remediation, read the authoritative target configuration from the managed node and verify the runtime consumer has loaded the intended value. Repeat the original service or workload test from the original context, then run the same configuration-management operation again and expect a no-op or an explicitly understood stable result. Correlate controller output with target-side logs or state when the apply path is asynchronous. A successful controller task shows execution at the automation layer; it does not by itself show that the target converged or that the application now behaves correctly.
Step 2 Command read-back and what it shows Verify boundary
Known-good is the intended host appears once with the expected groups/variables and the original play reaches a changed-or-ok result that leaves the target in the declared state; broken state is the host is missing/duplicated, variables resolve to an unexpected value, or the play still reports unreachable/failed after inventory resolution is correct. Inventory output shows controller-side target resolution only; it cannot show transport, module execution or final service health.
Step 3 Separate render, delivery, apply and convergence failures Narrow the fault
If the intended value is absent from the rendered candidate, branch into variable precedence, inventory, template or policy selection before testing transport. If the candidate is correct but never reaches the target, inspect authentication, connectivity, agent health, locks and task results. If the target file or datastore changes but runtime behavior stays old, identify the service reload, daemon restart, reconciliation loop or cache that owns effective state. If every run reports a new change, compare normalized before/after state for unstable ordering, timestamps, defaults or non-idempotent actions instead of treating repeated “changed” status as harmless.
Step 4 Common mistakes Narrow the fault
- Not checking which run last changed a resource.
Step 5 Observation-driven branch and next-check logic Narrow the fault
If the expected host is absent or grouped incorrectly, inspect inventory sources and group precedence; if the host exists but connection data is wrong, compare resolved hostvars and transport credentials; if inventory and connection are correct but tasks fail, move to module output, privilege escalation and target-side state.
- Check mode shows what would change.
- Variable precedence explains wrong values.
- Facts may be stale.
ansible-playbook site.yml -vvv --limit <host>— verboseansible <host> -m setup— factsansible-playbook site.yml --start-at-task '<task>'— resume
ReferenceWhy it matters1 section · depth on demand
Configuration convergence has more than one state
Configuration Management troubleshooting must distinguish desired source, rendered candidate, transport or agent execution, persisted target configuration and effective runtime state. A controller can report a successful task while the target later rejects a reload, keeps an old generated file, is overridden by a higher-precedence source or has not restarted the consuming service. Idempotency is another observable boundary: a second run against a converged target should normally produce no unintended delta. Treat controller result, target read-back and workload behavior as separate facts rather than collapsing them into one green job status.
ReferenceHow it works1 section · depth on demand
How it works
Configuration Management Troubleshooting is governed by inventory resolution, variable precedence, module execution and target convergence. The controller resolves hosts and group variables before a play reaches a managed node; connection plugins and privilege escalation then determine whether the declared task can execute against the intended host context. Inventory sources, credentials, transport reachability, Python/module support and the managed service are separate things to check. The important state separation is that an inventory entry can be syntactically valid while resolving the wrong host or variables, and a successful connection can coexist with a task that never converges the target state.
ReferenceImportant terms & boundaries1 section · depth on demand
Method
Configuration management troubleshooting isolates whether the definition, the data, the connection or the target is wrong.
1. Rerun on one host with verbose output (-vvv, --debug).
2. Check which variables the host actually got (ansible-inventory --host h, Hiera lookups).
3. Check connectivity and privilege escalation.
4. Check the target: package repos, file permissions, service manager.
5. Run twice: if the second run still changes things, the task is not idempotent.
| Symptom | Likely cause |
|---|---|
| Wrong value applied | Variable precedence |
| Always "changed" | Non-idempotent command/template ordering |
| Works on some hosts | Different OS versions or facts |
| Change reverted later | Another tool or GPO manages the same setting |
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Configuration Management > Configuration Management Troubleshooting. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_intro.html · confidence 94%