LOGBOOK

HELP

Quiz Entry - updated: 2026.10.30

What do host ranges like washington[1:2].example.com and ontario[01:02].example.com expand to?

Ranges are shorthand for many similar hostnames: washington[1:2] becomes washington1 and washington2, ontario[01:02] becomes ontario01 and ontario02, and server[a:d] becomes servera to serverd.

Writing [start:end] inside a hostname makes Ansible generate one host per value. Ranges are inclusive and work with numbers and letters:

Entry Expands to
washington[1:2].example.com washington1, washington2
ontario[01:02].example.com ontario01, ontario02
server[a:d].lab.example.com servera, serverb, serverc, serverd

The trap is leading zeros: they are part of the generated name. [01:02] produces ontario01, so asking for washington01.example.com when the inventory said washington[1:2] finds nothing. Ansible then warns "provided hosts list is empty, only localhost is available" and shows hosts (0), while washington1.example.com is found. Pick one naming style and match it exactly.

Go deeper:

From Quiz: ITIA / Ansible Inventory, Configuration and Playbooks | Updated: Oct 30, 2026