- Overview
- Examples
- Default variables
- Debian dedicated variables
- Development
- License
- Author Information
This role will try to install and manage glpi-agent on Linux systems (Debian family only at the beginning).
It's heavily inspired from the previous role dedicated to fusioninventory-agent.
Install glpi-agent from your own APT/Yum/… repository (click to expand)
- hosts: serverXYZ
vars:
glpi_agent__conf_raw: |
# glpi-agent requires a server to start the service
server = http://server.domain.com/front/inventory.php
roles:
- role: ipr-cnrs.glpi_agent
- glpi-agent package is not (yet) available in officials repositories (Debian, Ubuntu,…).
Install glpi-agent prebuild package from GLPI Agent Github project (click to expand)
- hosts: serverXYZ
vars:
glpi_agent__install_from_url: true
glpi_agent__conf_raw: |
# glpi-agent requires a server to start the service
server = http://server.domain.com/front/inventory.php
roles:
- role: ipr-cnrs.glpi_agent
glpi_agent__install_from_url
will first install dependencies and use prebuild glpi-agent package from GLPI Agent Github repository.- All versions and officials prebuild packages can be found on GLPI Agent Github repository.
Boolean. Enable or disable glpi-agent's installation and configuration.
glpi_agent__enabled: true
Boolean. If GLPI Agent package should be installed from package build by GLIP project.
glpi_agent__install_from_url: false
String. GLPI Agent version to install.
glpi_agent__version: '1.5-1'
String. Extract the major version in order to build glpi_agent__package_url variable.
- eg. for the last version (1.5-1), it will become 1.5.
glpi_agent__major_version: '{{ glpi_agent__version.split("-")[0] }}'
List. GLPI Agent package name to install.
glpi_agent__package_name:
- glpi-agent
The URL used to download .deb package for GLPI Agent. eg for version 1.5 : https://github.com/glpi-project/glpi-agent/releases/download/1.5/glpi-agent_1.5-1_all.deb
glpi_agent__package_url: '{{ "https://github.com/glpi-project/glpi-agent/releases/download/"
+ glpi_agent__major_version
+ "/glpi-agent_"
+ glpi_agent__version
+ "_all.deb" if (ansible_os_family in ["Debian"])
else "" }}'
Boolean. If GLPI Agent dependencies should be installed. Required for installation from URL and because some might be missing from dependencies list… See the dependencies list in OS vars files (Debian) below.
glpi_agent__depends: '{{ True if ansible_os_family in ["Debian"]
else False }}'
Boolean. If GLPI Agent packages recommandations should be installed. See the recommandations list in OS vars files (Debian) below.
glpi_agent__recommends: false
Boolean. If GLPI Agent packages suggestions should be installed. See the suggestions list in OS vars files (Debian) below.
glpi_agent__suggests: false
The official documentation recommends to uninstall fusioninventory agent before installing GLPI Agent. Packages and related configuration files won't be purge by this role.
State of previous Fusioninventory agent.
glpi_agent__fusioninventory_agent_state: 'absent'
List of Fusioninventory agent packages to remove.
glpi_agent__fusioninventory_agent_packages:
- fusioninventory-agent
See official documentation for all parameters syntax.
String. Path to GLPI Agent configuration file on the host.
glpi_agent__conf_file_dest: '/etc/glpi-agent/conf.d/00-ansible.cfg'
String. Template used to provide GLPI Agent configuration file.
glpi_agent__conf_file_src: '{{ "../templates" + glpi_agent__conf_file_dest + ".j2" }}'
String. Template used to provide GLPI Agent configuration file.
glpi_agent__conf_raw: ''
Usage exemple:
glpi_agent__conf_raw: |
tag = my_new_tag
String. The targeted service status
glpi_agent__service_state: '{{ "started" if (glpi_agent__enabled | bool)
else "stopped" }}'
String. The targeted service status
glpi_agent__service_enabled: '{{ glpi_agent__enabled | bool }}'
Instead of running a systemd service, glpi-agent
can be ran by a cronjob.
List of cron's related variables (click to expand).
String. If cronjob should be installed. Can be "absent" or "present".
glpi_agent__cron: 'absent'
Which days should the agent be ran.
glpi_agent__cron_day: '*'
Which hours should the agent be ran.
glpi_agent__cron_hour: '23'
Which minutes should the agent be ran.
glpi_agent__cron_minute: '0'
Which months should the agent be ran.
glpi_agent__cron_month: '*'
Which weekdays should the agent be ran.
glpi_agent__cron_weekday: '*'
Which user should the agent be ran under.
glpi_agent__cron_user: 'root'
The command should cron run.
glpi_agent__cron_command: 'sleep $(( RANDOM \\% 3600 )); /bin/glpi-agent'
These variables can't be overrided by the user.
List. Dependencies for GLPI Agent package.
- Based on
dpkg --info
output for .deb package version 1.5-1. - To skip the installation of these packages, see glpi_agent__depends above.
glpi_agent__depends_packages:
- perl
- ucf
- lsb-base
- libnet-cups-perl
- libnet-ip-perl
- libnet-ssh2-perl
- libwww-perl
- libparse-edid-perl
- libproc-daemon-perl
- libparallel-forkmanager-perl
- libuniversal-require-perl
- libfile-which-perl
- libxml-libxml-perl
- libyaml-perl
- libtext-template-perl
- libcpanel-json-xs-perl
- libjson-pp-perl
- pciutils
- usbutils
- libhttp-daemon-perl
- libyaml-tiny-perl
- libossp-uuid-perl
- libdatetime-perl
- libsocket-getaddrinfo-perl
## Missing from `dpkg --info` but used in glpi-agent workflow
- libxml-treepp-perl
- libxml-xpath-perl
List. Recommandations for GLPI Agent package.
- Based on
dpkg --info
output for .deb package version 1.5-1. - To skip the installation of these packages, see glpi_agent__recommends above.
glpi_agent__recommends_packages:
- libio-socket-ssl-perl
- dmidecode
- hdparm
- fdisk
- net-tools
List. Suggestions for GLPI Agent package.
- Based on
dpkg --info
output for .deb package version 1.5-1. - To skip the installation of these packages, see glpi_agent__suggests above.
glpi_agent__suggests_packages:
- smartmontools
- read-edid
All PRs are welcome :)
For defaults/main.yml
and vars files :
- Try to apply the syntax describe in the header. Copy/paste an existing block should do the work 👍.
- For a new variable, prefixing it with glpi_agent__ allows to easily manage it in Ansible's host_vars,…
Feel free to share any good practices (for Debian/CentOS) and requests (and PRs 😀).
Jérémy Gardais
- IPR (Institut de Physique de Rennes)
- CNRS and University of Rennes