From 31ba7bd70a6ce29fc37c7b49c3aead740db3cf4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Mon, 17 Sep 2018 11:28:16 +0200 Subject: [PATCH] Add several configuration variables for agent --- defaults/main.yml | 115 +++++++++++++++++++++ templates/etc/fusioninventory/agent.cfg.j2 | 42 +++++++- 2 files changed, 153 insertions(+), 4 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 4854098..3e6c38a 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -88,5 +88,120 @@ fusioninventory__agent_service_manage: True # fusioninventory__agent_conf_src: '../templates/etc/fusioninventory/agent.cfg.j2' + # ]]] +# .. envvar:: fusioninventory__agent_conf_server_url [[[ +# +# The URL of your Fusioninventory-server/GLPI/… +# +fusioninventory__agent_conf_server_url: '' + + # ]]] +# .. envvar:: fusioninventory__agent_conf_local_dir [[[ +# +# Write tasks results in a directory +# +fusioninventory__agent_conf_local_dir: '' + + # ]]] +# .. envvar:: fusioninventory__agent_conf_delaytime [[[ +# +# Set an initial delay before the first target. +# +fusioninventory__agent_conf_delaytime: '3600' + + # ]]] +# .. envvar:: fusioninventory__agent_conf_no_category [[[ +# +# Do not list given category items in inventory task. +# Should be a string with comma as a separator between categories. +# +fusioninventory__agent_conf_no_category: '' + + # ]]] +# .. envvar:: fusioninventory__agent_conf_scan_homedirs [[[ +# +# Enable the scan of user home directories. Possible options : +# +# ``False`` +# Default. +# +# ``True`` +# The agent will scan homedirs. +# +fusioninventory__agent_conf_scan_homedirs: False + + # ]]] +# .. envvar:: fusioninventory__agent_conf_scan_profiles [[[ +# +# Enable the scan of users list. Possible options : +# +# ``False`` +# Default. +# +# ``True`` +# The agent will scan user profile. +# +fusioninventory__agent_conf_scan_profiles: False + + # ]]] +# .. envvar:: fusioninventory__agent_conf_no_ssl_check [[[ +# +# Disable check of the server SSL certificate. Possible options : +# +# ``False`` +# Default. The server's SSL certificate must be valid. +# +# ``True`` +# The server's SSL certificate will not be checked. +# +fusioninventory__agent_conf_no_ssl_check: False + + # ]]] +# .. envvar:: fusioninventory__agent_conf_no_httpd [[[ +# +# Disable embedded web server. Possible options : +# +# ``True`` +# Default. +# +# ``False`` +# The webserver will listen on the httpd-port (default to 62354). +# +fusioninventory__agent_conf_no_httpd: True + + # ]]] +# .. envvar:: fusioninventory__agent_conf_httpd_ip: [[[ +# +# Interface/IP, the webserver server should listen to : +# +# ``''`` +# Default. Empty so listen on all interfaces. +# +fusioninventory__agent_conf_httpd_ip: '' + + # ]]] +# .. envvar:: fusioninventory__agent_conf_httpd_port: [[[ +# +# TCP port used by the webserver server to listen : +# +# ``62354`` +# Default. +# +fusioninventory__agent_conf_httpd_port: '62354' + + # ]]] +# .. envvar:: fusioninventory__agent_conf_debug [[[ +# +# If debug mode should be enabled. Possible options : +# +# ``False`` +# Default. +# +# ``True`` +# Debug mode is enable and fusioninventory-agent will send informations +# to journalctl/syslog/… +# +fusioninventory__agent_conf_debug: False + # ]]] # ]]] diff --git a/templates/etc/fusioninventory/agent.cfg.j2 b/templates/etc/fusioninventory/agent.cfg.j2 index 7ebfa1c..4f49ead 100644 --- a/templates/etc/fusioninventory/agent.cfg.j2 +++ b/templates/etc/fusioninventory/agent.cfg.j2 @@ -14,8 +14,14 @@ #server = http://server.domain.com/ocsinventory # send tasks results to a FusionInventory for GLPI server #server = http://server.domain.com/glpi/plugins/fusioninventory/ +{% if fusioninventory__agent_conf_server_url %} +server = {{ fusioninventory__agent_conf_server_url }} +{% endif %} # write tasks results in a directory #local = /tmp +{% if fusioninventory__agent_conf_local_dir %} +local = {{ fusioninventory__agent_conf_local_dir }} +{% endif %} # # Task definition options @@ -30,7 +36,7 @@ # # maximum delay before first target, in seconds -delaytime = 3600 +delaytime = {{ fusioninventory__agent_conf_delaytime }} # do not contact the target before next scheduled time lazy = 0 @@ -40,10 +46,23 @@ lazy = 0 # do not list local printers # no-category = printer +{% if fusioninventory__agent_conf_no_category %} +no-category = {{ fusioninventory__agent_conf_no_category }} +{% endif %} +{% if fusioninventory__agent_conf_scan_homedirs %} # allow to scan user home directories +scan-homedirs = 1 +{% else %} +# disable scan of user home directories scan-homedirs = 0 +{% endif %} +{% if fusioninventory__agent_conf_scan_profiles %} # allow to scan user profiles +scan-profiles = 1 +{% else %} +# disable the scan of user profiles scan-profiles = 0 +{% endif %} # save the inventory as HTML html = 0 # timeout for inventory modules execution @@ -74,8 +93,13 @@ password = ca-cert-dir = # CA certificates file ca-cert-file = +{% if fusioninventory__agent_conf_no_ssl_check %} # do not check server SSL certificate +no-ssl-check = 1 +{% else %} +# check server SSL certificate no-ssl-check = 0 +{% endif %} # connection timeout, in seconds timeout = 180 @@ -83,12 +107,17 @@ timeout = 180 # Web interface options # +{% if fusioninventory__agent_conf_no_httpd %} # disable embedded web server +no-httpd = 1 +{% else %} +# enable embedded web server no-httpd = 0 +{% endif %} # network interface to listen to -httpd-ip = +httpd-ip = {{ fusioninventory__agent_conf_httpd_ip }} # network port to listen to -httpd-port = 62354 +httpd-port = {{ fusioninventory__agent_conf_httpd_port }} # trust requests without authentication token httpd-trust = @@ -113,8 +142,13 @@ color = 0 # add given tag to inventory results tag = -# debug mode +{% if fusioninventory__agent_conf_debug %} +# enable debug mode +debug = 1 +{% else %} +# disable debug mode debug = 0 +{% endif %} # time to wait to reload config (0 means no reload, it's default value) # conf-reload-interval = 0