Add example usage and fix comments

This commit is contained in:
Jeremy Gardais 2018-03-09 12:08:05 +01:00
parent af6a3470c4
commit 7b3f2cf8e5
3 changed files with 30 additions and 6 deletions

View File

@ -16,7 +16,7 @@ Manage Xymon server installation and configuration.
* **xymon_server__base_packages**: List of base packages in order to provide `xymon` server [default: `xymon`]. * **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`]. * **xymon_server__deploy_state**: The desired state this role should achieve [default: `present`].
* **ymon_server__etc_src**: Directory used as source to templating /etc configuration content [default: `etc/xymon`]. * **ymon_server__etc_src**: Directory used as source to templating /etc/xymon configuration content [default: `../templates/etc/xymon`].
* **xymon_server__service_manage**: If the Xymon server service should be managed [default: `True`]. * **xymon_server__service_manage**: If the Xymon server service should be managed [default: `True`].
* **xymon_server__service_name**: The service name to manage [default: `xymon`]. * **xymon_server__service_name**: The service name to manage [default: `xymon`].
@ -30,11 +30,36 @@ Manage Xymon server installation and configuration.
- role: ipr-cnrs.xymon_server - role: ipr-cnrs.xymon_server
``` ```
* Use your own Xymon's configuration as source:
``` yml
- hosts: xymon.DOMAIN
roles:
- role: ipr-cnrs.xymon_server
xymon_server__etc_src: '{{ inventory_dir + "/../resources/host/xymon.DOMAIN/etc/xymon/" }}'
```
* Ensure your directory contains only templates or sub-directories, such as:
``` sh
xymon.DOMAIN
└── etc
└── xymon
├── alerts.cfg.j2
├── analysis.cfg.j2
├── client-local.cfg.j2
├── hosts.cfg.j2
└── hosts.d
├── common.lxc.cfg.j2
├── common.storage.cfg.j2
└── test.cfg.j2
```
## Configuration ## Configuration
This role will: This role will:
* Install needed packages to provide `xymon` server. * Install needed packages to provide `xymon` server.
* Manage `xymon` server configuration (/etc). * Manage `xymon` server configuration (/etc/xymon).
* Ensure `xymon` server service is enabled and started. * Ensure `xymon` server service is enabled and started.
* Ensure to restart `xymon` server service if configuration changed. * Ensure to restart `xymon` server service if configuration changed.

View File

@ -22,8 +22,7 @@ xymon_server__base_packages:
# Default. Ensure that xymon server is installed and configured as requested. # Default. Ensure that xymon server is installed and configured as requested.
# #
# ``absent`` # ``absent``
# Ensure that xymon server is uninstalled and it's configuration is removed. # Ensure that xymon server is uninstalled but keep configuration.
# TODO
# #
xymon_server__deploy_state: 'present' xymon_server__deploy_state: 'present'

View File

@ -12,7 +12,6 @@
with_flattened: with_flattened:
- '{{ xymon_server__base_packages }}' - '{{ xymon_server__base_packages }}'
# Server Manage /etc configuration files [[[1 # Server Manage /etc configuration files [[[1
- name: Ensure /etc directory structure exists - name: Ensure /etc directory structure exists
@ -39,5 +38,6 @@
state: '{{ "started" if (xymon_server__deploy_state == "present" and state: '{{ "started" if (xymon_server__deploy_state == "present" and
(xymon_server__service_manage | d(True) | bool)) (xymon_server__service_manage | d(True) | bool))
else "stopped" }}' else "stopped" }}'
enabled: '{{ xymon_server__service_manage | d(True) | bool }}' enabled: '{{ (xymon_server__deploy_state == "present") and
(xymon_server__service_manage | d(True) | bool) }}'