Get all groups' variables in order of depth

Fixes all not being processed, as well as the order of the variable
precedence
parent d5dd89a8
......@@ -54,12 +54,12 @@ class Host(object):
def get_variables(self):
results = {}
for group in self.groups:
groups = self.get_groups()
for group in sorted(groups, key=lambda g: g.depth):
results.update(group.get_variables())
results.update(self.vars)
results['inventory_hostname'] = self.name
results['inventory_hostname_short'] = self.name.split('.')[0]
groups = self.get_groups()
results['group_names'] = sorted([ g.name for g in groups if g.name != 'all'])
return results
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment