ipr-cnrs.glpi_agent
glpi-agent
==========
- Overview
- Examples
- Default variables
- Debian dedicated variables
- Development
- License
- Author Information
Overview
This role will help install and manage glpi-agent on Linux systems (initially only for Debian-based systems).
It is inspired by a previous role for fusioninventory-agent.
Examples
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
- The glpi-agent package is not available in the official repositories yet.
Install glpi-agent prebuilt package from the 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 handle dependencies and use the prebuilt glpi-agent package from the GLPI Agent Github repository.- You can find all versions and official prebuilt packages on the GLPI Agent Github repository.
Default variables
Packages and installation
glpi_agent__enabled
Boolean. Enable or disable the installation and configuration of glpi-agent.
glpi_agent__enabled: true
glpi_agent__install_from_url
Boolean. Should the GLPI Agent package be installed from the GLPI project-built source?
glpi_agent__install_from_url: false
glpi_agent__version
String. The version of GLPI Agent to install.
glpi_agent__version: '1.5-1'
glpi_agent__major_version
String. Extract the major version to build the glpi_agent__package_url
variable.
- For example, for version (1.5-1), this will become 1.5.
glpi_agent__major_version: '{{ glpi_agent__version.split("-")[0] }}'
glpi_agent__package_name
List. The name of the GLPI Agent package to install.
glpi_agent__package_name:
- glpi-agent
Debian glpi_agent__package_url
The URL used to download the .deb package for GLPI Agent. For example, 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 "" }}'
glpi_agent__depends
Boolean. Should GLPI Agent dependencies be installed? Required for installation from URL since some might be missing… Refer to the dependencies list in OS vars files (Debian) below.
glpi_agent__depends: '{{ True if ansible_os_family in ["Debian"]
else False }}'
glpi_agent__recommends
Boolean. Should the recommended GLPI Agent packages be installed? Refer to the recommendations list in OS vars files (Debian) below.
glpi_agent__recommends: false
glpi_agent__suggests
Boolean. Should the suggested GLPI Agent packages be installed? Refer to the suggestions list in OS vars files (Debian) below.
glpi_agent__suggests: false
Fusioninventory Agent
The official documentation recommends removing the fusioninventory agent before installing GLPI Agent. Packages and configuration files related to it will not be removed by this role.
glpi_agent__fusioninventory_agent_state
State of the previous Fusioninventory agent.
glpi_agent__fusioninventory_agent_state: 'absent'
glpi_agent__fusioninventory_agent_packages
List of Fusioninventory agent packages to remove.
glpi_agent__fusioninventory_agent_packages:
- fusioninventory-agent
Configuration
Refer to the official documentation for syntax of all parameters.
glpi_agent__conf_file_dest
String. Path to the GLPI Agent configuration file on the host.
glpi_agent__conf_file_dest: '/etc/glpi-agent/conf.d/00-ansible.cfg'
glpi_agent__conf_file_src
String. Template used to create the GLPI Agent configuration file.
glpi_agent__conf_file_src: '{{ "../templates" + glpi_agent__conf_file_dest + ".j2" }}'
glpi_agent__conf_raw
String. Template used for raw GLPI Agent configuration input.
glpi_agent__conf_raw: ''
Example usage:
glpi_agent__conf_raw: |
tag = my_new_tag
Service
glpi_agent__service_state
String. The desired state of the service.
glpi_agent__service_state: '{{ "started" if (glpi_agent__enabled | bool)
else "stopped" }}'
glpi_agent__service_enabled
String. Whether the service should be enabled.
glpi_agent__service_enabled: '{{ glpi_agent__enabled | bool }}'
Cron configuration
Instead of using a systemd service, glpi-agent
can also be run as a cron job.
List of cron-related variables (click to expand)
glpi_agent__cron
String. Should the cron job be installed? Possible values: "absent" or "present".
glpi_agent__cron: 'absent'
glpi_agent__cron_day
Days on which the agent should run.
glpi_agent__cron_day: '*'
glpi_agent__cron_hour
Hours at which the agent should run.
glpi_agent__cron_hour: '23'
glpi_agent__cron_minute
Minutes at which the agent should run.
glpi_agent__cron_minute: '0'
glpi_agent__cron_month
Months when the agent should run.
glpi_agent__cron_month: '*'
glpi_agent__cron_weekday
Weekdays on which the agent should run.
glpi_agent__cron_weekday: '*'
glpi_agent__cron_user
User under which the agent should run.
glpi_agent__cron_user: 'root'
glpi_agent__cron_command
The command that cron should execute.
glpi_agent__cron_command: 'sleep $(( RANDOM \\% 3600 )); /bin/glpi-agent'
Debian dedicated variables
These variables cannot be changed by the user.
Packages and installation for Debian
Debian glpi_agent__depends_packages
List. Dependencies for the GLPI Agent package.
- Based on
dpkg --info
output for .deb package version 1.5-1. - To skip the installation of these packages, refer to 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
Debian glpi_agent__recommends_packages
List. Recommendations for the GLPI Agent package.
- Based on
dpkg --info
output for .deb package version 1.5-1. - To skip the installation of these packages, refer to glpi_agent__recommends above.
glpi_agent__recommends_packages:
- libio-socket-ssl-perl
- dmidecode
- hdparm
- fdisk
- net-tools
Debian glpi_agent__suggests_packages
List. Suggestions for the GLPI Agent package.
- Based on
dpkg --info
output for .deb package version 1.5-1. - To skip the installation of these packages, refer to glpi_agent__suggests above.
glpi_agent__suggests_packages:
- smartmontools
- read-edid
Development
We welcome all pull requests!
For defaults/main.yml
and vars files:
- Follow the syntax described in the header. You can copy and paste existing blocks.
- For new variables, start them with glpi_agent__ to manage them easily in Ansible's host_vars.
Feel free to share good practices (for Debian/CentOS) and any requests (and pull requests).
License
Author Information
Jérémy Gardais
- IPR (Institut de Physique de Rennes)
- CNRS and University of Rennes
ansible-galaxy install ipr-cnrs.glpi_agent