From 74fbd8e653bdb2f19a4e7cfb7d0dbae68cbcb5d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Fri, 27 Aug 2021 13:42:43 +0200 Subject: [PATCH] Manage logfacility with fusioninventory__agent_conf_log_facility var --- CHANGELOG.md | 1 + README.md | 1 + defaults/main.yml | 16 ++++++++++++++++ templates/etc/fusioninventory/agent.cfg.j2 | 4 +++- 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bbdea73..fbcd7fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ * **no-task** with fusioninventory__agent_conf_no_task variable * **tasks** with fusioninventory__agent_conf_tasks variable * **logger** with fusioninventory__agent_conf_log_logger variable + * **logfacility** with fusioninventory__agent_conf_log_facility variable ## v1.3.1 diff --git a/README.md b/README.md index 58702a5..2a591f4 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,7 @@ Some variables used to generate FusionInventery agent.cfg file from Ansible temp * **fusioninventory__agent_conf_httpd_port** : TCP port used by the webserver server to listen [default⎵: `62354`]. * **fusioninventory__agent_conf_httpd_trust** : hostname or IP or subnet authorized for http request [default⎵: ``]. * **fusioninventory__agent_conf_log_logger** : Specifies the logger backend to use [default⎵: `syslog`]. +* **fusioninventory__agent_conf_log_facility** : Specifies the syslog facility to use for the syslog logger backend [default⎵: `LOG_DAEMON`]. * **fusioninventory__agent_conf_tag** : Add given tag to inventory results [default⎵: ``]. * **fusioninventory__agent_conf_debug** : If debug mode should be enabled [default⎵: `False`]. diff --git a/defaults/main.yml b/defaults/main.yml index 4314eae..fb614d5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -222,6 +222,22 @@ fusioninventory__agent_conf_httpd_trust: '' # fusioninventory__agent_conf_log_logger: 'syslog' # ]]] +# .. envvar:: fusioninventory__agent_conf_log_facility: [[[ +# +# Specifies the syslog facility to use for the syslog logger backend. +# The possible values are: +# +# ``LOG_DAEMON`` +# Default. System daemons without separate facility value. +# +# ``LOG_USER`` +# Generic user-level messages +# +# ``…`` +# For all possible values, check syslog(3) manual. +# +fusioninventory__agent_conf_log_facility: 'LOG_DAEMON' + # ]]] # .. envvar:: fusioninventory__agent_conf_tag [[[ # # Add given tag to inventory results diff --git a/templates/etc/fusioninventory/agent.cfg.j2 b/templates/etc/fusioninventory/agent.cfg.j2 index 4177bac..5a9950e 100644 --- a/templates/etc/fusioninventory/agent.cfg.j2 +++ b/templates/etc/fusioninventory/agent.cfg.j2 @@ -137,8 +137,10 @@ logger = {{ fusioninventory__agent_conf_log_logger }} #logfile = /var/log/fusioninventory.log # maximum log file size, in MB #logfile-maxsize = 0 +{% if fusioninventory__agent_conf_log_logger == 'syslog' %} # Syslog facility -logfacility = LOG_DAEMON +logfacility = {{ fusioninventory__agent_conf_log_facility }} +{% endif %} # Use color in the console color = 0