mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-10 11:11:29 -07:00
fix module defaults (#56020)
* fix module defaults - corrected precedence (specific module > group) - made into reusable function - use from gather_facts/service/package to match 'actual module used'
This commit is contained in:
parent
8968d41599
commit
674a57c3fa
6 changed files with 45 additions and 15 deletions
|
@ -18,6 +18,7 @@ from __future__ import (absolute_import, division, print_function)
|
|||
__metaclass__ = type
|
||||
|
||||
from ansible.errors import AnsibleAction, AnsibleActionFail
|
||||
from ansible.executor.module_common import get_action_args_with_defaults
|
||||
from ansible.plugins.action import ActionBase
|
||||
from ansible.utils.display import Display
|
||||
|
||||
|
@ -64,6 +65,9 @@ class ActionModule(ActionBase):
|
|||
if 'use' in new_module_args:
|
||||
del new_module_args['use']
|
||||
|
||||
# get defaults for specific module
|
||||
new_module_args = get_action_args_with_defaults(module, new_module_args, self._task.module_defaults, self._templar)
|
||||
|
||||
display.vvvv("Running %s" % module)
|
||||
result.update(self._execute_module(module_name=module, module_args=new_module_args, task_vars=task_vars, wrap_async=self._task.async_val))
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue