Extend module_defaults by adding default groups for cloud modules (#44127)

Extends `module_defaults` by adding a prefix to defaults `group/` which denotes a builtin list of modules. Initial groups are: `group/aws`, `group/azure`, and `group/gcp`
This commit is contained in:
Ryan Brown 2018-08-22 21:33:27 -04:00 committed by GitHub
parent fdcb883ac0
commit 4c8808ec9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 675 additions and 13 deletions

View file

@ -559,6 +559,11 @@ class TaskExecutor:
tmp_args = module_defaults[self._task.action].copy()
tmp_args.update(self._task.args)
self._task.args = tmp_args
if self._task.action in C.config.module_defaults_groups:
for group in C.config.module_defaults_groups.get(self._task.action, []):
tmp_args = (module_defaults.get('group/{0}'.format(group)) or {}).copy()
tmp_args.update(self._task.args)
self._task.args = tmp_args
# And filter out any fields which were set to default(omit), and got the omit token value
omit_token = variables.get('omit')