From d5bffb22521a931d936891a28b0c42bcf5558adf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Tue, 3 Nov 2020 13:31:35 +0100 Subject: [PATCH] Combine clientlaunch files for plugins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This leads to manage them in one dedicated task instead of 12… --- CHANGELOG.md | 3 +- README.md | 4 +- defaults/main.yml | 50 ++++++++++++++++- tasks/main.yml | 137 +++------------------------------------------- 4 files changed, 60 insertions(+), 134 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1204013..373fe19 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## v1.5.2 +## v2.X.Y ### Enhancements * Add megaraid probe management. @@ -9,6 +9,7 @@ between `net` and `netstats` probes. `netstats` only reads /proc/net/{netstat,snmp} files. * Combine packages vars of all enabled plugins to install them in _one_ task. +* Combine clientlaunch files for plugins to manage them in _one_ dedicated task. ## v1.5.1 diff --git a/README.md b/README.md index b83ee9c..5277576 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,12 @@ 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_cli__plug_combined_packages** : Combine packages vars of all enabled plugins defined below. ### Plugins Variables +* **xymon_cli__plug_combined_packages** : Combine packages vars of all enabled plugins defined below. +* **xymon_cli__plug_combined_clientlaunch** : Combine clientlaunch files for all plugins. + #### APT Variables for the APT plugin from hobbit-plugins. The plugin check for diff --git a/defaults/main.yml b/defaults/main.yml index 86b4202..4006064 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -70,6 +70,7 @@ xymon_cli__plug_ipmi_package: ['ipmitool'] xymon_cli__plug_ipmi_path: '/etc/xymon/clientlaunch.d/ipmi.cfg' xymon_cli__plug_ipmi_tpl: 'etc/xymon/clientlaunch.d/ipmi.cfg.j2' xymon_cli__plug_ipmi_interval: '5m' + ## ]]] ## Plugin libs [[[ xymon_plug_libs_state: true @@ -104,7 +105,7 @@ xymon_cli__plug_megaraid_package: [ 'libipc-run-perl' ] xymon_cli__plug_megaraid_path: '/etc/xymon/clientlaunch.d/megaraid.cfg' xymon_cli__plug_megaraid_tpl: 'etc/xymon/clientlaunch.d/megaraid.cfg.j2' xymon_cli__plug_megaraid_interval: '5m' -# + ## ]]] ## Plugin mq [[[ xymon_plug_mq_state: true @@ -112,6 +113,7 @@ xymon_plug_mq_package: ['libtimedate-perl'] xymon_plug_mq_path: '/etc/xymon/clientlaunch.d/mq.cfg' xymon_plug_mq_tpl: 'etc/xymon/clientlaunch.d/mq.cfg.j2' xymon_plug_mq_interval: '5m' + ## ]]] ## Plugin net [[[ xymon_cli__plug_net_state: false @@ -121,7 +123,7 @@ xymon_cli__plug_net_tpl: 'etc/xymon/clientlaunch.d/net.cfg.j2' xymon_cli__plug_net_interval: '5m' xymon_cli__plug_net_conf_path: '/etc/xymon/net.yaml' xymon_cli__plug_net_conf_tpl: 'etc/xymon/net.yaml.j2' -# + ## ]]] ## Plugin netstats [[[ xymon_cli__plug_netstats_state: false @@ -201,5 +203,49 @@ xymon_cli__plug_combined_packages: '{{ ((xymon_plug_apt_package if + (xymon_cli__plug_temp_package if xymon_cli__plug_temp_state|bool else [])) | sort | unique }}' # ]]] +# .. envvar:: xymon_cli__plug_combined_clientlaunch [[[ +# +# Combine clientlaunch files for all plugins +# +xymon_cli__plug_combined_clientlaunch: + - name: apt + path: '{{ xymon_plug_apt_path }}' + template: '{{ xymon_plug_apt_tpl }}' + - name: ipmi + path: '{{ xymon_cli__plug_ipmi_path }}' + template: '{{ xymon_cli__plug_ipmi_tpl }}' + - name: libs + path: '{{ xymon_plug_libs_path }}' + template: '{{ xymon_plug_libs_tpl }}' + - name: megaraid + path: '{{ xymon_cli__plug_megaraid_path }}' + template: '{{ xymon_cli__plug_megaraid_tpl }}' + - name: mq + path: '{{ xymon_plug_mq_path }}' + template: '{{ xymon_plug_mq_tpl }}' + - name: net + path: '{{ xymon_cli__plug_net_path }}' + template: '{{ xymon_cli__plug_net_tpl }}' + - name: netstats + path: '{{ xymon_cli__plug_netstats_path }}' + template: '{{ xymon_cli__plug_netstats_tpl }}' + - name: sge + path: '{{ xymon_cli__plug_sge_path }}' + template: '{{ xymon_cli__plug_sge_tpl }}' + - name: smartoverall + path: '{{ xymon_cli__plug_smartoverall_path }}' + template: '{{ xymon_cli__plug_smartoverall_tpl }}' + - name: smart + path: '{{ xymon_cli__plug_smart_path }}' + template: '{{ xymon_cli__plug_smart_tpl }}' + - name: temp + path: '{{ xymon_cli__plug_temp_path }}' + template: '{{ xymon_cli__plug_temp_tpl }}' + - name: zfs + path: '{{ xymon_cli__plug_zfs_path }}' + template: '{{ xymon_cli__plug_temp_tpl }}' + + # ]]] + # ]]] # ]]] diff --git a/tasks/main.yml b/tasks/main.yml index 44aca28..424d38a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -63,18 +63,21 @@ until: combined_packages_plug_result is success notify: restart xymon-client service -# Manage apt plugin [[[1 -- name: PLUGIN apt +# Manage plugins clientlaunch files [[[1 +- name: PLUGINS clientlaunch files template: - src: '{{ xymon_plug_apt_tpl }}' - dest: '{{ xymon_plug_apt_path }}' + src: '{{ item.template }}' + dest: '{{ item.path }}' owner: root group: root mode: 0644 + with_items: + - '{{ xymon_cli__plug_combined_clientlaunch }}' when: (xymon_cli_manage|bool and xymon_plug_manage|bool) notify: restart xymon-client service +# Manage apt plugin [[[1 - name: PLUGIN apt no_repo_accept whitelist template: src: 'etc/xymon/apt_no_repo_accept.j2' @@ -86,30 +89,7 @@ xymon_plug_manage|bool) notify: restart xymon-client service -# Manage ipmi plugin [[[1 -- name: PLUGIN ipmi - template: - src: '{{ xymon_cli__plug_ipmi_tpl }}' - dest: '{{ xymon_cli__plug_ipmi_path }}' - owner: root - group: root - mode: 0644 - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - # Manage libs plugin [[[1 -- name: PLUGIN libs - template: - src: '{{ xymon_plug_libs_tpl }}' - dest: '{{ xymon_plug_libs_path }}' - owner: root - group: root - mode: 0644 - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - - name: PLUGIN libs whitelist template: src: 'etc/xymon/libs.local.yaml.j2' @@ -121,42 +101,7 @@ xymon_plug_manage|bool) notify: restart xymon-client service -# Manage megaraid plugin [[[1 -- name: PLUGIN megaraid - template: - src: '{{ xymon_cli__plug_megaraid_tpl }}' - dest: '{{ xymon_cli__plug_megaraid_path }}' - owner: root - group: root - mode: 0644 - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - -# Manage mq plugin [[[1 -- name: PLUGIN mq - template: - src: '{{ xymon_plug_mq_tpl }}' - dest: '{{ xymon_plug_mq_path }}' - owner: root - group: root - mode: 0644 - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - # Manage net plugin [[[1 -- name: PLUGIN net - template: - src: '{{ xymon_cli__plug_net_tpl }}' - dest: '{{ xymon_cli__plug_net_path }}' - owner: root - group: root - mode: 0644 - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - - name: PLUGIN net config template template: src: '{{ xymon_cli__plug_net_conf_tpl }}' @@ -168,30 +113,7 @@ xymon_plug_manage|bool) notify: restart xymon-client service -# Manage netstats plugin [[[1 -- name: PLUGIN netstats config - template: - src: '{{ xymon_cli__plug_netstats_tpl }}' - dest: '{{ xymon_cli__plug_netstats_path }}' - owner: root - group: root - mode: 0644 - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - # Manage sge plugin [[[1 -- name: PLUGIN sge config - template: - src: '{{ xymon_cli__plug_sge_tpl }}' - dest: '{{ xymon_cli__plug_sge_path }}' - owner: root - group: root - mode: 0644 - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - - name: PLUGIN sge script file from template template: src: '{{ xymon_cli__plug_sge_script_tpl }}' @@ -217,17 +139,6 @@ notify: restart xymon-client service # Manage smartoverall plugin [[[1 -- name: PLUGIN smartoverall config - template: - src: '{{ xymon_cli__plug_smartoverall_tpl }}' - dest: '{{ xymon_cli__plug_smartoverall_path }}' - owner: root - group: root - mode: 0644 - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - - name: PLUGIN smartoverall script file from template template: src: '{{ xymon_cli__plug_smartoverall_script_tpl }}' @@ -253,17 +164,6 @@ notify: restart xymon-client service # Manage smart plugin [[[1 -- name: PLUGIN smart config - template: - src: '{{ xymon_cli__plug_smart_tpl }}' - dest: '{{ xymon_cli__plug_smart_path }}' - owner: root - group: root - mode: 0644 - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - - name: PLUGIN smart script file from template template: src: '{{ xymon_cli__plug_smart_script_tpl }}' @@ -288,30 +188,7 @@ xymon_cli__plug_smart_script_url|length > 0 ) notify: restart xymon-client service -# Manage temp plugin [[[1 -- name: PLUGIN temp - template: - src: '{{ xymon_cli__plug_temp_tpl }}' - dest: '{{ xymon_cli__plug_temp_path }}' - owner: root - group: root - mode: 0644 - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - # Manage zfs plugin [[[1 -- name: PLUGIN zfs config file - template: - src: '{{ xymon_cli__plug_zfs_tpl }}' - dest: '{{ xymon_cli__plug_zfs_path }}' - owner: root - group: root - mode: 0644 - when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) - notify: restart xymon-client service - - name: PLUGIN zfs script file template: src: '{{ xymon_cli__plug_zfs_script_tpl }}'