mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Add ability to specify syslog facility for modules
Update constants.py so that one can specify environmental variable ANSIBLE_SYSLOG_FACILITY or syslog_facility in ansible.cfg to define the syslog facility to use. Alternatively, you can specify ansible_syslog_facility in inventory. Runner now replaces the syslog facility in the openlog() call with the default or the injected variables ansible_syslog_facility. This also updates hacking/test-module to behave similarly.
This commit is contained in:
@@ -35,6 +35,7 @@ import traceback
|
||||
import optparse
|
||||
import ansible.utils as utils
|
||||
import ansible.module_common as module_common
|
||||
import ansible.constants as C
|
||||
|
||||
try:
|
||||
import json
|
||||
@@ -83,6 +84,7 @@ def boilerplate_module(modfile, args):
|
||||
module_data = module_data.replace(module_common.REPLACER, module_common.MODULE_COMMON)
|
||||
encoded_args = "\"\"\"%s\"\"\"" % args.replace("\"","\\\"")
|
||||
module_data = module_data.replace(module_common.REPLACER_ARGS, encoded_args)
|
||||
module_data = module_data.replace('syslog.LOG_USER', "syslog.%s" % C.DEFAULT_SYSLOG_FACILITY)
|
||||
|
||||
modfile2_path = os.path.expanduser("~/.ansible_module_generated")
|
||||
print "* including generated source, if any, saving to: %s" % modfile2_path
|
||||
|
||||
Reference in New Issue
Block a user