mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-30 04:49:09 -07:00
Fix correct variable expansion in includes only_if.
There's not need to run the complete include through the templating engine. Several variables were not included before the conditional was evaluated.
This commit is contained in:
parent
dab50574e0
commit
cd9f926b5f
6 changed files with 61 additions and 6 deletions
|
@ -262,14 +262,15 @@ class Runner(object):
|
|||
async_jid=None, async_module=None, async_limit=None):
|
||||
''' runs a module that has already been transferred '''
|
||||
|
||||
inject = self.setup_cache.get(conn.host,{})
|
||||
inject = self.setup_cache.get(conn.host,{}).copy()
|
||||
host_variables = self.inventory.get_variables(conn.host)
|
||||
inject.update(host_variables)
|
||||
inject.update(self.module_vars)
|
||||
|
||||
conditional = utils.double_template(self.conditional, inject, self.setup_cache)
|
||||
if not eval(conditional):
|
||||
return [ utils.smjson(dict(skipped=True)), None, 'skipped' ]
|
||||
|
||||
host_variables = self.inventory.get_variables(conn.host)
|
||||
inject.update(host_variables)
|
||||
|
||||
if self.module_name == 'setup':
|
||||
args = self._add_setup_vars(inject, args)
|
||||
args = self._add_setup_metadata(args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue