From 7eaac7e803c317c75da7180a39a6b95fdc6fd357 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gardais=20J=C3=A9r=C3=A9my?= Date: Thu, 5 Mar 2020 15:23:29 +0100 Subject: [PATCH] Get latest version of SMART's scripts with URL --- CHANGELOG.md | 5 +++++ README.md | 2 ++ defaults/main.yml | 2 ++ tasks/main.yml | 35 +++++++++++++++++++++++++++++++---- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dba11a4..64e6453 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## v1.x.y + +### Enhancements +* Possibility to define URLs in order to get the latest version of SMART's scripts. + ## v1.4.0 ### Enhancements diff --git a/README.md b/README.md index 6c3a8a9..45795b9 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,7 @@ For more features, see the next Smart plugin. * **xymon_cli__plug_smartoverall_package** : The packages to install to provide `smartoverall` plugin [default : `[ 'smartmontools' ]`]. * **xymon_cli__plug_smartoverall_script_path** : Path to the `smartoverall` script [default : `'/usr/lib/xymon/client/ext/smartoverall'`]. * **xymon_cli__plug_smartoverall_script_tpl** : Template used to generate the previous script [default : `'usr/lib/xymon/client/ext/smartoverall.j2'`]. +* **xymon_cli__plug_smartoverall_script_url** : Use a remote file to get the previous script instead of a template [default : `''`]. * **xymon_cli__plug_smartoverall_path** : Configuration file for the `smartoverall` plugin [default : `'/etc/xymon/clientlaunch.d/smartoverall.cfg'`]. * **xymon_cli__plug_smartoverall_tpl** : Template used to generate the previous config file [default : `'etc/xymon/clientlaunch.d/smartoverall.cfg.j2'`]. * **xymon_cli__plug_smartoverall_interval** : Time between each run of the `smartoverall` plugin [default : `'10m'`] @@ -120,6 +121,7 @@ one's recommended by the vendor and check a recent (<24h) test was done. * **xymon_cli__plug_smart_package** : The packages to install to provide `smart` plugin [default : `[ 'smartmontools' ]`]. * **xymon_cli__plug_smart_script_path** : Path to the `smart` script [default : `'/usr/lib/xymon/client/ext/smart'`]. * **xymon_cli__plug_smart_script_tpl** : Template used to generate the previous script [default : `'usr/lib/xymon/client/ext/smart.j2'`]. +* **xymon_cli__plug_smart_script_url** : Use a remote file to get the previous script instead of a template [default : `''`]. * **xymon_cli__plug_smart_path** : Configuration file for the `smart` plugin [default : `'/etc/xymon/clientlaunch.d/smart.cfg'`]. * **xymon_cli__plug_smart_tpl** : Template used to generate the previous config file [default : `'etc/xymon/clientlaunch.d/smart.cfg.j2'`]. * **xymon_cli__plug_smart_interval** : Time between each run of the `smart` plugin [default : `'10m'`] diff --git a/defaults/main.yml b/defaults/main.yml index 1609338..a03057e 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -114,6 +114,7 @@ xymon_cli__plug_smartoverall_state: False xymon_cli__plug_smartoverall_package: [ 'smartmontools' ] xymon_cli__plug_smartoverall_script_path: '/usr/lib/xymon/client/ext/smartoverall' xymon_cli__plug_smartoverall_script_tpl: 'usr/lib/xymon/client/ext/smartoverall.j2' +xymon_cli__plug_smartoverall_script_url: '' xymon_cli__plug_smartoverall_path: '/etc/xymon/clientlaunch.d/smartoverall.cfg' xymon_cli__plug_smartoverall_tpl: 'etc/xymon/clientlaunch.d/smartoverall.cfg.j2' xymon_cli__plug_smartoverall_interval: '10m' @@ -125,6 +126,7 @@ xymon_cli__plug_smart_state: False xymon_cli__plug_smart_package: [ 'smartmontools' ] xymon_cli__plug_smart_script_path: '/usr/lib/xymon/client/ext/smart' xymon_cli__plug_smart_script_tpl: 'usr/lib/xymon/client/ext/smart.j2' +xymon_cli__plug_smart_script_url: '' xymon_cli__plug_smart_path: '/etc/xymon/clientlaunch.d/smart.cfg' xymon_cli__plug_smart_tpl: 'etc/xymon/clientlaunch.d/smart.cfg.j2' xymon_cli__plug_smart_interval: '10m' diff --git a/tasks/main.yml b/tasks/main.yml index 54cdf0e..4b48186 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -222,7 +222,7 @@ xymon_plug_manage|bool) notify: restart xymon-client service -- name: PLUGIN smartoverall script file +- name: PLUGIN smartoverall script file from template template: src: '{{ xymon_cli__plug_smartoverall_script_tpl }}' dest: '{{ xymon_cli__plug_smartoverall_script_path }}' @@ -230,7 +230,20 @@ group: xymon mode: 0755 when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) + xymon_plug_manage|bool and + xymon_cli__plug_smartoverall_script_url|length == 0 ) + notify: restart xymon-client service + +- name: PLUGIN smartoverall script file from URL + get_url: + url: '{{ xymon_cli__plug_smartoverall_script_url }}' + dest: '{{ xymon_cli__plug_smartoverall_script_path }}' + owner: root + group: xymon + mode: 0755 + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool and + xymon_cli__plug_smartoverall_script_url|length > 0 ) notify: restart xymon-client service # Manage smart plugin [[[1 @@ -258,7 +271,7 @@ xymon_plug_manage|bool) notify: restart xymon-client service -- name: PLUGIN smart script file +- name: PLUGIN smart script file from template template: src: '{{ xymon_cli__plug_smart_script_tpl }}' dest: '{{ xymon_cli__plug_smart_script_path }}' @@ -266,9 +279,23 @@ group: xymon mode: 0755 when: (xymon_cli_manage|bool and - xymon_plug_manage|bool) + xymon_plug_manage|bool and + xymon_cli__plug_smart_script_url|length == 0 ) notify: restart xymon-client service +- name: PLUGIN smart script file from URL + get_url: + url: '{{ xymon_cli__plug_smart_script_url }}' + dest: '{{ xymon_cli__plug_smart_script_path }}' + owner: root + group: xymon + mode: 0755 + when: (xymon_cli_manage|bool and + xymon_plug_manage|bool and + xymon_cli__plug_smart_script_url|length > 0 ) + notify: restart xymon-client service + + # Manage zfs plugin [[[1 - name: PLUGIN zfs config file template: