Host variables - Add the "all" group if it's not listed
This commit is contained in:
parent
8c0245ed18
commit
31e5e93d37
1 changed files with 4 additions and 1 deletions
|
@ -1083,7 +1083,10 @@ class InventoryModule(BaseInventoryPlugin):
|
||||||
"""
|
"""
|
||||||
host_obj = self.inventory.get_host(host)
|
host_obj = self.inventory.get_host(host)
|
||||||
host_vars = host_obj.get_vars()
|
host_vars = host_obj.get_vars()
|
||||||
group_vars = get_group_vars(host_obj.get_groups())
|
host_groups = host_obj.get_groups().copy()
|
||||||
|
if not any(g.name == "all" for g in host_groups):
|
||||||
|
host_groups.append(self.inventory.groups["all"])
|
||||||
|
group_vars = get_group_vars(host_groups)
|
||||||
variables = VariableStorage(combine_vars(group_vars, host_vars))
|
variables = VariableStorage(combine_vars(group_vars, host_vars))
|
||||||
for instruction in instructions:
|
for instruction in instructions:
|
||||||
if not instruction.run_for(host, variables):
|
if not instruction.run_for(host, variables):
|
||||||
|
|
Loading…
Reference in a new issue