Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

Inventory · Ansible

Direct answer

Ansible inventory defines the addressable host/group model and can attach variables or metadata used during host selection and execution.

When to use this

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

First 30 seconds

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.

Operational verification

inventory source → hosts/groups → plays

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 · Inventory owns Ansible host/group source semantics. CMDB/source-of-truth platforms remain separate systems whose data may feed inventory.
Scope / prerequisiteUse it when configuring, checking or troubleshooting 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 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 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
  • 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.
Key checks
  • ansible-inventory -i inventory --graph — groups
  • ansible-inventory -i inventory --list — JSON
  • ansible-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.

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 > 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
ansible inventoryinventory hostsansible groupsinventory variables
Embedded reference data

Quick lookup tables

Inventory Ansible boundary map

Fast input/selection, execution/result and target-proof boundaries for 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 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?