From 7112f38723da94fa096c5add4c17fd5198870a07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Fri, 2 Mar 2018 15:15:11 +0100 Subject: [PATCH] Add possibility to install `apt` plugin dependencies --- CHANGELOG.md | 5 +++-- README.md | 5 +++++ defaults/main.yml | 8 ++++++++ tasks/main.yml | 19 +++++++++++++++++++ templates/etc/xymon/clientlaunch.d/apt.cfg.j2 | 6 ++++++ 5 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 templates/etc/xymon/clientlaunch.d/apt.cfg.j2 diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fcae1c..ed8be90 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,12 +3,13 @@ ## Enhancements * Ensure to not override groups of 'xymon' user. +* Add possibility to install `apt` plugin dependencies. ## v1.1 ## Enhancements -* Add possibility to install `mq` dependancies. -* Add possibility to install `libs` dependancies. +* Add possibility to install `mq` plugin dependencies. +* Add possibility to install `libs` plugin dependencies. * Add whitelist settings for `libs` plugin. ## v1.0.1 diff --git a/README.md b/README.md index f7a27b0..813cb11 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,10 @@ Manage Xymon (client) installation and configuration. * **xymon_cli_service_enabled** : Set `xymon-client` service available at startup [default : `true`]. * **xymon_srv_list** : The list of Xymon servers (you must give an hostname, IP,… reachable from any clients) [defaults : `monitoring.{{ ansible_domain }}`]. * **xymon_plug_manage** : If this role should manage plugins configuration [default : `true`]. +* **xymon_plug_apt_state** : The state of plugin `apt` [default : `true`]. +* **xymon_plug_apt_package** : The packages to install to provide `apt` plugin [default : `[ 'libtimedate-perl' ]`]. +* **xymon_plug_apt_path** : Configuration file for the `apt` plugin [default : `/etc/xymon/clientlaunch.d/apt.cfg`]. +* **xymon_plug_apt_tpl** : Template used to generate the previous config file [default : `etc/xymon/clientlaunch.d/apt.cfg.j2`]. * **xymon_plug_mq_state** : The state of plugin `mq` [default : `true`]. * **xymon_plug_mq_package** : The packages to install to provide `mq` plugin [default : `[ 'libtimedate-perl' ]`]. * **xymon_plug_mq_path** : Configuration file for the `mq` plugin [default : `/etc/xymon/clientlaunch.d/mq.cfg`]. @@ -65,6 +69,7 @@ This role will : ## Plugins Some plugins and options can be managed with this role : +* apt : Check state of packages and repositories. * libs : Check for running processes with upgraded libraries. * mq : Check mail queue. diff --git a/defaults/main.yml b/defaults/main.yml index f4e172d..b68593e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -23,6 +23,14 @@ xymon_srv_list: "monitoring.{{ ansible_domain }}" # plugins {{{ xymon_plug_manage: true +## apt {{{ +xymon_plug_apt_state: True +xymon_plug_apt_package: [ 'dctrl-tools' ] +xymon_plug_apt_path: '/etc/xymon/clientlaunch.d/apt.cfg' +xymon_plug_apt_tpl: 'etc/xymon/clientlaunch.d/apt.cfg.j2' + +## }}} + ## mq {{{ xymon_plug_mq_state: true xymon_plug_mq_package: [ 'libtimedate-perl' ] diff --git a/tasks/main.yml b/tasks/main.yml index 2d9bd46..3d35cd9 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -45,6 +45,25 @@ # }}} # plugins {{{ +- name: PLUGIN apt packages + package: + name: '{{ item }}' + state: '{{ "present" if xymon_plug_apt_state else "absent" }}' + with_items: + - '{{ xymon_plug_apt_package }}' + when: xymon_plug_manage + notify: restart xymon-client service + +- name: PLUGIN apt + template: + src: '{{ xymon_plug_apt_tpl }}' + dest: '{{ xymon_plug_apt_path }}' + owner: root + group: root + mode: 0644 + when: xymon_plug_manage + notify: restart xymon-client service + - name: PLUGIN mq packages package: name: '{{ item }}' diff --git a/templates/etc/xymon/clientlaunch.d/apt.cfg.j2 b/templates/etc/xymon/clientlaunch.d/apt.cfg.j2 new file mode 100644 index 0000000..cc48dca --- /dev/null +++ b/templates/etc/xymon/clientlaunch.d/apt.cfg.j2 @@ -0,0 +1,6 @@ +[apt] + {{ '#DISABLED' if xymon_plug_apt_state else 'DISABLED' }} + ENVFILE /etc/xymon/xymonclient.cfg + CMD $XYMONCLIENTHOME/ext/apt + LOGFILE /var/log/xymon/xymonclient.log + INTERVAL 5m