Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Static Inventory · Ansible

Direct answer

Static inventory stores host/group declarations in versioned or locally managed inventory files rather than discovering them dynamically at runtime.

When to use this

Use it when configuring, checking or troubleshooting Static Inventory in Ansible.

First 30 seconds

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.

Operational verification

file → hosts/groups

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
Ansible automation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformAnsible automation · Static Inventory owns file-backed inventory semantics. Git ownership and CMDB accuracy remain separate concerns.
Scope / prerequisiteUse it when configuring, checking or troubleshooting Static Inventory in Ansible.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

4 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 references

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.

observation · 1
Key points
  • 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.
Key checks
  • cat inventory/hosts.yml — static inventory
  • ansible-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
ProsCons
Easy to read and reviewMust be updated by hand
No external dependencyDrifts from reality as hosts change

When hosts change often, switch to a dynamic inventory from NetBox, a hypervisor or a cloud.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docAnsible automation current

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%
Terminology layer

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.

Aliases that resolve here
static inventoryansible hosts fileini inventoryyaml inventory
Embedded reference data

Quick lookup tables

Static Inventory Ansible boundary map

Fast input/selection, execution/result and target-proof boundaries for Static Inventory.

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
Depth when you need it

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.

Confirmation

Confirm action

Continue?