task logging revamp

* allow global no_log setting, no need to set at play or task level, but can be overriden by them
 * allow turning off syslog only on task execution from target host (manage_syslog), overlaps with no_log functionality
 * created log function for task modules to use, now we can remove all syslog references, will use systemd journal if present
 * added debug flag to modules, so they can make it call new log function conditionally
 * added debug logging in module's run_command
This commit is contained in:
Brian Coca 2015-09-25 23:57:03 -04:00
parent b757798f3e
commit 37a918438b
6 changed files with 79 additions and 45 deletions

View file

@ -351,9 +351,13 @@ class ActionBase:
module_args['_ansible_check_mode'] = True
# set no log in the module arguments, if required
if self._play_context.no_log:
if self._play_context.no_log or not C.DEFAULT_MANAGED_SYSLOG:
module_args['_ansible_no_log'] = True
# set debug in the module arguments, if required
if C.DEFAULT_DEBUG:
module_args['_ansible_debug'] = True
(module_style, shebang, module_data) = self._configure_module(module_name=module_name, module_args=module_args, task_vars=task_vars)
if not shebang:
raise AnsibleError("module is missing interpreter line")