mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-05-09 10:41:31 -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
|
@ -19,6 +19,7 @@ __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
|
||||
|
||||
|
||||
|
@ -71,6 +72,9 @@ class ActionModule(ActionBase):
|
|||
del new_module_args[unused]
|
||||
self._display.warning('Ignoring "%s" as it is not used in "%s"' % (unused, module))
|
||||
|
||||
# get defaults for specific module
|
||||
new_module_args = get_action_args_with_defaults(module, new_module_args, self._task.module_defaults, self._templar)
|
||||
|
||||
self._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