From de6b047fc3e6a9d23921574de55813fa25657d4b Mon Sep 17 00:00:00 2001 From: Jordan Borean Date: Thu, 16 Apr 2020 20:25:09 +1000 Subject: [PATCH] Add variable for DEFAULT_NO_TARGET_SYSLOG (#68971) * Add variable for DEFAULT_NO_TARGET_SYSLOG * Added version_added to new var --- changelogs/fragments/no_target_syslog-var.yaml | 2 ++ lib/ansible/config/base.yml | 7 ++++++- lib/ansible/plugins/action/__init__.py | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/no_target_syslog-var.yaml diff --git a/changelogs/fragments/no_target_syslog-var.yaml b/changelogs/fragments/no_target_syslog-var.yaml new file mode 100644 index 00000000000..9929a690bd9 --- /dev/null +++ b/changelogs/fragments/no_target_syslog-var.yaml @@ -0,0 +1,2 @@ +minor_changes: +- Added the ability to set ``DEFAULT_NO_TARGET_SYSLOG`` through the ``ansible_no_target_syslog`` variable on a task diff --git a/lib/ansible/config/base.yml b/lib/ansible/config/base.yml index 981c003b597..dfb5fd136db 100644 --- a/lib/ansible/config/base.yml +++ b/lib/ansible/config/base.yml @@ -897,10 +897,15 @@ DEFAULT_NO_LOG: DEFAULT_NO_TARGET_SYSLOG: name: No syslog on target default: False - description: Toggle Ansible logging to syslog on the target when it executes tasks. + description: + - Toggle Ansible logging to syslog on the target when it executes tasks. On Windows hosts this will disable a newer + style PowerShell modules from writting to the event log. env: [{name: ANSIBLE_NO_TARGET_SYSLOG}] ini: - {key: no_target_syslog, section: defaults} + vars: + - name: ansible_no_target_syslog + version_added: '2.10' type: boolean yaml: {key: defaults.no_target_syslog} DEFAULT_NULL_REPRESENTATION: diff --git a/lib/ansible/plugins/action/__init__.py b/lib/ansible/plugins/action/__init__.py index 967c5b027cb..89b80fb78b1 100644 --- a/lib/ansible/plugins/action/__init__.py +++ b/lib/ansible/plugins/action/__init__.py @@ -714,7 +714,8 @@ class ActionBase(with_metaclass(ABCMeta, object)): module_args['_ansible_check_mode'] = False # set no log in the module arguments, if required - module_args['_ansible_no_log'] = self._play_context.no_log or C.DEFAULT_NO_TARGET_SYSLOG + no_target_syslog = C.config.get_config_value('DEFAULT_NO_TARGET_SYSLOG', variables=task_vars) + module_args['_ansible_no_log'] = self._play_context.no_log or no_target_syslog # set debug in the module arguments, if required module_args['_ansible_debug'] = C.DEFAULT_DEBUG