From b8799a13e87e461f876c45f416892a64fb8221b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Fri, 11 Aug 2017 14:33:31 +0200 Subject: [PATCH] Manage `xymon-client` default configuration file. --- CHANGELOG.md | 1 + README.md | 4 +++- defaults/main.yml | 4 ++++ tasks/main.yml | 10 +++++++++ templates/etc/default/xymon-client.j2 | 32 +++++++++++++++++++++++++++ 5 files changed, 50 insertions(+), 1 deletion(-) create mode 100644 templates/etc/default/xymon-client.j2 diff --git a/CHANGELOG.md b/CHANGELOG.md index c8e7a65..02ce7a0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,4 +3,5 @@ ### Features * Install `xymon-client` packages for Debian based distros. +* Manage `xymon-client` default configuration file. * Manage `xymon-client` service. diff --git a/README.md b/README.md index c945118..ed35573 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,8 @@ Manage Xymon (client) installation and configuration. * **xymon_cli_manage** : If `xymon-client` should be managed with this role [default : `true`]. * **xymon_cli_pkg_state** : State of new `xymon-client` package(s) [default : `installed`]. +* **xymon_cli_default_conf_path** : Configuration file for `xymon-client` [default : `/etc/default/xymon-client`]. +* **xymon_cli_default_conf_tpl** : Template used to generate the previous config file [default : `etc/default/xymon-client.j2`]. * **xymon_cli_service_manage** : If `xymon-client` service should be managed with this role [default : `true`]. * **xymon_cli_service_name** : `xymon-client` service name [default : `xymon-client`]. * **xymon_cli_service_enabled** : Set `xymon-client` service available at startup [default : `true`]. @@ -41,7 +43,7 @@ Please see default value by Operating System file in [vars][vars directory] dire This role will : * Install needed packages to provide `xymon-client`. -* Manage `xymon-client` service. +* Manage `xymon-client` configuration and service. ## Development diff --git a/defaults/main.yml b/defaults/main.yml index 687533b..0f1ff2d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -6,6 +6,10 @@ xymon_cli_manage: true xymon_cli_pkg_state: 'installed' +## conf +xymon_cli_default_conf_path: '/etc/default/xymon-client' +xymon_cli_default_conf_tpl: 'etc/default/xymon-client.j2' + ## service xymon_cli_service_manage: true xymon_cli_service_name: 'xymon-client' diff --git a/tasks/main.yml b/tasks/main.yml index e059428..0db3e0b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -17,6 +17,16 @@ - '{{ xymon_cli_pkg_list }}' when: xymon_cli_manage +- name: CONFIG xymon-client + template: + src: '{{ xymon_cli_default_conf_tpl }}' + dest: '{{ xymon_cli_default_conf_path }}' + owner: root + group: root + mode: 0644 + backup: true + when: xymon_cli_manage + ## service - name: SERVICE manage '{{ xymon_cli_service_name }}' service: diff --git a/templates/etc/default/xymon-client.j2 b/templates/etc/default/xymon-client.j2 new file mode 100644 index 0000000..6ef8e89 --- /dev/null +++ b/templates/etc/default/xymon-client.j2 @@ -0,0 +1,32 @@ +# Configure the Xymon client settings. + +# You MUST set the list of Xymon servers that this +# client reports to. +# It is good to use IP-addresses here instead of DNS +# names - DNS might not work if there's a problem. +# +# E.g. (a single Xymon server) +# XYMONSERVERS="192.168.1.1" +# or (multiple servers) +# XYMONSERVERS="10.0.0.1 192.168.1.1" + +XYMONSERVERS="127.0.0.1" + +# The defaults usually suffice for the rest of this file, +# but you can tweak the hostname that the client reports +# data with, and the OS name used (typically needed only on +# RHEL or RHAS servers). + +# CLIENTHOSTNAME="" +# CLIENTOS="rhel3" + +CLIENTHOSTNAME="hostname.domain.local" + +# Optionally mount a tmpfs on /var/lib/xymon/tmp. On client systems this has +# the advantage that client reports will continue to work even if the /var +# filesystem is out of space. This setting is ignored on server systems where +# this directory contains important information that must be preserved over +# reboots (xymond.chk). + +#TMPFSSIZE="5000000" +