adds 'groups' variable, essentially making hosts file accessible as a variable

This commit is contained in:
Jonathan Palley 2012-07-01 15:04:53 +08:00
parent f70885afb0
commit e827782f81

View file

@ -290,6 +290,12 @@ class Runner(object):
inject.update(host_variables) inject.update(host_variables)
inject.update(self.module_vars) inject.update(self.module_vars)
group_hosts = {}
for g in self.inventory.groups:
group_hosts[g.name] = map((lambda x: x.get_variables()),g.hosts)
inject['groups'] = group_hosts
if self.module_name == 'setup': if self.module_name == 'setup':
if not args: if not args:
args = {} args = {}