Why don't you simply use the power of the inventory file itself: [group:children] child1 child2
[child1] host1 host2 [child2] host3 host4 and use global vars or per host vars in the appropriate files? N.B: the inventory is an "ini" file not a "yaml" one [*inventoryFile.yaml*]. On Wednesday, July 12, 2017 at 9:17:08 AM UTC+2, ishan jain wrote: > > So is there no way to define something like 'global' variables along with > the inventory ? I thought the implicit 'all' group can be treated like > global variables. > > On Tuesday, 11 July 2017 19:27:06 UTC+2, Brian Coca wrote: >> >> The 'hostList1' inventory variable is not available until AFTER the >> hosts: is processed, this is a chicken/egg issue. >> >> Inventory variables are flattened per host, so only once you have a >> host can you query the value of the variable. >> >> `hosts:` defines which hosts are available, as such it cannot depend >> on a host nor a variable associated to a host. >> >> >> ---------- >> Brian Coca >> > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/2ba2b27f-9b54-424c-91d4-8c553d2ee5db%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
