Jakub Kubrynski
Jakub Kubrynski

Reputation: 14149

Wildcard in Ansible inventory group

I have hosts groups defined in the single inventory file. Groups are split into datacenters.

[first.dc1]
...
[second.dc1]
...
[first.dc2]
...
[second.dc2]
...

I want to define child grouping all groups with suffix dc1

[dc1:children]
*.dc1

Is it possible in Ansible? I've tried *, all, ranges but it doesn't work

Upvotes: 5

Views: 8884

Answers (1)

udondan
udondan

Reputation: 59989

Unfortunately this seems to be not possible. Ranges in Ansible inventroy are defined as [1:99] but this only is expanded in hostnames, not in host group names. Also there are no wildcards.

You could help yourself with an inventory script, which dynamically generates the group dependencies.

Upvotes: 4

Related Questions