Use this when defining individual hosts in inventory.
Hosts
Hosts in an inventory are individual managed systems, each with a name, connection address and host variables such as platform, credentials reference or role.
1. Hosts are targets with connection settings.
2. Use management IP/DNS.
3. Platform-specific connection vars.
4. Consistent names.
5. Remove retired hosts.
host entry → connection vars → target
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 Verification path Verify boundary
The negative fixture should deliberately exercise risks such as duplicate labels, stale inventory, conflicting authority, broad filters, race between read and write, orphaned relationships and automation acting on data not yet reconciled, choosing the cases most relevant to inventory host identity, aliases versus connection address, host/group variable precedence and bounded selection patterns.
Step 2 Common mistakes Narrow the fault
- Connecting by names that DNS does not resolve.
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.
- Each host has a name and connection address.
- Host variables override group variables.
- Names must be unique.
ansible-inventory --host <h>— host vars- ansible_host/ansible_network_os set — connection
- Hostname conventions — consistency
ReferenceWhy it matters1 section · depth on demand
What it is
Hosts are individual targets with a name, connection address and host variables.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
A host entry describes one managed system: its name, connection address, platform and host-specific variables. Hosts can belong to many groups at once.
all:
children:
access_switches:
hosts:
sw-oslo-07:
ansible_host: 10.20.0.7
ansible_network_os: cisco.ios.ios
site: oslo
Use stable names (matching DNS and the source of truth) as host identifiers, keep connection addresses in ansible_host, and put as few variables on hosts as possible — most belong in group variables, so that differences between hosts are the exceptions they should be.
Example
[switches]
sw01 ansible_host=10.0.0.11 ansible_network_os=cisco.ios.ios
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 Inventory > Hosts. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
For inventory host identity, aliases versus connection address, host/group variable precedence and bounded selection patterns, prefer typed fields and stable IDs over human presentation text.