Merge pull request #13751 from bcoca/module_internal_options
pass diff and verbosity settings to modules
This commit is contained in:
commit
cf9dfde15b
1 changed files with 11 additions and 5 deletions
|
@ -371,18 +371,24 @@ class ActionBase(with_metaclass(ABCMeta, object)):
|
||||||
module_args = self._task.args
|
module_args = self._task.args
|
||||||
|
|
||||||
# set check mode in the module arguments, if required
|
# set check mode in the module arguments, if required
|
||||||
if self._play_context.check_mode and not self._task.always_run:
|
if self._play_context.check_mode:
|
||||||
if not self._supports_check_mode:
|
if not self._supports_check_mode:
|
||||||
raise AnsibleError("check mode is not supported for this operation")
|
raise AnsibleError("check mode is not supported for this operation")
|
||||||
module_args['_ansible_check_mode'] = True
|
module_args['_ansible_check_mode'] = True
|
||||||
|
else:
|
||||||
|
module_args['_ansible_check_mode'] = False
|
||||||
|
|
||||||
# set no log in the module arguments, if required
|
# set no log in the module arguments, if required
|
||||||
if self._play_context.no_log or C.DEFAULT_NO_TARGET_SYSLOG:
|
module_args['_ansible_no_log'] = self._play_context.no_log or C.DEFAULT_NO_TARGET_SYSLOG
|
||||||
module_args['_ansible_no_log'] = True
|
|
||||||
|
|
||||||
# set debug in the module arguments, if required
|
# set debug in the module arguments, if required
|
||||||
if C.DEFAULT_DEBUG:
|
module_args['_ansible_debug'] = C.DEFAULT_DEBUG
|
||||||
module_args['_ansible_debug'] = True
|
|
||||||
|
# let module know we are in diff mode
|
||||||
|
module_args['_ansible_diff'] = self._play_context.diff
|
||||||
|
|
||||||
|
# let module know our verbosity
|
||||||
|
module_args['_ansible_verbosity'] = self._display.verbosity
|
||||||
|
|
||||||
(module_style, shebang, module_data) = self._configure_module(module_name=module_name, module_args=module_args, task_vars=task_vars)
|
(module_style, shebang, module_data) = self._configure_module(module_name=module_name, module_args=module_args, task_vars=task_vars)
|
||||||
if not shebang:
|
if not shebang:
|
||||||
|
|
Loading…
Reference in a new issue