mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Get all groups' variables in order of depth
Fixes all not being processed, as well as the order of the variable precedence
This commit is contained in:
parent
d5dd89a8f7
commit
bd7e02d629
1 changed files with 2 additions and 2 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue