Hi,
(Disclaimer: I’m very new to ansible so I easily might miss something very straightforward.)
I have a number of sites, e.g. site1, site2, …, siteN. Each site has a number of machines that play a particular “role”, e.g. roleA1, roleA2, roleB1, roleC1, …
I easily created an inventory for sites:
[siteX]
roleA1.siteX.example.com
…
However I could not find a way to have a special group for all available roleY machines. I tried
[roleY]
roleY[1:9].*.example.com
but the result was not what I expected.
Any suggestions on what I should read to better understand how the things work?
the wildcard won’t work, but you can add another range:
roleY[1:9].site[1:9].example.com
Thanks, Brian.
As we discussed today on IRC:
20:54 my site names are 0000 … 9999 (not that many yet, but they grow :))
20:54 so i’d specify [0000:9999]?
20:54 [0000:9999]
20:54 yep
20:55 interesting: it’s so simple meanwhile i wrote a dynamic inventory
20:57 ah…
20:58 i just realised: the example i gave in the post, is not totally accurate
20:59 the host name looks like roleX.siteYYYY...example.com
21:00 where is geographical area (can be 0-2 components), and is either “test” (where is not present) or “prod” (where is 1-2 name components)
21:00 bcoca: do you think i could use ranges in this case as well?
21:01 not sure
So, I will stick to my dynamic inventory script for now.