mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-02 14:40:19 -07:00
Make sure we add host/group vars files when parsing inventory
Also fixes a bug where add_host was not adding the vars files Fixes #16117
This commit is contained in:
parent
61f132a609
commit
560532da7d
2 changed files with 5 additions and 1 deletions
|
@ -425,6 +425,7 @@ class StrategyBase:
|
|||
if not new_host:
|
||||
new_host = Host(name=host_name)
|
||||
self._inventory._hosts_cache[host_name] = new_host
|
||||
self._inventory.get_host_vars(new_host)
|
||||
|
||||
allgroup = self._inventory.get_group('all')
|
||||
allgroup.add_host(new_host)
|
||||
|
@ -438,6 +439,7 @@ class StrategyBase:
|
|||
if not self._inventory.get_group(group_name):
|
||||
new_group = Group(group_name)
|
||||
self._inventory.add_group(new_group)
|
||||
self._inventory.get_group_vars(new_group)
|
||||
new_group.vars = self._inventory.get_group_variables(group_name)
|
||||
else:
|
||||
new_group = self._inventory.get_group(group_name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue