I have a use case for setting some global vars via the inventory (rather than group_vars/all for instance). This works as expected when using an inventory file ([all:vars]). However when using an inventory script these global variables are not surfacing (to templates et al).
I see group.set_variable being called with the proper var for my script inventories all vars. However, I believe inventory.script.__parse is not setup to handle/expect an ‘all’ group user defined. When it encounters an all group defined in the inventory it creates a new Group rather than using the default all group, and then adds that user defined all group as a child of the default all group (which means the user defined all vars are effectively meaningless)
This could be fixed as easily with something like:
if ‘vars’ in data:
for k, v in data[‘vars’].iteritems():
if group.name == all.name:
all.set_variable(k, v)
else:
group.set_variable(k, v)
Is this worthy of a pull request?