|
|
@ -624,6 +624,7 @@ class Runner(object):
|
|
|
|
inject['defaults'] = self.default_vars
|
|
|
|
inject['defaults'] = self.default_vars
|
|
|
|
inject['environment'] = self.environment
|
|
|
|
inject['environment'] = self.environment
|
|
|
|
inject['playbook_dir'] = os.path.abspath(self.basedir)
|
|
|
|
inject['playbook_dir'] = os.path.abspath(self.basedir)
|
|
|
|
|
|
|
|
inject['omit'] = OMIT_PLACE_HOLDER
|
|
|
|
|
|
|
|
|
|
|
|
# template this one is available, callbacks use this
|
|
|
|
# template this one is available, callbacks use this
|
|
|
|
delegate_to = self.module_vars.get('delegate_to')
|
|
|
|
delegate_to = self.module_vars.get('delegate_to')
|
|
|
@ -867,11 +868,8 @@ class Runner(object):
|
|
|
|
|
|
|
|
|
|
|
|
# allow module args to work as a dictionary
|
|
|
|
# allow module args to work as a dictionary
|
|
|
|
# though it is usually a string
|
|
|
|
# though it is usually a string
|
|
|
|
if type(module_args) == dict:
|
|
|
|
if isinstance(module_args, dict):
|
|
|
|
new_args = []
|
|
|
|
module_args = utils.serialize_args(module_args)
|
|
|
|
for (k, v) in module_args.iteritems():
|
|
|
|
|
|
|
|
new_args.append("%s='%s'" % (k, v))
|
|
|
|
|
|
|
|
module_args = ' '.join(new_args)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# render module_args and complex_args templates
|
|
|
|
# render module_args and complex_args templates
|
|
|
|
try:
|
|
|
|
try:
|
|
|
@ -893,13 +891,16 @@ class Runner(object):
|
|
|
|
except jinja2.exceptions.UndefinedError, e:
|
|
|
|
except jinja2.exceptions.UndefinedError, e:
|
|
|
|
raise errors.AnsibleUndefinedVariable("One or more undefined variables: %s" % str(e))
|
|
|
|
raise errors.AnsibleUndefinedVariable("One or more undefined variables: %s" % str(e))
|
|
|
|
|
|
|
|
|
|
|
|
# filter omitted arguments out
|
|
|
|
def not_omitted(item):
|
|
|
|
new_complex_args = {}
|
|
|
|
return item[1] != OMIT_PLACE_HOLDER
|
|
|
|
for key, value in complex_args.iteritems():
|
|
|
|
|
|
|
|
if value == OMIT_PLACE_HOLDER:
|
|
|
|
if module_name not in ['shell', 'command']:
|
|
|
|
continue
|
|
|
|
# filter omitted arguments out from complex_args
|
|
|
|
new_complex_args[key] = value
|
|
|
|
complex_args = dict(filter(not_omitted, complex_args.iteritems()))
|
|
|
|
complex_args = new_complex_args
|
|
|
|
# filter omitted arguments out from module_args
|
|
|
|
|
|
|
|
module_kv = utils.parse_kv(module_args)
|
|
|
|
|
|
|
|
module_kv = dict(filter(not_omitted, module_kv.iteritems()))
|
|
|
|
|
|
|
|
module_args = utils.serialize_args(module_kv)
|
|
|
|
|
|
|
|
|
|
|
|
result = handler.run(conn, tmp, module_name, module_args, inject, complex_args)
|
|
|
|
result = handler.run(conn, tmp, module_name, module_args, inject, complex_args)
|
|
|
|
# Code for do until feature
|
|
|
|
# Code for do until feature
|
|
|
|