mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Allow specifying args directly to actions using module: syntax
Makes things like - name: do complex things with complex module complex: setting_a: true setting_b: - foo - bar possible. Fixes #2228.
This commit is contained in:
parent
4807fbc8b7
commit
c04d5ba739
1 changed files with 7 additions and 0 deletions
|
@ -47,6 +47,13 @@ class Task(object):
|
|||
if x in utils.plugins.module_finder:
|
||||
if 'action' in ds:
|
||||
raise errors.AnsibleError("multiple actions specified in task %s" % (ds.get('name', ds['action'])))
|
||||
if isinstance(ds[x], dict):
|
||||
if 'args' in ds:
|
||||
raise errors.AnsibleError("can't combine args: and a dict for %s: in task %s" % (x, ds.get('name', "%s: %s" % (x, ds[x]))))
|
||||
ds['args'] = ds[x]
|
||||
ds[x] = ''
|
||||
elif ds[x] is None:
|
||||
ds[x] = ''
|
||||
if not isinstance(ds[x], basestring):
|
||||
raise errors.AnsibleError("action specified for task %s has invalid type %s" % (ds.get('name', "%s: %s" % (x, ds[x])), type(ds[x])))
|
||||
ds['action'] = x + " " + ds[x]
|
||||
|
|
Loading…
Reference in a new issue