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:
Stephen Fromm 2012-11-09 22:13:00 -08:00
parent 40e49b6a5a
commit 06e54c0b97
4 changed files with 9 additions and 1 deletions

View file

@ -539,7 +539,7 @@ class AnsibleModule(object):
journal.sendv(*journal_args)
else:
msg = ''
syslog.openlog('ansible-%s' % os.path.basename(__file__))
syslog.openlog('ansible-%s' % os.path.basename(__file__), 0, syslog.LOG_USER)
for arg in log_args:
msg = msg + arg + '=' + str(log_args[arg]) + ' '
if msg: