From a0dea1ac3565179cff072969d5f912db65483eb8 Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Tue, 19 Apr 2016 12:40:08 -0400 Subject: [PATCH] Fix var precedence bug introduced in ff9f5d7d Fixes #14067 --- lib/ansible/vars/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/ansible/vars/__init__.py b/lib/ansible/vars/__init__.py index e7f03ffb51..4496d20ab5 100644 --- a/lib/ansible/vars/__init__.py +++ b/lib/ansible/vars/__init__.py @@ -239,15 +239,15 @@ class VariableManager: # files and then any vars from host_vars files which may apply to # this host or the groups it belongs to - # we merge in vars from groups specified in the inventory (INI or script) - all_vars = combine_vars(all_vars, host.get_group_vars()) - - # then we merge in the special 'all' group_vars first, if they exist + # we merge in the special 'all' group_vars first, if they exist if 'all' in self._group_vars_files: data = preprocess_vars(self._group_vars_files['all']) for item in data: all_vars = combine_vars(all_vars, item) + # 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): if group.name in self._group_vars_files and group.name != 'all': for data in self._group_vars_files[group.name]: