Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix sorting of groups for host vars #13371

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/ansible/vars/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ def get_vars(self, loader, play=None, host=None, task=None, include_hostvars=Tru
for item in data:
all_vars = combine_vars(all_vars, item)

for group in host.get_groups():
for group in sorted(host.get_groups(), key=lambda g: g.depth):
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)
Expand Down Expand Up @@ -415,7 +415,7 @@ def _get_delegated_vars(self, loader, play, task, existing_variables):
items = []
if task.loop is not None:
if task.loop in lookup_loader:
#TODO: remove convert_bare true and deprecate this in with_
#TODO: remove convert_bare true and deprecate this in with_
try:
loop_terms = listify_lookup_plugin_terms(terms=task.loop_args, templar=templar, loader=loader, fail_on_undefined=True, convert_bare=True)
except AnsibleUndefinedVariable as e:
Expand Down Expand Up @@ -615,4 +615,3 @@ def set_host_variable(self, host, varname, value):
if host_name not in self._vars_cache:
self._vars_cache[host_name] = dict()
self._vars_cache[host_name][varname] = value