Combine packages vars of all enabled plugins

This leads to install dependencies in one task instead of 9.
This commit is contained in:
Jeremy Gardais 2020-11-03 10:09:48 +01:00
parent 1c0157dd68
commit 6401a1e836
Signed by: jegardai
GPG Key ID: E759BAA22501AF32
4 changed files with 24 additions and 111 deletions

View File

@ -8,6 +8,7 @@
* Remove unecessary netstats dependencies (due to a previous misunderstanding) * Remove unecessary netstats dependencies (due to a previous misunderstanding)
between `net` and `netstats` probes. `netstats` only between `net` and `netstats` probes. `netstats` only
reads /proc/net/{netstat,snmp} files. reads /proc/net/{netstat,snmp} files.
* Combine packages vars of all enabled plugins to install them in _one_ task.
## v1.5.1 ## v1.5.1

View File

@ -28,6 +28,7 @@ Manage Xymon (client) installation and configuration.
* **xymon_cli_service_enabled**: Set `xymon-client` service available at startup [default: `true`]. * **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_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_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 ### Plugins Variables

View File

@ -186,5 +186,20 @@ xymon_cli__plug_zfs_interval: '5m'
# ]]] # ]]]
# .. envvar:: xymon_cli__plug_combined_packages [[[
#
# Combined packages vars of all enabled plugins.
#
xymon_cli__plug_combined_packages: '{{ ((xymon_plug_apt_package if xymon_plug_apt_state|bool else [])
+ (xymon_cli__plug_ipmi_package if xymon_cli__plug_ipmi_state|bool else [])
+ (xymon_plug_libs_package if xymon_plug_libs_state|bool else [])
+ (xymon_cli__plug_megaraid_package if xymon_cli__plug_megaraid_state|bool else [])
+ (xymon_plug_mq_package if xymon_plug_mq_state|bool else [])
+ (xymon_cli__plug_net_package if xymon_cli__plug_net_state|bool else [])
+ (xymon_cli__plug_smartoverall_package if xymon_cli__plug_smartoverall_state|bool else [])
+ (xymon_cli__plug_smart_package if xymon_cli__plug_smart_state|bool else [])
+ (xymon_cli__plug_temp_package if xymon_cli__plug_temp_state|bool else []))
| sort | unique }}'
# ]]]
# ]]] # ]]]
# ]]] # ]]]

View File

@ -50,20 +50,20 @@
when: (xymon_cli_manage|bool and when: (xymon_cli_manage|bool and
xymon_cli_service_manage|bool) xymon_cli_service_manage|bool)
# Manage apt plugin [[[1 # Manage all plugins's dependencies [[[1
- name: PLUGIN apt packages - name: PLUGINS dependencies
package: package:
name: '{{ item }}' name: '{{ item }}'
state: 'present' state: 'present'
with_items: with_items:
- '{{ xymon_plug_apt_package | to_nice_json }}' - '{{ xymon_cli__plug_combined_packages | to_nice_json }}'
when: (xymon_cli_manage|bool and when: (xymon_cli_manage|bool and
xymon_plug_manage|bool and xymon_plug_manage|bool)
xymon_plug_apt_state|bool) register: combined_packages_plug_result
register: apt_plug_result until: combined_packages_plug_result is success
until: apt_plug_result is success
notify: restart xymon-client service notify: restart xymon-client service
# Manage apt plugin [[[1
- name: PLUGIN apt - name: PLUGIN apt
template: template:
src: '{{ xymon_plug_apt_tpl }}' src: '{{ xymon_plug_apt_tpl }}'
@ -87,19 +87,6 @@
notify: restart xymon-client service notify: restart xymon-client service
# Manage ipmi plugin [[[1 # Manage ipmi plugin [[[1
- name: PLUGIN ipmi packages
package:
name: '{{ item }}'
state: 'present'
with_items:
- '{{ xymon_cli__plug_ipmi_package | to_nice_json }}'
register: ipmi_plug_result
until: ipmi_plug_result is success
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool and
xymon_cli__plug_ipmi_state|bool)
notify: restart xymon-client service
- name: PLUGIN ipmi - name: PLUGIN ipmi
template: template:
src: '{{ xymon_cli__plug_ipmi_tpl }}' src: '{{ xymon_cli__plug_ipmi_tpl }}'
@ -112,19 +99,6 @@
notify: restart xymon-client service notify: restart xymon-client service
# Manage libs plugin [[[1 # Manage libs plugin [[[1
- name: PLUGIN libs packages
package:
name: '{{ item }}'
state: 'present'
with_items:
- '{{ xymon_plug_libs_package | to_nice_json }}'
register: libs_plug_result
until: libs_plug_result is success
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool and
xymon_plug_libs_state|bool)
notify: restart xymon-client service
- name: PLUGIN libs - name: PLUGIN libs
template: template:
src: '{{ xymon_plug_libs_tpl }}' src: '{{ xymon_plug_libs_tpl }}'
@ -148,19 +122,6 @@
notify: restart xymon-client service notify: restart xymon-client service
# Manage megaraid plugin [[[1 # Manage megaraid plugin [[[1
- name: PLUGIN megaraid packages
package:
name: '{{ item }}'
state: 'present'
with_items:
- '{{ xymon_cli__plug_megaraid_package | to_nice_json }}'
register: megaraid_plug_result
until: megaraid_plug_result is success
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool and
xymon_cli__plug_megaraid_state|bool)
notify: restart xymon-client service
- name: PLUGIN megaraid - name: PLUGIN megaraid
template: template:
src: '{{ xymon_cli__plug_megaraid_tpl }}' src: '{{ xymon_cli__plug_megaraid_tpl }}'
@ -173,19 +134,6 @@
notify: restart xymon-client service notify: restart xymon-client service
# Manage mq plugin [[[1 # Manage mq plugin [[[1
- name: PLUGIN mq packages
package:
name: '{{ item }}'
state: 'present'
with_items:
- '{{ xymon_plug_mq_package | to_nice_json }}'
register: mq_plug_result
until: mq_plug_result is success
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool and
xymon_plug_mq_state|bool)
notify: restart xymon-client service
- name: PLUGIN mq - name: PLUGIN mq
template: template:
src: '{{ xymon_plug_mq_tpl }}' src: '{{ xymon_plug_mq_tpl }}'
@ -198,19 +146,6 @@
notify: restart xymon-client service notify: restart xymon-client service
# Manage net plugin [[[1 # Manage net plugin [[[1
- name: PLUGIN net packages
package:
name: '{{ item }}'
state: 'present'
with_items:
- '{{ xymon_cli__plug_net_package | to_nice_json }}'
register: net_plug_result
until: net_plug_result is success
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool and
xymon_cli__plug_net_state|bool)
notify: restart xymon-client service
- name: PLUGIN net - name: PLUGIN net
template: template:
src: '{{ xymon_cli__plug_net_tpl }}' src: '{{ xymon_cli__plug_net_tpl }}'
@ -282,19 +217,6 @@
notify: restart xymon-client service notify: restart xymon-client service
# Manage smartoverall plugin [[[1 # Manage smartoverall plugin [[[1
- name: PLUGIN smartoverall packages
package:
name: '{{ item }}'
state: 'present'
with_items:
- '{{ xymon_cli__plug_smartoverall_package | to_nice_json }}'
register: smartoverall_plug_result
until: smartoverall_plug_result is success
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool and
xymon_cli__plug_smartoverall_state|bool)
notify: restart xymon-client service
- name: PLUGIN smartoverall config - name: PLUGIN smartoverall config
template: template:
src: '{{ xymon_cli__plug_smartoverall_tpl }}' src: '{{ xymon_cli__plug_smartoverall_tpl }}'
@ -331,19 +253,6 @@
notify: restart xymon-client service notify: restart xymon-client service
# Manage smart plugin [[[1 # Manage smart plugin [[[1
- name: PLUGIN smart packages
package:
name: '{{ item }}'
state: 'present'
with_items:
- '{{ xymon_cli__plug_smart_package | to_nice_json }}'
register: smart_plug_result
until: smart_plug_result is success
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool and
xymon_cli__plug_smart_state|bool)
notify: restart xymon-client service
- name: PLUGIN smart config - name: PLUGIN smart config
template: template:
src: '{{ xymon_cli__plug_smart_tpl }}' src: '{{ xymon_cli__plug_smart_tpl }}'
@ -380,19 +289,6 @@
notify: restart xymon-client service notify: restart xymon-client service
# Manage temp plugin [[[1 # Manage temp plugin [[[1
- name: PLUGIN temp packages
package:
name: '{{ item }}'
state: 'present'
with_items:
- '{{ xymon_cli__plug_temp_package | to_nice_json }}'
register: temp_plug_result
until: temp_plug_result is success
when: (xymon_cli_manage|bool and
xymon_plug_manage|bool and
xymon_cli__plug_temp_state|bool)
notify: restart xymon-client service
- name: PLUGIN temp - name: PLUGIN temp
template: template:
src: '{{ xymon_cli__plug_temp_tpl }}' src: '{{ xymon_cli__plug_temp_tpl }}'