2
0
Fork 0

Generate agent's configuration file

This commit is contained in:
Jeremy Gardais 2018-09-10 14:02:41 +02:00
parent ca61e84088
commit d542926e9a
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
5 changed files with 164 additions and 1 deletions

View File

@ -4,3 +4,4 @@
### Features ### Features
* Install dependent packages for fusioninventory-agent. * Install dependent packages for fusioninventory-agent.
* Install fusioninventory-agent package from URL. * Install fusioninventory-agent package from URL.
* Generate agent's configuration file.

View File

@ -20,6 +20,7 @@ A role to manage FusionInventory agent installation and configuration.
* **fusioninventory__agent_deploy_state**: What is the desired state which this role should achieve [default: `present`]. * **fusioninventory__agent_deploy_state**: What is the desired state which this role should achieve [default: `present`].
* **fusioninventory__agent_service_name**: The service name to manage [default: `fusioninventory-agent`]. * **fusioninventory__agent_service_name**: The service name to manage [default: `fusioninventory-agent`].
* **fusioninventory__agent_service_manage**: If the fusioninventory agent service should be managed [default: `True`]. * **fusioninventory__agent_service_manage**: If the fusioninventory agent service should be managed [default: `True`].
* **fusioninventory__agent_conf_src**: Template used to provide agent configuration file [default: `../templates/etc/fusioninventory/agent.cfg.j2`].
## Example Playbook ## Example Playbook
@ -47,6 +48,7 @@ A role to manage FusionInventory agent installation and configuration.
This role will: This role will:
* Install needed dependent packages of fusioninventory-agent. * Install needed dependent packages of fusioninventory-agent.
* Install fusioninventory-agent package from official project package/URL. * Install fusioninventory-agent package from official project package/URL.
* Generate agent's configuration file.
## Development ## Development

View File

@ -51,7 +51,7 @@ fusioninventory__agent_package_url: 'http://debian.fusioninventory.org/downloads
# Default. Ensure that fusioninventory agent is installed and configured as requested. # Default. Ensure that fusioninventory agent is installed and configured as requested.
# #
# ``absent`` # ``absent``
# Ensure that fusioninventory agent is uninstalled and it's configuration is removed. # Ensure that fusioninventory agent is uninstalled.
# #
fusioninventory__agent_deploy_state: 'present' fusioninventory__agent_deploy_state: 'present'
# ]]] # ]]]
@ -76,3 +76,17 @@ fusioninventory__agent_service_manage: True
# ]]] # ]]]
# ]]] # ]]]
# Configuration [[[
# -----------------------------
# .. envvar:: fusioninventory__agent_conf_src [[[
#
# Template used to provide agent configuration file.
#
# Must be a relative path from default/ directory of this role or to your
# ansible inventory directory.
#
fusioninventory__agent_conf_src: '../templates/etc/fusioninventory/agent.cfg.j2'
# ]]]
# ]]]

View File

@ -24,3 +24,12 @@
state: '{{ "present" if (fusioninventory__agent_deploy_state == "present") else "absent" }}' state: '{{ "present" if (fusioninventory__agent_deploy_state == "present") else "absent" }}'
when: fusioninventory__agent_package_url == "" when: fusioninventory__agent_package_url == ""
# Manage agent configuration file [[[1
- name: Create Fusioninventory-agent configuration
template:
src: '{{ fusioninventory__agent_conf_src }}'
dest: "/etc/fusioninventory/agent.cfg"
owner: root
group: root
mode: '0644'
when: fusioninventory__agent_deploy_state == "present"

View File

@ -0,0 +1,137 @@
# {{ ansible_managed }}
# fusioninventory agent configuration
# all defined values match default
# all commented values are examples
#
# Target definition options
#
# send tasks results to an OCS server
#server = http://server.domain.com/ocsinventory
# send tasks results to a FusionInventory for GLPI server
#server = http://server.domain.com/glpi/plugins/fusioninventory/
# write tasks results in a directory
#local = /tmp
#
# Task definition options
#
# disable software deployment tasks
#no-task = deploy
#tasks = inventory,deploy,inventory
#
# Target scheduling options
#
# maximum delay before first target, in seconds
delaytime = 3600
# do not contact the target before next scheduled time
lazy = 0
#
# Inventory task specific options
#
# do not list local printers
# no-category = printer
# allow to scan user home directories
scan-homedirs = 0
# allow to scan user profiles
scan-profiles = 0
# save the inventory as HTML
html = 0
# timeout for inventory modules execution
backend-collect-timeout = 180
# always send data to server
force = 0
# additional inventory content file
additional-content =
#
# Package deployment task specific options
#
# do not use peer to peer to download files
no-p2p = 0
#
# Network options
#
# proxy address
proxy =
# user name for server authentication
user =
# password for server authentication
password =
# CA certificates directory
ca-cert-dir =
# CA certificates file
ca-cert-file =
# do not check server SSL certificate
no-ssl-check = 0
# connection timeout, in seconds
timeout = 180
#
# Web interface options
#
# disable embedded web server
no-httpd = 0
# network interface to listen to
httpd-ip =
# network port to listen to
httpd-port = 62354
# trust requests without authentication token
httpd-trust =
#
# Logging options
#
# Logger backend, either Stderr, File or Syslog (Stderr)
logger = syslog
# log file
#logfile = /var/log/fusioninventory.log
# maximum log file size, in MB
#logfile-maxsize = 0
# Syslog facility
logfacility = LOG_DAEMON
# Use color in the console
color = 0
#
# Execution mode options
#
# add given tag to inventory results
tag =
# debug mode
debug = 0
# time to wait to reload config (0 means no reload, it's default value)
# conf-reload-interval = 0
# Since 2.4, you can include all .cfg files from a folder or any given file
# For example:
# 1. file "conf.d/tag.cfg" contains "tag = 'entity123'"
# using "include 'conf.d' will set tag to 'entity123'
# 2. file "/etc/production/glpi-tag" contains "tag = 'entity123'"
# using "include '/etc/production/glpi-tag' will set tag to 'entity123'
# Remark:
# 1. Prefer to use full path to avoid confusion, but be aware relative paths are
# relative against current config file folder
# 2. A parameter set in included file can be over-rided if set again after the directive
# 3. *.cfg files are read in order in folder, it's better to prefix them with a number
# 4. Package maintainers are encouraged to use this feature to avoid conflict
# during upgrades after configuration update
#
include "conf.d/"
#include "agent.local"