2
0
Fork 0

Install fusioninventory-agent packages and dep

This commit is contained in:
Jeremy Gardais 2018-09-10 11:33:08 +02:00
commit 06745b14c8
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
8 changed files with 233 additions and 0 deletions

29
.travis.yml Normal file
View File

@ -0,0 +1,29 @@
---
language: python
python: "2.7"
# Use the new container infrastructure
sudo: false
# Install ansible
addons:
apt:
packages:
- python-pip
install:
# Install ansible
- pip install ansible
# Check ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

6
CHANGELOG.md Normal file
View File

@ -0,0 +1,6 @@
## v1.0
### Features
* Install dependent packages for fusioninventory-agent.
* Install fusioninventory-agent package from URL.

73
README.md Normal file
View File

@ -0,0 +1,73 @@
# FusionInventory
1. [Overview](#overview)
2. [Role Variables](#role-variables)
3. [Example Playbook](#example-playbook)
4. [Configuration](#configuration)
5. [Development](#development)
6. [License](#license)
7. [Author Information](#author-information)
## Overview
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_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`].
* **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`].
## Example Playbook
* Use defaults vars:
``` yaml
- hosts: mynode.DOMAIN
roles:
- role: ipr-cnrs.fusioninventory
tags: ['role::fusioninventory', 'ipr', inventory']
```
* Install fusioninventory-agent from repository (unavailable in Debian Stretch):
``` yaml
- hosts: mynode.DOMAIN
roles:
- role: ipr-cnrs.fusioninventory
fusioninventory__agent_package_url: ''
tags: ['role::fusioninventory', 'ipr', inventory']
```
## Configuration
This role will:
* Install needed dependent packages of fusioninventory-agent.
* Install fusioninventory-agent package from official project package/URL.
## Development
This source code comes from our [Gogs instance][fusioninventory source] and the [Github repo][fusioninventory github] exist just to be able to send the role to Ansible Galaxy…
But feel free to send issue/PR here :)
Thanks to this [hook][gogs to github hook], Github automatically got updates from our [Gogs instance][fusioninventory source] :)
## License
[WTFPL][wtfpl website]
## Author Information
Jérémy Gardais
* Source: [on IPR's Gogs][fusioninventory source]
* [IPR][ipr website] (Institut de Physique de Rennes)
[gogs to github hook]: https://stackoverflow.com/a/21998477
[fusioninventory source]: https://git.ipr.univ-rennes1.fr/cellinfo/ansible.fusioninventory
[fusioninventory github]: https://github.com/ipr-cnrs/fusioninventory
[wtfpl website]: http://www.wtfpl.net/about/
[ipr website]: https://ipr.univ-rennes1.fr/

78
defaults/main.yml Normal file
View File

@ -0,0 +1,78 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
# ipr-cnrs.fusioninventory default variables [[[
# ======================================
# Packages and installation [[[
# -----------------------------
# .. envvar:: fusioninventory__agent_version [[[
#
# The version of Fusioninventory agent to install.
#
fusioninventory__agent_version: '2.4-2'
# ]]]
# .. envvar:: fusioninventory__agent_depend_packages [[[
#
# List of dependent packages to install.
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'
- 'libnet-cups-perl'
- 'libnet-ip-perl'
- 'libdigest-sha-perl'
- 'libsocket-getaddrinfo-perl'
- 'libtext-template-perl'
# ]]]
# .. 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'
# ]]]
# .. envvar:: fusioninventory__agent_deploy_state [[[
#
# What is the desired state which this role should achieve? Possible options:
#
# ``present``
# Default. Ensure that fusioninventory agent is installed and configured as requested.
#
# ``absent``
# Ensure that fusioninventory agent is uninstalled and it's configuration is removed.
#
fusioninventory__agent_deploy_state: 'present'
# ]]]
# .. envvar:: fusioninventory__agent_service_name [[[
#
# The service name to manage.
#
fusioninventory__agent_service_name: 'fusioninventory-agent'
# ]]]
# .. envvar:: fusioninventory__agent_service_manage [[[
#
# If the fusioninventory agent service should be managed? Possible options:
#
# ``True``
# Default. The service is started and enabled.
#
# ``False``
# The service is disabled from startup.
#
fusioninventory__agent_service_manage: True
# ]]]
# ]]]

15
meta/main.yml Normal file
View File

@ -0,0 +1,15 @@
galaxy_info:
author: "Jérémy Gardais"
description: "Manage FusionInventory Agent"
license: WTFPL
company: IPR
issue_tracker_url: https://git.ipr.univ-rennes1.fr/cellinfo/ansible.fusioninventory-agent/issues
min_ansible_version: 2.6
platforms:
- name: Debian
versions:
- stretch
galaxy_tags:
- agent
- fusion
- inventory

26
tasks/main.yml Normal file
View File

@ -0,0 +1,26 @@
---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
#
# tasks file for fusioninventory
# Manage agent package [[[1
- name: Ensure fusioninventory agent package from URL
apt:
deb: '{{ fusioninventory__agent_package_url | d(omit) }}'
state: '{{ "present" if (fusioninventory__agent_deploy_state == "present") else "absent" }}'
when: fusioninventory__agent_package_url != ""
- name: Ensure fusioninventory agent package from REPOS
package:
name: 'fusioninventory-agent'
state: '{{ "present" if (fusioninventory__agent_deploy_state == "present") else "absent" }}'
when: fusioninventory__agent_package_url == ""
# Manage dependent packages [[[1
- name: Ensure dependent packages are in there desired state
package:
name: '{{ item }}'
state: '{{ "present" if (fusioninventory__agent_deploy_state == "present") else "absent" }}'
with_flattened:
- '{{ fusioninventory__agent_depend_packages }}'

1
tests/inventory Normal file
View File

@ -0,0 +1 @@
localhost

5
tests/test.yml Normal file
View File

@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- fusioninventory