Revise patch from earlier using even more variable sources for HostVars
Superceeds e61e8a3
Fixes #9684
This commit is contained in:
parent
7329bcde99
commit
29d41bb789
1 changed files with 15 additions and 1 deletions
|
@ -667,8 +667,22 @@ class Runner(object):
|
||||||
def _executor_internal(self, host, new_stdin):
|
def _executor_internal(self, host, new_stdin):
|
||||||
''' executes any module one or more times '''
|
''' executes any module one or more times '''
|
||||||
|
|
||||||
|
# We build the proper injected dictionary for all future
|
||||||
|
# templating operations in this run
|
||||||
inject = self.get_inject_vars(host)
|
inject = self.get_inject_vars(host)
|
||||||
hostvars = HostVars(utils.merge_hash(inject['combined_cache'], self.extra_vars), self.inventory, vault_password=self.vault_pass)
|
|
||||||
|
# Then we selectively merge some variable dictionaries down to a
|
||||||
|
# single dictionary, used to template the HostVars for this host
|
||||||
|
temp_vars = self.inventory.get_variables(host, vault_password=self.vault_pass)
|
||||||
|
temp_vars = utils.merge_hash(temp_vars, inject['combined_cache'])
|
||||||
|
temp_vars = utils.merge_hash(temp_vars, self.play_vars)
|
||||||
|
temp_vars = utils.merge_hash(temp_vars, self.play_file_vars)
|
||||||
|
temp_vars = utils.merge_hash(temp_vars, self.extra_vars)
|
||||||
|
|
||||||
|
hostvars = HostVars(temp_vars, self.inventory, vault_password=self.vault_pass)
|
||||||
|
|
||||||
|
# and we save the HostVars in the injected dictionary so they
|
||||||
|
# may be referenced from playbooks/templates
|
||||||
inject['hostvars'] = hostvars
|
inject['hostvars'] = hostvars
|
||||||
|
|
||||||
host_connection = inject.get('ansible_connection', self.transport)
|
host_connection = inject.get('ansible_connection', self.transport)
|
||||||
|
|
Loading…
Reference in a new issue