Properly sort groups by name as well as depth when getting vars
Fixes #17243
This commit is contained in:
parent
f36926f8d3
commit
a83b00bbc0
2 changed files with 2 additions and 2 deletions
|
@ -138,6 +138,6 @@ class Host:
|
|||
def get_group_vars(self):
|
||||
results = {}
|
||||
groups = self.get_groups()
|
||||
for group in sorted(groups, key=lambda g: g.depth):
|
||||
for group in sorted(groups, key=lambda g: (g.depth, g.name)):
|
||||
results = combine_vars(results, group.get_vars())
|
||||
return results
|
||||
|
|
|
@ -252,7 +252,7 @@ class VariableManager:
|
|||
# we merge in vars from groups specified in the inventory (INI or script)
|
||||
all_vars = combine_vars(all_vars, host.get_group_vars())
|
||||
|
||||
for group in sorted(host.get_groups(), key=lambda g: g.depth):
|
||||
for group in sorted(host.get_groups(), key=lambda g: (g.depth, g.name)):
|
||||
if group.name in self._group_vars_files and group.name != 'all':
|
||||
for data in self._group_vars_files[group.name]:
|
||||
data = preprocess_vars(data)
|
||||
|
|
Loading…
Reference in a new issue