|
|
|
@ -47,6 +47,8 @@ from return_data import ReturnData
|
|
|
|
|
from ansible.callbacks import DefaultRunnerCallbacks, vv
|
|
|
|
|
from ansible.module_common import ModuleReplacer
|
|
|
|
|
from ansible.module_utils.splitter import split_args
|
|
|
|
|
from ansible.cache import FactCache
|
|
|
|
|
from ansible.utils import update_hash
|
|
|
|
|
|
|
|
|
|
module_replacer = ModuleReplacer(strip_comments=False)
|
|
|
|
|
|
|
|
|
@ -87,7 +89,7 @@ class HostVars(dict):
|
|
|
|
|
def __init__(self, vars_cache, inventory, vault_password=None):
|
|
|
|
|
self.vars_cache = vars_cache
|
|
|
|
|
self.inventory = inventory
|
|
|
|
|
self.lookup = dict()
|
|
|
|
|
self.lookup = {}
|
|
|
|
|
self.update(vars_cache)
|
|
|
|
|
self.vault_password = vault_password
|
|
|
|
|
|
|
|
|
@ -158,7 +160,7 @@ class Runner(object):
|
|
|
|
|
# storage & defaults
|
|
|
|
|
self.check = check
|
|
|
|
|
self.diff = diff
|
|
|
|
|
self.setup_cache = utils.default(setup_cache, lambda: collections.defaultdict(dict))
|
|
|
|
|
self.setup_cache = utils.default(setup_cache, lambda: ansible.cache.FactCache())
|
|
|
|
|
self.vars_cache = utils.default(vars_cache, lambda: collections.defaultdict(dict))
|
|
|
|
|
self.basedir = utils.default(basedir, lambda: os.getcwd())
|
|
|
|
|
self.callbacks = utils.default(callbacks, lambda: DefaultRunnerCallbacks())
|
|
|
|
@ -588,6 +590,7 @@ class Runner(object):
|
|
|
|
|
# merge the VARS and SETUP caches for this host
|
|
|
|
|
combined_cache = self.setup_cache.copy()
|
|
|
|
|
combined_cache.setdefault(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
|
|
|
|
@ -890,6 +893,7 @@ class Runner(object):
|
|
|
|
|
until = self.module_vars.get('until', None)
|
|
|
|
|
if until is not None and result.comm_ok:
|
|
|
|
|
inject[self.module_vars.get('register')] = result.result
|
|
|
|
|
|
|
|
|
|
cond = template.template(self.basedir, until, inject, expand_lists=False)
|
|
|
|
|
if not utils.check_conditional(cond, self.basedir, inject, fail_on_undefined=self.error_on_undefined_vars):
|
|
|
|
|
retries = self.module_vars.get('retries')
|
|
|
|
@ -964,6 +968,7 @@ class Runner(object):
|
|
|
|
|
if self.diff:
|
|
|
|
|
self.callbacks.on_file_diff(conn.host, result.diff)
|
|
|
|
|
self.callbacks.on_ok(host, data)
|
|
|
|
|
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
def _early_needs_tmp_path(self, module_name, handler):
|
|
|
|
|