mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Make sure HostVars object is instantiated before assigning it
Fixes #7006
This commit is contained in:
parent
cc6d213d72
commit
a32dd34359
1 changed files with 2 additions and 1 deletions
|
@ -555,6 +555,7 @@ class Runner(object):
|
|||
# merge the VARS and SETUP caches for this host
|
||||
combined_cache = self.setup_cache.copy()
|
||||
combined_cache.get(host, {}).update(self.vars_cache.get(host, {}))
|
||||
hostvars = HostVars(combined_cache, self.inventory, vault_password=self.vault_pass)
|
||||
|
||||
# use combined_cache and host_variables to template the module_vars
|
||||
module_vars_inject = utils.combine_vars(combined_cache.get(host, {}), host_variables)
|
||||
|
@ -566,7 +567,7 @@ class Runner(object):
|
|||
inject = utils.combine_vars(inject, module_vars)
|
||||
inject = utils.combine_vars(inject, combined_cache.get(host, {}))
|
||||
inject.setdefault('ansible_ssh_user', self.remote_user)
|
||||
inject['hostvars'] = HostVars(combined_cache, self.inventory, vault_password=self.vault_pass)
|
||||
inject['hostvars'] = hostvars
|
||||
inject['group_names'] = host_variables.get('group_names', [])
|
||||
inject['groups'] = self.inventory.groups_list()
|
||||
inject['vars'] = self.module_vars
|
||||
|
|
Loading…
Reference in a new issue