glpi_agent

glpi-agent

  1. Overview
  2. Examples
  3. Default variables
  4. Debian dedicated variables
  5. Development
  6. License
  7. Author Information

Overview

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.

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
  • 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.

Default variables

Packages and installation

glpi_agent__enabled

Boolean. Enable or disable glpi-agent's installation and configuration.

glpi_agent__enabled: true

glpi_agent__install_from_url

Boolean. If GLPI Agent package should be installed from package build by GLIP project.

glpi_agent__install_from_url: false

glpi_agent__version

String. GLPI Agent version to install.

glpi_agent__version: '1.5-1'

glpi_agent__major_version

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] }}'

glpi_agent__package_name

List. GLPI Agent package name to install.

glpi_agent__package_name:
  - glpi-agent

Debian glpi_agent__package_url

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 "" }}'

glpi_agent__depends

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 }}'

glpi_agent__recommends

Boolean. If GLPI Agent packages recommandations should be installed. See the recommandations list in OS vars files (Debian) below.

glpi_agent__recommends: false

glpi_agent__suggests

Boolean. If GLPI Agent packages suggestions should be installed. See the suggestions list in OS vars files (Debian) below.

glpi_agent__suggests: false

Fusioninventory Agent

The official documentation recommends to uninstall fusioninventory agent before installing GLPI Agent. Packages and related configuration files won't be purge by this role.

glpi_agent__fusioninventory_agent_state

State of 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

See official documentation for all parameters syntax.

glpi_agent__conf_file_dest

String. Path to 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 provide GLPI Agent configuration file.

glpi_agent__conf_file_src: '{{ "../templates" + glpi_agent__conf_file_dest + ".j2" }}'

glpi_agent__conf_raw

String. Template used to provide GLPI Agent configuration file.

glpi_agent__conf_raw: ''

Usage exemple:

glpi_agent__conf_raw: |
  tag = my_new_tag

Service

glpi_agent__service_state

String. The targeted service status

glpi_agent__service_state: '{{ "started" if (glpi_agent__enabled | bool)
                          else "stopped" }}'

glpi_agent__service_enabled

String. The targeted service status

glpi_agent__service_enabled: '{{ glpi_agent__enabled | bool }}'

Cron configuration

Instead of running a systemd service, glpi-agent can be ran by a cronjob.

List of cron's related variables (click to expand).

glpi_agent__cron

String. If cronjob should be installed. Can be "absent" or "present".

glpi_agent__cron: 'absent'

glpi_agent__cron_day

Which days should the agent be ran.

glpi_agent__cron_day: '*'

glpi_agent__cron_hour

Which hours should the agent be ran.

glpi_agent__cron_hour: '23'

glpi_agent__cron_minute

Which minutes should the agent be ran.

glpi_agent__cron_minute: '0'

glpi_agent__cron_month

Which months should the agent be ran.

glpi_agent__cron_month: '*'

glpi_agent__cron_weekday

Which weekdays should the agent be ran.

glpi_agent__cron_weekday: '*'

glpi_agent__cron_user

Which user should the agent be ran under.

glpi_agent__cron_user: 'root'

glpi_agent__cron_command

The command should cron run.

glpi_agent__cron_command: 'sleep $(( RANDOM \\% 3600 )); /bin/glpi-agent'

Debian dedicated variables

These variables can't be overrided by the user.

Packages and installation for Debian

Debian glpi_agent__depends_packages

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

Debian glpi_agent__recommends_packages

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

Debian glpi_agent__suggests_packages

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

Development

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 😀).

License

WTFPL

Author Information

Jérémy Gardais

About

Install and manage glpi-agent

Install
ansible-galaxy install ipr-cnrs/glpi-agent
GitHub repository
License
Unknown
Downloads
218192
Owner
Institut de Physique de Rennes https://ipr.univ-rennes1.fr/ Tutelles CNRS et Université Rennes 1