Use it when configuring, checking or troubleshooting Inventory in Ansible.
Inventory · Ansible
Ansible inventory defines the addressable host/group model and can attach variables or metadata used during host selection and execution.
1. Inventory: hosts, groups, variables.
2. INI/YAML static or dynamic plugins.
3. Group by role/site/env.
4. Use multiple inventory sources per environment.
5. Validate.
inventory source → hosts/groups → plays
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
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 Operational evidence path Verify boundary
inventory source/plugin → host/group graph → pattern/limit selection → connection vars → variable precedence → target execution
Healthy evidence: inventory source is known, host/group graph and endpoint mapping match intent, and selected hosts/effective values are verified.
Step 2 Failure modes and next checks Narrow the fault
Suspicious evidence: duplicate or shadowed hosts, unexpected groups, wrong ansible_host/connection values, stale source data or confusing inventory vars with final values.
Step 3 Common mistakes Narrow the fault
- Hosts in several groups with conflicting variables.
- Inventory names that do not resolve.
Step 4 Where it fails Narrow the fault
Where Inventory usually goes wrong: source authority, host/object identity, grouping/selection, staleness and downstream target resolution.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Host in inventory ≠ selected by the play; pattern/limit can exclude it.
- Inventory hostname ≠ DNS name or IP; connection variables can redirect the endpoint.
- Group membership ≠ authorization; it is automation metadata, not an access-control decision.
- Inventory variable ≠ final variable value; higher-precedence sources may override it.
ansible-inventory -i inventory --graph— groupsansible-inventory -i inventory --list— JSONansible-inventory --host <h>— host vars
ReferenceWhat it is1 section · depth on demand
Core model
Resolve inventory from its actual source/plugins, then separate host identity, groups, connection variables and inventory-sourced variables from later precedence layers.
ReferenceImportant terms & boundaries2 sections · depth on demand
What this shows and what it does not
Inventory output shows Ansible sees a host/group model, but it does not show reachability, authorization or final variable values.
In depth
The Ansible inventory lists managed hosts, organises them into groups and assigns variables. Playbooks target groups, so the inventory decides where automation runs.
[core]
core01 ansible_host=10.0.0.1
[access]
sw[01:20]
[oslo:children]
core
access
[oslo:vars]
ntp_server=10.0.0.10
ansible-inventory -i inventory/ --graph
ansible-inventory -i inventory/ --host sw01
Keep group and host variables in group_vars/ and host_vars/ directories next to the inventory rather than inline.
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 Ansible > Inventory. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.ansible.com/ansible/latest/ · confidence 94%Terms & aliases
Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.
Quick lookup tables
Inventory Ansible boundary map
Fast input/selection, execution/result and target-proof boundaries for Inventory.
| 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 |
Deep reference
Healthy vs suspicious evidence
Output interpretation
For Inventory, rely on structured fields and stable IDs (source authority, host/object identity, grouping/selection, staleness and downstream target resolution) rather than text formatted for display.