mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-27 04:41:26 -07:00
Merge pull request #363 from jhoekx/template-only-if
Fix correct variable expansion in includes only_if.
This commit is contained in:
commit
f8807da57b
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