I am creating my own dynamic inventory script. I have some variables that need to exist for every group throughout any playbook for this inventory. If I just emit and “all” group with a vars dictionary, would that be enough to get this working? Thanks
I think the problem you will then run into, is that you will have to explicitly add all hosts to the ‘all’ group.
Using an inventory script is more explicit than an inventory file. If you define ‘all’ I believe it treats your declaration of that group as the definitive truth, and if you leave out the servers, the ‘all’ group will then be empty.
I think the problem you will then run into, is that you will have to
explicitly add all hosts to the 'all' group.
No, the script parsing will do that. Right now, every group is added as
child of 'all' (instead of just top level groups)
Using an inventory script is more explicit than an inventory file. If you
define 'all' I believe it treats your declaration of that group as the
definitive truth, and if you leave out the servers, the 'all' group will
then be empty.
So the script will make sure that groups are children of all, so in the
end, all hosts will be part of all (be it directly or indirectly).
So to Seth's original question, yes, that will be working.