From 3c05d6bf5da6cff0643f00a90f42a3e360b1ff76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 1 Mar 2018 13:46:21 +0100 Subject: [PATCH] Install `xymon` packages for Debian based distros --- .travis.yml | 29 +++++++++++++++++++++++ CHANGELOG.md | 5 ++++ README.md | 59 +++++++++++++++++++++++++++++++++++++++++++++++ defaults/main.yml | 31 +++++++++++++++++++++++++ meta/main.yml | 15 ++++++++++++ tasks/main.yml | 14 +++++++++++ tests/inventory | 1 + tests/test.yml | 5 ++++ 8 files changed, 159 insertions(+) create mode 100644 .travis.yml create mode 100644 CHANGELOG.md create mode 100644 README.md create mode 100644 defaults/main.yml create mode 100644 meta/main.yml create mode 100644 tasks/main.yml create mode 100644 tests/inventory create mode 100644 tests/test.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..36bbf62 --- /dev/null +++ b/.travis.yml @@ -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/ \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..4810574 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,5 @@ + +## v1.0 + +### Features +* Install `xymon` packages for Debian based distros. diff --git a/README.md b/README.md new file mode 100644 index 0000000..2274d11 --- /dev/null +++ b/README.md @@ -0,0 +1,59 @@ +# Xymon Server + +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 + +Manage Xymon server installation and configuration. + +## Role Variables + +* **xymon_server__base_packages** : List of base packages in order to provide `xymon` server [default : `xymon`]. +* **xymon_server__deploy_state** : The desired state this role should achieve [default : `present`]. + +## Example Playbook + +* Use defaults vars : + +``` yml +- hosts: serverXYZ + roles: + - role: ipr-cnrs.xymon_server +``` + +## Configuration + +This role will : +* Install needed packages to provide `xymon` server. +* Manage `xymon` server configuration and service. +* Add 'xymon' user to new groups. + +## Development + +This source code comes from our [Gogs instance][xymon_server source] and the [Github repo][xymon_server 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][xymon_server source] :) + +## License + +[WTFPL][wtfpl website] + +## Author Information + +Jérémy Gardais +* Source : [on IPR's Gogs][xymon_server source] +* [IPR][ipr website] (Institut de Physique de Rennes) + +[gogs to github hook]: https://stackoverflow.com/a/21998477 +[xymon_server source]: https://git.ipr.univ-rennes1.fr/cellinfo/ansible.xymon_server +[xymon_server github]: https://github.com/ipr-cnrs/xymon_server +[wtfpl website]: http://www.wtfpl.net/about/ +[ipr website]: https://ipr.univ-rennes1.fr/ diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..715d307 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,31 @@ +--- +# .. vim: foldmarker=[[[,]]]:foldmethod=marker +# +# ipr-cnrs.xymon_server default variables [[[ +# ====================================== + +# Server Packages and installation [[[ +# ----------------------------- + +# .. envvar:: xymon_server__base_packages [[[ +# +# List of base packages to install. +xymon_server__base_packages: + - 'xymon' + + # ]]] +# .. envvar:: xymon_server__deploy_state [[[ +# +# What is the desired state which this role should achieve? Possible options: +# +# ``present`` +# Default. Ensure that xymon server is installed and configured as requested. +# +# ``absent`` +# Ensure that xymon server is uninstalled and it's configuration is removed. +# TODO +# +xymon_server__deploy_state: 'present' + # ]]] + + # ]]] diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..ed61cf0 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,15 @@ +galaxy_info: + author: "Jérémy Gardais" + description: "Manage Xymon server configuration" + license: WTFPL + company: IPR + issue_tracker_url: https://git.ipr.univ-rennes1.fr/cellinfo/ansible.xymon_server/issues + min_ansible_version: 2.4 + platforms: + - name: Debian + versions: + - stretch + galaxy_tags: + - system + - xymon + - monitoring diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..8018f7c --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,14 @@ +--- +# .. vim: foldmarker=[[[,]]]:foldmethod=marker +# +# tasks file for ipr.ansible.xymon + +# Server Manage required system packages [[[1 +- name: Ensure required packages are in there desired state + package: + name: '{{ item }}' + state: '{{ "present" if (xymon_server__deploy_state == "present") else "absent" }}' + install_recommends: False + with_flattened: + - '{{ xymon_server__base_packages }}' + diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..d18580b --- /dev/null +++ b/tests/inventory @@ -0,0 +1 @@ +localhost \ No newline at end of file diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..2b63f68 --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - ipr.ansible.xymon_server