mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-04-24 11:21:25 -07:00
Added "debug: var=variableName" capability.
This commit is contained in:
parent
84ff24d92c
commit
e131de4de0
5 changed files with 44 additions and 13 deletions
|
@ -38,13 +38,21 @@ class ActionModule(object):
|
|||
|
||||
kv = utils.parse_kv(module_args)
|
||||
args.update(kv)
|
||||
if not 'msg' in args:
|
||||
|
||||
if not 'msg' in args and not 'var' in args:
|
||||
args['msg'] = 'Hello world!'
|
||||
|
||||
if 'fail' in args and utils.boolean(args['fail']):
|
||||
result = dict(failed=True, msg=args['msg'])
|
||||
else:
|
||||
result = dict(msg=args['msg'])
|
||||
result = {}
|
||||
if 'msg' in args:
|
||||
if 'fail' in args and utils.boolean(args['fail']):
|
||||
result = dict(failed=True, msg=args['msg'])
|
||||
else:
|
||||
result = dict(msg=args['msg'])
|
||||
elif 'var' in args:
|
||||
(intermediate, exception) = utils.safe_eval(args['var'], inject, include_exceptions=True, template_call=True)
|
||||
if exception is not None:
|
||||
intermediate = "failed to evaluate: %s" % str(exception)
|
||||
result[args['var']] = intermediate
|
||||
|
||||
# force flag to make debug output module always verbose
|
||||
result['verbose_always'] = True
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue