How do you define a range of hosts in an inventory?
BeginnerConceptInventory
Answer
Use bracket ranges, numeric or alphabetic, with an optional stride and zero padding.
[web]
web[01:10].example.com
[dbs]
db-[a:c].example.com
[odd]
node[1:9:2]
The first expands to web01 through web10. Check with ansible-inventory --graph.
More on Inventory
What is an inventory and why does Ansible need one?BeginnerWhat are the INI and YAML inventory formats and how do they differ?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?Intermediate