Use it when configuring, checking or troubleshooting Static Inventory in Ansible.
Static Inventory · Ansible
Static inventory stores host/group declarations in versioned or locally managed inventory files rather than discovering them dynamically at runtime.
1. Static inventory files list hosts manually.
2. YAML preferred.
3. Fine for small/stable environments.
4. Keep vars in group_vars.
5. Risk of drift from reality.
file → hosts/groups
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 file/version → parser → host/group graph → connection vars → selected hosts → live endpoint validation
Healthy evidence: the active file/version is explicit, parsing matches intended groups/hosts, and representative endpoint data is validated.
Step 2 Failure modes and next checks Narrow the fault
Suspicious evidence: stale checked-in hosts, wrong inventory file, uncommitted local changes, duplicate names or valid syntax pointing at wrong systems.
Step 3 Common mistakes Narrow the fault
- Static inventory out of sync with reality.
Step 4 Where it fails Narrow the fault
Where Static 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.
- Static ≠ current; file-backed inventory can become stale relative to infrastructure.
- File parses ≠ host mapping correct; syntactic validity does not validate endpoints.
- Committed file ≠ active file; invocation/config may point to another inventory source.
- Static inventory ≠ immutable; local edits can diverge from version control.
cat inventory/hosts.yml— static inventoryansible-inventory -i inventory/hosts.yml --graph— parse- Variables in group_vars, not inline — structure
ReferenceWhat it is1 section · depth on demand
Core model
Validate file identity, syntax, host/group structure, connection variables and update process; static data is deterministic only if the correct file and version are actually used.
ReferenceImportant terms & boundaries2 sections · depth on demand
What this shows and what it does not
A valid static inventory shows a deterministic file can be parsed, but it does not show the file is current or represents live infrastructure accurately.
In depth
A static inventory is a hand-maintained INI or YAML file listing hosts and groups. It is simple and reviewable in Git, and suits small or stable environments.
all:
children:
switches:
hosts:
sw01: { ansible_host: 10.0.1.11 }
sw02: { ansible_host: 10.0.1.12 }
vars:
ansible_network_os: cisco.ios.ios
| Pros | Cons |
|---|---|
| Easy to read and review | Must be updated by hand |
| No external dependency | Drifts from reality as hosts change |
When hosts change often, switch to a dynamic inventory from NetBox, a hypervisor or a cloud.
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 > Static 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
Static Inventory Ansible boundary map
Fast input/selection, execution/result and target-proof boundaries for Static 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 Static 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.