What are the INI and YAML inventory formats and how do they differ?
BeginnerConceptInventory
Answer
Both describe the same thing. INI is compact; YAML is better for nested groups and typed variables (lists, dicts, booleans).
[web]
web1 ansible_host=10.0.1.11
web2 ansible_host=10.0.1.12
[web:vars]
http_port=8080
all:
children:
web:
hosts:
web1: { ansible_host: 10.0.1.11 }
web2: { ansible_host: 10.0.1.12 }
vars:
http_port: 8080
In INI, values in key=value are parsed as strings (or literals) with limited typing, which surprises people with [group:vars] lists.
More on Inventory
What is an inventory and why does Ansible need one?BeginnerHow do you create groups of groups?BeginnerExplain host patterns: `:`, `:&`, `:!` and wildcards.IntermediateWhich connection variables can you set per host in inventory?BeginnerWhat are `group_vars` and `host_vars` directories?IntermediateHow do you define a range of hosts in an inventory?Beginner