host range
A shorthand in an inventory where [start:end] in a host name expands into one host per number or letter in the range.
In more detail
web[1:3].example.com becomes web1, web2 and web3. It saves typing and copy-paste mistakes, and works in both INI and YAML inventories. Check the expansion with ansible-inventory --graph.
Related terms
- inventory — The list of hosts Ansible may manage, arranged into groups and optionally carrying variables for each host or group.
- ansible-inventory — The command that shows how Ansible parsed the inventory, as a tree of groups or as the resolved variables for one host.
Taught in
- The Static Inventory File — Ansible Configuration Management at Scale
- Host Groups And Host Variables — Ansible Configuration Management at Scale
- Inventory Variables: Ranges, group_vars And host_vars — RHCE in Ansible (EX294): Automate Red Hat Systems