Static Inventory
Cheat sheet · https://pcornel.dk/topic.php?topic=5395
Answer
Static inventory stores host/group declarations in versioned or locally managed inventory files rather than discovering them dynamically at runtime.
Remember
- 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.
First checks
cat inventory/hosts.yml— static inventoryansible-inventory -i inventory/hosts.yml --graph— parse- Variables in group_vars, not inline — structure
Verify in this order
file → hosts/groups
Where it usually breaks
A valid static inventory proves a deterministic file can be parsed; it does not prove the file is current or represents live infrastructure accurately.
Inventory/vars → play/task selection → connection/become → module request → module result → target object read-back → handler/service effective state → workload verification.
Static Inventory 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=5395