Quiz Entry - updated: 2026.10.30
How do INI and YAML inventories differ, and when would you choose each?
Both describe the same hosts and groups. INI is shorter and quick for small inventories; YAML is more structured and better for large inventories with nesting and variables.
The same idea in both formats:
[webserver]
web1.example.com
web2.example.com
[database]
db1.example.com
all:
children:
webserver:
hosts:
web1.example.com:
web2.example.com:
database:
hosts:
db1.example.com:
| INI | YAML | |
|---|---|---|
| File name | inventory or *.ini |
*.yml / *.yaml (for example hosts.yml) |
| Groups | [name] headers, children via [name:children] |
Nested children: and hosts: keys |
| Strength | Very compact, easy to read for a few hosts | Clear hierarchy, natural place for structured variables |
| Weakness | Gets messy with many variables and deep nesting | More lines, indentation must be exact |
In YAML every host is a key ending in a colon, with an empty value unless it carries variables. That is why web1.example.com: has nothing after the colon.
Go deeper:
Inventory basics: formats, hosts, and groups (official docs) — the same inventory shown in both formats.
YAML (Wikipedia) — syntax background for the YAML variant.