2
0
Fork 0

Compare commits

...

51 Commits

Author SHA1 Message Date
Jeremy Gardais 6e0b853749
Release v1.5.0 2023-08-07 15:46:15 +02:00
Jeremy Gardais b5bdf41a76
Merge branch 'Yoda-BZH-service-cron' 2023-08-07 15:43:02 +02:00
Yoda-BZH 5f3078572c
Merge branch 'master' into service-cron 2023-08-07 15:00:40 +02:00
Jeremy Gardais c500fbc6d9
Merge branch 'Yoda-BZH-service-status-management' 2023-08-07 14:21:33 +02:00
Tristan Charbonneau 014aa5fc62 feat(cron): allow to run fusioninventory with a cronjob 2023-08-07 10:48:51 +02:00
Tristan Charbonneau 4b2442b4e9 chore: update README and CHANGELOG 2023-08-04 10:04:56 +02:00
Tristan Charbonneau 417f6fc58f feat(service): manage service status and state
Service can either be enabled or disabled, enabled by default
Service can either be started, stopped, restarted, reloaded, started by
default
2023-08-04 09:59:00 +02:00
Jeremy Gardais 575004b092
Upgrade package from URL to 2.6
Fix #15
2022-11-07 13:28:47 +01:00
Jeremy Gardais 8c2bf15fe6
Pipe ansible_managed to `comment` jinja filter
To be able to manage multi-lines in ansible_managed.
2022-11-07 10:41:08 +01:00
Jeremy Gardais 8d2e46ebd2
Merge branch 'roumano-move_to_github' 2022-11-07 10:36:07 +01:00
Christian Iuga 1919b0525f change url to github as debian.fusioninventory.org is dead
bump version from 2.4 to 2.5 as this old version for linux is not in
github
2022-10-25 15:43:49 +02:00
Jeremy Gardais 368674c1ce
Version 1.4.1 2021-10-27 15:59:55 +02:00
Jeremy Gardais effce54f95
Merge branch 'mjourdan-wip_rhel8' 2021-10-27 15:58:28 +02:00
Jeremy Gardais cfc5e615e9
Merge branch 'wip_rhel8' of https://github.com/mjourdan/fusioninventory into mjourdan-wip_rhel8 2021-10-27 15:57:54 +02:00
Mathieu Jourdan 24512eeea3 enable appstream repository for rhel8 2021-10-26 12:14:30 +02:00
Mathieu Jourdan 4b425612f5 fix typo in variable names 2021-10-25 17:08:10 +02:00
Jeremy Gardais 2551c3bb9f
Fix truthy warnings with ansible-lint. 2021-08-27 16:39:45 +02:00
Jeremy Gardais 61644d90ca
Release v1.4.0 2021-08-27 15:56:17 +02:00
Jeremy Gardais 89d8e1ea57
Manage color with fusioninventory__agent_conf_log_color var 2021-08-27 15:55:53 +02:00
Jeremy Gardais 76cfdf4df1
Manage lofile parameters 2021-08-27 15:17:46 +02:00
Jeremy Gardais 74fbd8e653
Manage logfacility with fusioninventory__agent_conf_log_facility var 2021-08-27 13:42:43 +02:00
Jeremy Gardais 4ec60b99b3
Manage logger with fusioninventory__agent_conf_log_logger var 2021-08-27 13:26:36 +02:00
Jeremy Gardais f89a1c4cf3
Manage tasks with fusioninventory__agent_conf_tasks var 2021-08-27 13:12:25 +02:00
Jeremy Gardais 068ded4376
Manage no-task with fusioninventory__agent_conf_no_task var 2021-08-26 16:07:44 +02:00
Jeremy Gardais 880b2cd427
Update meta infos 2021-08-26 15:59:25 +02:00
Jeremy Gardais f40b672121
Manage tag with fusioninventory__agent_conf_tag var 2021-08-26 15:58:17 +02:00
Jeremy Gardais 12775009ae
Version 1.3.1 2021-08-02 12:22:25 +02:00
Jeremy Gardais dfad82144e
Don't manage dependencies when install from repos
Package manager (aptitude, yum, dnf,…) is intended to resolve and
install dependencies.
2021-08-02 12:06:25 +02:00
Jeremy Gardais 09b9c5bb26
Fix #11 − Update package list for Debian 2021-06-23 10:29:11 +02:00
Jeremy Gardais f7df94a728
Split depend_packages content to 3 vars 2021-06-23 10:20:41 +02:00
Jeremy Gardais 78b0528362
Flatten packages list to allow condition 2021-06-22 15:56:25 +02:00
Jeremy Gardais 2f30ef5954
Merge branch 'mjourdan-fix-rhel7-support' 2021-06-22 10:05:23 +02:00
Mathieu Jourdan da8e53aac6 Fix with_first_found fail when vars file is missing 2021-06-16 09:20:40 +02:00
Jeremy Gardais b9f00ac858
Add "paths" parameter for include_vars
As mentionned in the last example on the documentation:
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/first_found_lookup.html#examples
Fix #5
2021-06-10 16:35:32 +02:00
Jeremy Gardais a9d3811432
Merge branch 'djerfy-issue-5' 2021-06-10 16:17:44 +02:00
Djerfy d80f5e5a2c
Fix with_first_found fail when ansible_distribution vars file is missing (issue #5) 2021-06-10 12:26:25 +02:00
Jeremy Gardais 3153efe24b
Update dependencies for .deb package 2021-06-10 12:24:34 +02:00
Jeremy Gardais 3f36889b0b
Add a default mode for ini_file 2021-06-10 11:39:38 +02:00
Jeremy Gardais 26a152e9fb
Add role_name info 2021-06-10 11:36:28 +02:00
Jeremy Gardais f3be491216
v1.2.1 2021-06-10 11:09:37 +02:00
Jeremy Gardais 53f622acaf
Update changelog for version 1.2.0 2021-06-10 11:04:14 +02:00
Jeremy Gardais 85010486a3
Merge branch 'mjourdan-wip_rhel8' 2021-06-10 10:57:36 +02:00
Mathieu Jourdan 0f0be2616c manage redhat's mess with repository names
names differ between RedHat 8, CentOS 8.2, CentOS 8.3+...
2021-05-11 17:05:21 +02:00
Mathieu Jourdan 2bb3055502 add EL 8 to supported platforms 2021-03-15 13:54:59 +01:00
Mathieu Jourdan cb5929938d enable powertools repository for RedHat8 2021-03-15 12:11:47 +01:00
Mathieu Jourdan 2722fc9613 install epel repo from package 2021-03-15 11:52:28 +01:00
Jeremy Gardais d4eb45dc03
The role also works on Debian Buster 2020-11-10 15:20:59 +01:00
Jeremy Gardais 2099697579
Add missing dep (libxml-treepp-perl and ucf) 2020-11-10 15:19:08 +01:00
Jeremy Gardais 82badc3140
Merge branch 'djerfy-master' 2020-11-10 15:16:06 +01:00
DJΞRFY 3103604379
Add libyaml-tiny-perl package 2020-11-10 14:39:38 +01:00
Jeremy Gardais ab1e1ca2b4 Moved back agent_package_url definition in default 2020-10-07 07:32:30 +02:00
12 changed files with 498 additions and 115 deletions

View File

@ -1,3 +1,86 @@
## v1.5.0
### Enhancement
* Upgrade package version from URL from 2.4 to 2.6 (thanks to @roumano - issue #15).
* Allow running the agent with a cron job instead of the service (thanks to @yodabzh - issue #18)
* Allow service to be managed, (thanks to @yodabzh - issue #17).
### Fix
* Switch to Github URL to download deb file (thanks to @roumano - PR #16).
* Pipe ansible_managed to `comment` jinja filter to manage multi-lines.
## v1.4.1
### Fix
* truthy warnings with ansible-lint.
* complete rhel8 support (thanks @mjourdan PR #13).
## v1.4.0
### Add
* Manage new parameters:
* **tag** with fusioninventory__agent_conf_tag variable
* **no-task** with fusioninventory__agent_conf_no_task variable
* **tasks** with fusioninventory__agent_conf_tasks variable
* **logger** with fusioninventory__agent_conf_log_logger variable
* **logfacility** with fusioninventory__agent_conf_log_facility variable
* **logfile** with fusioninventory__agent_conf_log_file variable
* **logfile-maxsize** with fusioninventory__agent_conf_log_file_maxsize variable
* **color** with fusioninventory__agent_conf_log_color variable
## v1.3.1
### Fix
* Update package list for Debian from `dpkg --info` of the last 2.6 version (fix #11).
### Enhancement
* Flatten packages list to allow condition.
* Split fusioninventory__agent_depend_packages content to 3 variables (for Debian)
* fusioninventory__agent_depend_packages
* fusioninventory__agent_recommend_packages
* fusioninventory__agent_extra_packages
* Manage dependencies only when FI is installed from a downloaded package.
## v1.3.0
### Fix
* Add role_name info in meta.
* Set a default mode (0644) in ini_file.
* with_first_found fail when ansible_distribution vars file is missing (#5).
### Enhancement
* Update dependencies for .deb package.
## v1.2.1
### Fix
* Warnings with yamllint.
## v1.2.0
### Features
* Add RHEL8 support (thanks @mjourdan) (#7).
* The role also works on Debian Bullseye.
## v1.1.2
* Add missing dependencies (libyaml-tiny-perl, libxml-treepp-perl and ucf).
* The role also works on Debian Buster.
## v1.1.1
### Fix
* Moved back fusioninventory__agent_package_url definition in default configuration
even if it's Debian related to allow installation of a newer version than one
available in repos or installation from private repository (for Stretch).
## v1.1.0
### Features

View File

@ -1,5 +1,8 @@
# FusionInventory
As [fusioninventory-agent is no longer maintened](https://github.com/ipr-cnrs/fusioninventory/issues/12#issuecomment-937656377),
you should consider using the "new" [glpi-agent role](https://github.com/ipr-cnrs/glpi-agent).
1. [Overview](#overview)
2. [Role Variables](#role-variables)
* [Config Specific Variables](#config-specific-variables)
@ -15,13 +18,28 @@ A role to manage FusionInventory agent installation and configuration.
## Role Variables
* **fusioninventory__agent_version**: The version of Fusioninventory agent to install [default: `2.4-2`].
* **fusioninventory__agent_version**: The version of Fusioninventory agent to install [default: `2.6-1`].
* **fusioninventory__agent_depend_packages**: List of dependent packages to install.
* **fusioninventory__agent_package_url**: The URL used to download deb package for fusioninventory-agent [default: `http://debian.fusioninventory.org/downloads/fusioninventory-agent_{{ fusioninventory__agent_version }}_all.deb` for Debian Stretch only].
* **fusioninventory__agent_recommend_packages**: List of recommended packages to install.
* **fusioninventory__agent_extra_packages**: List of extra packages to install (eg. to allow installation from a .deb file from Ansible).
* **fusioninventory__agent_package_url**: The URL used to download deb package for fusioninventory-agent [default: `"https://github.com/fusioninventory/fusioninventory-agent/releases/download/" + fusioninventory__agent_major_version + "/fusioninventory-agent_" + fusioninventory__agent_version + "_all.deb"` for Debian Stretch only].
* **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_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`].
* **fusioninventory__agent_service_status**: Service state, can be started, stopped, restarted, reloaded [default : `started`].
* **fusioninventory__agent_service_enabled**: Service status, can be enabled (`true`) or disabled (`false`) [default: `true`].
## Cron variables
* **fusioninventory__agent_conf_cron**: Enable (`"present"`) or disable (`"absent"`) a job cron to run the agent [default: `"absent"`].
* **fusioninventory__agent_conf_cron_day**: Which days should the agent be ran [default: `"*"`].
* **fusioninventory__agent_conf_cron_hour**: Which hours should the agent be ran [default: `"23"`].
* **fusioninventory__agent_conf_cron_minute**: Which minutes should the agent be ran [default: `"0"`].
* **fusioninventory__agent_conf_cron_month**: Which months should the agent be ran [default: `"*"`].
* **fusioninventory__agent_conf_cron_weekday**: Which weekdays should the agent be ran [default: `"*"`].
* **fusioninventory__agent_conf_cron_user**: Which user should the agent be ran under [default: `"root"`].
* **fusioninventory__agent_conf_command**: The command should cron run [default: `"sleep $(( RANDOM \\% 3600 )); /usr/bin/fusioninventory-agent"`].
### Config Specific Variables
@ -29,16 +47,24 @@ Some variables used to generate FusionInventery agent.cfg file from Ansible temp
* **fusioninventory__agent_conf_server_url**: The URL of your Fusioninventory-server/GLPI/… [default⎵: ``].
* **fusioninventory__agent_conf_local_dir**: Write tasks results in a directory [default⎵: ``].
* **fusioninventory__agent_conf_no_task**: Do not run given task (separated by a comma) [default⎵: ``].
* **fusioninventory__agent_conf_tasks**: Run given tasks in given order (separated by a comma) [default⎵: ``].
* **fusioninventory__agent_conf_delaytime**: Set an initial delay before the first target [default⎵: `3600`].
* **fusioninventory__agent_conf_no_category**: Do not list given category items in inventory task (separated by a comma) [default⎵: ``].
* **fusioninventory__agent_conf_scan_homedirs**: Enable the scan of user home directories [default⎵: `False`].
* **fusioninventory__agent_conf_scan_profiles**: Enable the scan of users list [default⎵: `False`].
* **fusioninventory__agent_conf_no_ssl_check**: Disable check of the server SSL certificate [default⎵: `False`].
* **fusioninventory__agent_conf_no_httpd**: Disable embedded web server [default⎵: `True`].
* **fusioninventory__agent_conf_scan_homedirs**: Enable the scan of user home directories [default⎵: `false`].
* **fusioninventory__agent_conf_scan_profiles**: Enable the scan of users list [default⎵: `false`].
* **fusioninventory__agent_conf_no_ssl_check**: Disable check of the server SSL certificate [default⎵: `false`].
* **fusioninventory__agent_conf_no_httpd**: Disable embedded web server [default⎵: `true`].
* **fusioninventory__agent_conf_httpd_ip**: Interface/IP, the webserver server should listen to [default⎵: ``].
* **fusioninventory__agent_conf_httpd_port**: TCP port used by the webserver server to listen [default⎵: `62354`].
* **fusioninventory__agent_conf_httpd_trust**: hostname or IP or subnet authorized for http request [default⎵: ``].
* **fusioninventory__agent_conf_debug**: If debug mode should be enabled [default⎵: `False`].
* **fusioninventory__agent_conf_log_logger**: Specifies the logger backend to use [default⎵: `syslog`].
* **fusioninventory__agent_conf_log_facility**: Specifies the syslog facility to use for the syslog logger backend [default⎵: `LOG_DAEMON`].
* **fusioninventory__agent_conf_log_file**: Specifies the file to use for the file logger backend [default⎵: `/var/log/fusioninventory.log`].
* **fusioninventory__agent_conf_log_file_maxsize**: Specifies the maximum size for the log file, in MB [default⎵: `0`].
* **fusioninventory__agent_conf_log_color**: Enables color display for the stderr logger backend [default⎵: `false`].
* **fusioninventory__agent_conf_tag**: Add given tag to inventory results [default⎵: ``].
* **fusioninventory__agent_conf_debug**: If debug mode should be enabled [default⎵: `false`].
## Example Playbook

View File

@ -11,9 +11,22 @@
#
# The version of Fusioninventory agent to install.
#
fusioninventory__agent_version: '2.4-2'
fusioninventory__agent_version: '2.6-1'
fusioninventory__agent_major_version: '2.6'
# ]]]
# .. envvar:: fusioninventory__agent_package_url [[[
#
# The URL used to download deb package for fusioninventory-agent.
#
# See the official documentation for more informations:
# http://fusioninventory.org/documentation/agent/installation/linux/deb.html
#
# Only works with Debian
fusioninventory__agent_package_url: '{{ "https://github.com/fusioninventory/fusioninventory-agent/releases/download/" + fusioninventory__agent_major_version + "/fusioninventory-agent_" + fusioninventory__agent_version + "_all.deb"
if (ansible_distribution_release in
([ "stretch" ]))
else "" }}'
# ]]]
# .. envvar:: fusioninventory__agent_deploy_state [[[
#
# What is the desired state which this role should achieve? Possible options:
@ -31,6 +44,19 @@ fusioninventory__agent_deploy_state: 'present'
# The service name to manage.
#
fusioninventory__agent_service_name: 'fusioninventory-agent'
# ]]]
# .. envvar:: fusioninventory__agent_service_status [[[
#
# The targeted service status.
#
fusioninventory__agent_service_status: 'started'
# ]]]
# .. envvar:: fusioninventory__agent_service_enabled [[[
#
# The targeted service status.
#
fusioninventory__agent_service_enabled: true
# ]]]
# .. envvar:: fusioninventory__agent_service_manage [[[
@ -43,10 +69,69 @@ fusioninventory__agent_service_name: 'fusioninventory-agent'
# ``False``
# The service is disabled from startup.
#
fusioninventory__agent_service_manage: True
fusioninventory__agent_service_manage: true
# ]]]
# Cron configuration [[[
# -----------------------------
# .. envvar:: fusioninventory__agent_conf_cron [[[
#
# Instead of running as an agent, run by cron. Can be "absent" or "present"
#
fusioninventory__agent_conf_cron: "absent"
# ]]]
# .. envvar:: fusioninventory__agent_conf_cron_day [[[
#
# Which days should the agent be ran
#
fusioninventory__agent_conf_cron_day: "*"
# ]]]
# .. envvar:: fusioninventory__agent_conf_cron_hour [[[
#
# Which hours should the agent be ran
#
fusioninventory__agent_conf_cron_hour: "23"
# ]]]
# .. envvar:: fusioninventory__agent_conf_cron_minute [[[
#
# Which minutes should the agent be ran
#
fusioninventory__agent_conf_cron_minute: "0"
# ]]]
# .. envvar:: fusioninventory__agent_conf_cron_month [[[
#
# Which months should the agent be ran
#
fusioninventory__agent_conf_cron_month: "*"
# ]]]
# .. envvar:: fusioninventory__agent_conf_cron_weekday [[[
#
# Which weekdays should the agent be ran
#
fusioninventory__agent_conf_cron_weekday: "*"
# ]]]
# .. envvar:: fusioninventory__agent_conf_cron_user [[[
#
# Which user should the agent be ran under
#
fusioninventory__agent_conf_cron_user: "root"
# ]]]
# .. envvar:: fusioninventory__agent_conf_command [[[
#
# The command should cron run
#
fusioninventory__agent_conf_command: "sleep $(( RANDOM \\% 3600 )); /usr/bin/fusioninventory-agent"
# ]]]
# ]]]
# Configuration [[[
# -----------------------------
@ -73,6 +158,28 @@ fusioninventory__agent_conf_server_url: ''
#
fusioninventory__agent_conf_local_dir: ''
# ]]]
# .. envvar:: fusioninventory__agent_conf_no_task [[[
#
# Do not run given task.
# Should be a string with comma as a separator between tasks.
#
# ``''``
# Default. Empty so all tasks are runned.
#
fusioninventory__agent_conf_no_task: ''
# ]]]
# .. envvar:: fusioninventory__agent_conf_tasks [[[
#
# Run given tasks in given order.
# Should be a string with comma as a separator between tasks.
#
# ``''``
# Default. Empty so default order is applied.
#
fusioninventory__agent_conf_tasks: ''
# ]]]
# .. envvar:: fusioninventory__agent_conf_delaytime [[[
#
@ -86,6 +193,9 @@ fusioninventory__agent_conf_delaytime: '3600'
# Do not list given category items in inventory task.
# Should be a string with comma as a separator between categories.
#
# ``''``
# Default. Empty so all categories are listed.
#
fusioninventory__agent_conf_no_category: ''
# ]]]
@ -99,7 +209,7 @@ fusioninventory__agent_conf_no_category: ''
# ``True``
# The agent will scan homedirs.
#
fusioninventory__agent_conf_scan_homedirs: False
fusioninventory__agent_conf_scan_homedirs: false
# ]]]
# .. envvar:: fusioninventory__agent_conf_scan_profiles [[[
@ -112,7 +222,7 @@ fusioninventory__agent_conf_scan_homedirs: False
# ``True``
# The agent will scan user profile.
#
fusioninventory__agent_conf_scan_profiles: False
fusioninventory__agent_conf_scan_profiles: false
# ]]]
# .. envvar:: fusioninventory__agent_conf_no_ssl_check [[[
@ -125,7 +235,7 @@ fusioninventory__agent_conf_scan_profiles: False
# ``True``
# The server's SSL certificate will not be checked.
#
fusioninventory__agent_conf_no_ssl_check: False
fusioninventory__agent_conf_no_ssl_check: false
# ]]]
# .. envvar:: fusioninventory__agent_conf_no_httpd [[[
@ -138,7 +248,7 @@ fusioninventory__agent_conf_no_ssl_check: False
# ``False``
# The webserver will listen on the httpd-port (default to 62354).
#
fusioninventory__agent_conf_no_httpd: True
fusioninventory__agent_conf_no_httpd: true
# ]]]
# .. envvar:: fusioninventory__agent_conf_httpd_ip: [[[
@ -169,6 +279,79 @@ fusioninventory__agent_conf_httpd_port: '62354'
# Default.
#
fusioninventory__agent_conf_httpd_trust: ''
# ]]]
# .. envvar:: fusioninventory__agent_conf_log_logger: [[[
#
# Specifies the logger backend to use. The possible values are:
#
# ``syslog``
# Default. Log messages through the local syslog server.
#
# ``file``
# Log messages in a file.
#
# ``stderr``
# Log messages directly in the console.
#
fusioninventory__agent_conf_log_logger: 'syslog'
# ]]]
# .. envvar:: fusioninventory__agent_conf_log_facility: [[[
#
# Specifies the syslog facility to use for the syslog logger backend.
# The possible values are:
#
# ``LOG_DAEMON``
# Default. System daemons without separate facility value.
#
# ``LOG_USER``
# Generic user-level messages
#
# ``…``
# For all possible values, check syslog(3) manual.
#
fusioninventory__agent_conf_log_facility: 'LOG_DAEMON'
# ]]]
# .. envvar:: fusioninventory__agent_conf_log_file: [[[
#
# Specifies the file to use for the file logger backend.
#
# ``/var/log/fusioninventory.log``
# Default.
#
fusioninventory__agent_conf_log_file: '/var/log/fusioninventory.log'
# ]]]
# .. envvar:: fusioninventory__agent_conf_log_file_maxsize: [[[
#
# Specifies the maximum size for the log file, in MB.
# When the max size is reached, the file is truncated.
#
# ``0``
# Default. 0 means unlimited size.
#
fusioninventory__agent_conf_log_file_maxsize: '0'
# ]]]
# .. envvar:: fusioninventory__agent_conf_log_color [[[
#
# Enables color display for the stderr logger backend. Possible options:
#
# ``False``
# Default.
#
# ``True``
# Enable colors.
#
fusioninventory__agent_conf_log_color: false
# ]]]
# .. envvar:: fusioninventory__agent_conf_tag [[[
#
# Add given tag to inventory results
#
# ``''``
# Default. Empty so results are send without any tag.
#
fusioninventory__agent_conf_tag: ''
# ]]]
# .. envvar:: fusioninventory__agent_conf_debug [[[
#
@ -181,7 +364,7 @@ fusioninventory__agent_conf_httpd_trust: ''
# Debug mode is enable and fusioninventory-agent will send informations
# to journalctl/syslog/…
#
fusioninventory__agent_conf_debug: False
fusioninventory__agent_conf_debug: false
# ]]]
# ]]]

View File

@ -3,6 +3,8 @@
dependencies: []
galaxy_info:
role_name: fusioninventory
namespace: ipr-cnrs
author: "Jérémy Gardais"
description: "Manage FusionInventory Agent"
license: WTFPL
@ -12,11 +14,15 @@ galaxy_info:
platforms:
- name: Debian
versions:
- bullseye
- buster
- stretch
- name: EL
versions:
- 8
- 7
galaxy_tags:
- agent
- fusioninventory
- fusion
- inventory

View File

@ -3,9 +3,35 @@
# http://fusioninventory.org/documentation/agent/installation/linux/rhel.html
- name: Import EPEL GPG key
rpm_key:
key: "{{ fusioninventory__repo_gpgkey }}"
state: present
- name: Add EPEL Repository
yum_repository:
name: Epel
description: EPEL YUM repo
baseurl: https://download.fedoraproject.org/pub/epel/$releasever/$basearch/
gpgkey: https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}
yum:
name: "{{ fusioninventory__repo_package }}"
state: present
- name: RedHat 8 specifics
block:
- name: Load additional repository settings for CentOS or RedHat 8
include_vars: "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- name: Override repository settings for CentOS <= 8.2
include_vars: "CentOS-8.2.yml"
when:
- ansible_facts['distribution'] == "CentOS"
- ansible_facts['distribution_version'] | float <= 8.2
- name: Enable Additional Repository
ini_file:
path: "{{ fusioninventory__additional_repo_file }}"
section: "{{ item.section }}"
option: "{{ item.option }}"
value: "{{ item.value }}"
mode: "0644"
loop: "{{ fusioninventory__additional_repo_params }}"
when: ansible_facts['distribution_major_version'] | int >= 8

View File

@ -4,39 +4,47 @@
# tasks file for fusioninventory
- name: Include package list per OS
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
include_vars: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml'
paths:
- 'vars'
# Manage dependent packages [[[1
- name: Ensure dependent packages are installed
# Manage fusioninventory related packages [[[1
- name: Ensure related packages are installed
package:
name: '{{ item }}'
name: '{{ (fusioninventory__agent_depend_packages|d([]) +
fusioninventory__agent_recommend_packages|d([]) +
fusioninventory__agent_extra_packages|d([]))
| flatten }}'
state: 'present'
with_flattened:
- '{{ fusioninventory__agent_depend_packages | to_nice_json }}'
register: pkg_dep_result
until: pkg_dep_result is success
when: fusioninventory__agent_deploy_state == "present"
when: ((fusioninventory__agent_package_url|length > 0) and
(fusioninventory__agent_deploy_state == "present"))
# Manage agent package [[[1
# Specific tasks per OS will be in the include otherwise below
- include: "{{ item }}"
with_first_found:
- "{{ ansible_distribution }}.yml"
- "{{ ansible_os_family }}.yml"
- name: Include tasks per OS
include: "{{ lookup('first_found', params) }}"
vars:
params:
files:
- '{{ ansible_distribution }}.yml'
- '{{ ansible_os_family }}.yml'
- name: Ensure fusioninventory-agent package from REPOS
package:
name: '{{ fusioninventory__agent_packages }}'
name: '{{ fusioninventory__agent_packages | flatten }}'
state: '{{ "present" if (fusioninventory__agent_deploy_state == "present")
else "absent" }}'
register: pkg_agent_repo_result
until: pkg_agent_repo_result is success
when: ((not fusioninventory__agent_package_url) or
(fusioninventory__agent_deploy_state == "absent"))
when: fusioninventory__agent_package_url|length == 0
# Manage agent configuration file [[[1
- name: Create Fusioninventory-agent configuration
@ -48,3 +56,24 @@
mode: '0644'
when: fusioninventory__agent_deploy_state == "present"
notify: ['restart fusioninventory-agent service']
- name: Ensure the service is in the correct state
service:
name: "{{ fusioninventory__agent_service_name }}"
state: "{{ fusioninventory__agent_service_status }}"
enabled: "{{ fusioninventory__agent_service_enabled }}"
when: fusioninventory__agent_deploy_state == "present"
- name: "Create cron entry when needed"
cron:
name: fusion-inventory-oneshot
cron_file: fusion-inventory-oneshot
day: "{{ fusioninventory__agent_conf_cron_day }}"
hour: "{{ fusioninventory__agent_conf_cron_hour }}"
minute: "{{ fusioninventory__agent_conf_cron_minute }}"
month: "{{ fusioninventory__agent_conf_cron_month }}"
weekday: "{{ fusioninventory__agent_conf_cron_weekday }}"
user: "{{ fusioninventory__agent_conf_cron_user }}"
state: "{{ fusioninventory__agent_conf_cron }}"
job: "{{ fusioninventory__agent_conf_command }}"

View File

@ -1,15 +1,12 @@
# {{ ansible_managed }}
# {{ ansible_managed | comment }}
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# fusioninventory agent configuration
# all defined values match default
# all commented values are examples
#
# Target definition options
#
# 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
@ -23,27 +20,30 @@ server = {{ fusioninventory__agent_conf_server_url }}
local = {{ fusioninventory__agent_conf_local_dir }}
{% endif %}
#
# Task definition options
#
# ]]]
# Task definition options [[[
# disable software deployment tasks
#no-task = deploy
{% if fusioninventory__agent_conf_no_task %}
no-task = {{ fusioninventory__agent_conf_no_task }}
{% endif %}
#tasks = inventory,deploy,inventory
{% if fusioninventory__agent_conf_tasks %}
tasks = {{ fusioninventory__agent_conf_tasks }}
{% endif %}
#
# Target scheduling options
#
# ]]]
# Target scheduling options [[[
# maximum delay before first target, in seconds
delaytime = {{ fusioninventory__agent_conf_delaytime }}
# do not contact the target before next scheduled time
lazy = 0
#
# Inventory task specific options
#
# ]]]
# Inventory task specific options [[[
# do not list local printers
# no-category = printer
{% if fusioninventory__agent_conf_no_category %}
@ -72,17 +72,15 @@ force = 0
# additional inventory content file
additional-content =
#
# Package deployment task specific options
#
# ]]]
# Package deployment task specific options [[[
# do not use peer to peer to download files
no-p2p = 0
#
# Network options
#
# ]]]
# Network options [[[
# proxy address
proxy =
# user name for server authentication
@ -103,10 +101,9 @@ no-ssl-check = 0
# connection timeout, in seconds
timeout = 180
#
# Web interface options
#
# ]]]
# Web interface options [[[
{% if fusioninventory__agent_conf_no_httpd %}
# disable embedded web server
no-httpd = 1
@ -121,27 +118,34 @@ httpd-port = {{ fusioninventory__agent_conf_httpd_port }}
# trust requests without authentication token
httpd-trust = {{ fusioninventory__agent_conf_httpd_trust }}
#
# Logging options
#
# ]]]
# Logging options [[[
# Logger backend, either Stderr, File or Syslog (Stderr)
logger = syslog
logger = {{ fusioninventory__agent_conf_log_logger }}
{% if fusioninventory__agent_conf_log_logger == 'file' %}
# log file
#logfile = /var/log/fusioninventory.log
logfile = {{ fusioninventory__agent_conf_log_file }}
# maximum log file size, in MB
#logfile-maxsize = 0
logfile-maxsize = {{ fusioninventory__agent_conf_log_file_maxsize }}
{% endif %}
{% if fusioninventory__agent_conf_log_logger == 'syslog' %}
# Syslog facility
logfacility = LOG_DAEMON
# Use color in the console
logfacility = {{ fusioninventory__agent_conf_log_facility }}
{% endif %}
{% if fusioninventory__agent_conf_log_color %}
# Use color in the console with stderr backend
color = 1
{% else %}
# Don't use color in the console with stderr backend
color = 0
{% endif %}
#
# Execution mode options
#
# ]]]
# Execution mode options [[[
# add given tag to inventory results
tag =
tag = {{ fusioninventory__agent_conf_tag }}
{% if fusioninventory__agent_conf_debug %}
# enable debug mode
debug = 1
@ -151,7 +155,9 @@ debug = 0
{% endif %}
# time to wait to reload config (0 means no reload, it's default value)
# conf-reload-interval = 0
# conf-reload-interval = 0
# ]]]
# Since 2.4, you can include all .cfg files from a folder or any given file
# For example:

10
vars/CentOS-8.2.yml Normal file
View File

@ -0,0 +1,10 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# For CentOS Linux 8.2 and below
# https://wiki.centos.org/Manuals/ReleaseNotes/CentOS8.2011#Yum_repo_file_and_repoid_changes
fusioninventory__additional_repo_file: "/etc/yum.repos.d/{{ ansible_distribution }}-PowerTools.repo"
fusioninventory__additional_repo_params:
- section: PowerTools
option: enabled
value: "1"

10
vars/CentOS-8.yml Normal file
View File

@ -0,0 +1,10 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# For CentOS Linux 8.3 and above
# https://wiki.centos.org/Manuals/ReleaseNotes/CentOS8.2011#Yum_repo_file_and_repoid_changes
fusioninventory__additional_repo_file: "/etc/yum.repos.d/{{ ansible_distribution }}-Linux-PowerTools.repo"
fusioninventory__additional_repo_params:
- section: powertools
option: enabled
value: "1"

View File

@ -1,41 +1,42 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# .. envvar:: fusioninventory__agent_depend_packages [[[
#
# List of dependent packages to install.
# .. envvar:: fusioninventory__agent_depend_packages
# List of dependent packages to install from a deb file
fusioninventory__agent_depend_packages:
- 'dmidecode'
- 'hwdata'
- 'hdparm'
- 'libuniversal-require-perl'
- 'libwww-perl'
- 'libparse-edid-perl'
- 'libproc-daemon-perl'
- 'libfile-which-perl'
- 'libhttp-daemon-perl'
- 'libxml-treepp-perl'
- 'libyaml-perl'
- 'libjson-pp-perl'
- 'libnet-cups-perl'
- 'libnet-ip-perl'
- 'libdigest-sha-perl'
- 'libjson-pp-perl'
- 'libparse-edid-perl'
- 'libproc-daemon-perl'
- 'libsocket-getaddrinfo-perl'
- 'libtext-template-perl'
- 'libuniversal-require-perl'
- 'libwww-perl'
- 'libxml-treepp-perl'
- 'libxml-xpath-perl'
- 'libyaml-perl'
- 'libyaml-tiny-perl'
- 'lsb-base'
- 'ucf'
# List of recommended packages to install from a deb file
fusioninventory__agent_recommend_packages:
- 'dmidecode'
- '{{ "util-linux"
if ansible_distribution_release in
[ "stretch" ]
else "fdisk" }}'
- 'hdparm'
- 'libio-socket-ssl-perl'
# List of packages to be able install a deb file with Ansible
fusioninventory__agent_extra_packages:
- 'xz-utils'
# ]]]
# .. envvar:: fusioninventory__agent_package_url [[[
#
# The URL used to download deb package for fusioninventory-agent.
#
# See the official documentation for more informations:
# http://fusioninventory.org/documentation/agent/installation/linux/deb.html
#
fusioninventory__agent_package_url: '{{ "http://debian.fusioninventory.org/downloads/fusioninventory-agent_"+ fusioninventory__agent_version + "_all.deb"
if (ansible_distribution_release in
([ "stretch" ]))
else "" }}'
# ]]]
fusioninventory__agent_packages:
- 'fusioninventory-agent'

13
vars/RedHat-8.yml Normal file
View File

@ -0,0 +1,13 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# For RedHat Entreprise Linux 8
# https://developers.redhat.com/blog/2018/11/15/introducing-codeready-linux-builder/
fusioninventory__additional_repo_file: "/etc/yum.repos.d/redhat.repo"
fusioninventory__additional_repo_params:
- section: codeready-builder-for-rhel-8-x86_64-rpms
option: enabled
value: "1"
- section: rhel-8-for-x86_64-appstream-rpms
option: enabled
value: "1"

View File

@ -1,25 +1,15 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# .. envvar:: fusioninventory__agent_depend_packages [[[
# .. envvar:: fusioninventory__agent_depend_packages
#
# List of dependent packages to install.
fusioninventory__agent_depend_packages:
- 'dmidecode'
# ]]]
# .. envvar:: fusioninventory__agent_package_url [[[
#
# The URL used to download deb package for fusioninventory-agent.
#
# See the official documentation for more informations:
# http://fusioninventory.org/documentation/agent/installation/linux/deb.html
#
fusioninventory__agent_package_url: '{{ "http://debian.fusioninventory.org/downloads/fusioninventory-agent_"+ fusioninventory__agent_version + "_all.deb"
if (ansible_distribution_release in
([ "stretch" ]))
else "" }}'
# ]]]
fusioninventory__agent_packages:
- 'fusioninventory-agent'
- 'fusioninventory-agent-task-inventory'
fusioninventory__repo_package: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm"
fusioninventory__repo_gpgkey: "https://download.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-{{ ansible_distribution_major_version }}"