mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-23 05:10:22 -07:00
Have group/host var file loading check for YAML extensions too
Fixes #11132
This commit is contained in:
parent
98e5f73f44
commit
30c1a2d861
2 changed files with 23 additions and 9 deletions
|
@ -661,11 +661,11 @@ class Inventory(object):
|
|||
if group and host is None:
|
||||
# load vars in dir/group_vars/name_of_group
|
||||
base_path = os.path.join(basedir, "group_vars/%s" % group.name)
|
||||
self._variable_manager.add_group_vars_file(base_path, self._loader)
|
||||
results = self._variable_manager.add_group_vars_file(base_path, self._loader)
|
||||
elif host and group is None:
|
||||
# same for hostvars in dir/host_vars/name_of_host
|
||||
base_path = os.path.join(basedir, "host_vars/%s" % host.name)
|
||||
self._variable_manager.add_host_vars_file(base_path, self._loader)
|
||||
results = self._variable_manager.add_host_vars_file(base_path, self._loader)
|
||||
|
||||
# all done, results is a dictionary of variables for this particular host.
|
||||
return results
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue