diff --git a/roles/munin-client/tasks/hypervisors.yml b/roles/munin-client/tasks/hypervisors.yml new file mode 100644 index 0000000..3424192 --- /dev/null +++ b/roles/munin-client/tasks/hypervisors.yml @@ -0,0 +1,13 @@ +- name: delete squid plugins + shell: + cmd: "rm -f /etc/munin/plugins/squid_*" + warn: False + notify: + - restart munin-node + +- name: delete lxc interfaces plugins + shell: + cmd: "rm -f /etc/munin/plugins/if_*veth* /etc/munin/plugins/if_*fw* /etc/munin/plugins/if_*vmbr*" + warn: False + notify: + - restart munin-node diff --git a/roles/munin-client/tasks/main.yml b/roles/munin-client/tasks/main.yml index 6dedb85..53dc918 100644 --- a/roles/munin-client/tasks/main.yml +++ b/roles/munin-client/tasks/main.yml @@ -27,6 +27,7 @@ when: munin_need_reconfigure ## Adding modules for specific functions +# for NginX webservers - name: install LWP::UserAgent package: name: libwww-perl @@ -35,6 +36,7 @@ - restart munin-node when: "'webservers' in group_names or 'loadbalancers' in group_names" +# for HAProxy servers - name: add HAProxy backend module file: src: /usr/share/munin/plugins/haproxy_ @@ -44,6 +46,7 @@ - restart munin-node when: "'loadbalancers' in group_names" +# For MariaDB servers - name: install Cache::Cache package: name: libcache-cache-perl @@ -52,6 +55,7 @@ - restart munin-node when: "'mariadbservers' in group_names" +# For PGSQL servers - name: install DBD::Pg package: name: libdbd-pg-perl @@ -60,7 +64,8 @@ - restart munin-node when: "'pgsqlservers' in group_names" -- name: "add specific nut value for {{ item }}" +# for NUT (UPS) servers +- name: "add specific nut value for UPS" file: path: "/etc/munin/plugins/nutups_eaton3s_{{ item }}" src: /usr/share/munin/plugins/nutups_ @@ -72,6 +77,11 @@ - charge - voltages +# for physical servers +- name: execute specific tasks for physical servers + include_tasks: physical_servers.yml + when: "'hypervisors' in group_names" + - name: reconfigure munin-node shell: cmd: munin-node-configure --shell | sh @@ -80,7 +90,7 @@ when: munin_need_reconfigure ## Useless junks for everyone -- name: "delete {{ item }}" +- name: delete useless junks for everyone file: path: "/etc/munin/plugins/{{ item }}" state: absent @@ -90,7 +100,7 @@ - users ## Useless junks for LXC -- name: "delete {{ item }} from LXC machines" +- name: "delete junks from LXC machines" file: path: "/etc/munin/plugins/{{ item }}" state: absent @@ -104,18 +114,6 @@ - irqstats ## Useless junks for hypervisors -- name: delete squid plugins - shell: - cmd: "rm -f /etc/munin/plugins/squid_*" - warn: False - notify: - - restart munin-node - when: "'hypervisors' in group_names" - -- name: delete lxc interfaces plugins - shell: - cmd: "rm -f /etc/munin/plugins/if_*veth* /etc/munin/plugins/if_*fw* /etc/munin/plugins/if_*vmbr*" - warn: False - notify: - - restart munin-node +- name: execute delete states for hypervisors + include_tasks: hypervisors.yml when: "'hypervisors' in group_names" diff --git a/roles/munin-client/tasks/physical_servers.yml b/roles/munin-client/tasks/physical_servers.yml new file mode 100644 index 0000000..c4d6746 --- /dev/null +++ b/roles/munin-client/tasks/physical_servers.yml @@ -0,0 +1,16 @@ +# for physical servers +- name: install necessary packages for hypervisors + package: + name: lm-sensors + state: present + +- name: configure specific munin plugin + file: + path: "/etc/munin/plugins/sensors_{{ item }}" + src: /usr/share/munin/plugins/sensors_ + state: link + notify: + - restart munin-node + loop: + - temp +