From 40b222867fed74468c4fb5c4b4a1072780fb8fb7 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 24 May 2017 12:50:05 -0400 Subject: [PATCH] ensure fullpaths on vars files (#24990) fixes #24970 now correctly picks up group/host vars inside group/host named directories --- lib/ansible/plugins/vars/host_group_vars.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ansible/plugins/vars/host_group_vars.py b/lib/ansible/plugins/vars/host_group_vars.py index a3af8c0686f..6feed672169 100644 --- a/lib/ansible/plugins/vars/host_group_vars.py +++ b/lib/ansible/plugins/vars/host_group_vars.py @@ -99,10 +99,11 @@ class VarsModule(BaseVarsPlugin): if os.path.isdir(full_path): # matched dir name, so use all files included recursively for spath in os.listdir(full_path): - if os.path.isdir(spath): - found.extend(self._find_vars_files(spath, name)) + full_spath = os.path.join(full_path, spath) + if os.path.isdir(full_spath): + found.extend(self._find_vars_files(full_spath, '')) else: - found.append(spath) + found.append(full_spath) else: found.append(full_path) return found