diff --git a/munin/README.md b/munin/README.md new file mode 100644 index 00000000..0c531bac --- /dev/null +++ b/munin/README.md @@ -0,0 +1,11 @@ +# munin + +Installation de Munin et changement de quelques plugins. + +## Taches + +L'ensemble des actions est dans le fichier `tasks/main.yml` + +## Variables possibles + +Les seules variables sont liées au hostname (court et complet) qui sont simplement déduites des facts. diff --git a/munin/handlers/main.yml b/munin/handlers/main.yml new file mode 100644 index 00000000..0b7f394e --- /dev/null +++ b/munin/handlers/main.yml @@ -0,0 +1,5 @@ +--- +- name: restart munin-node + service: + name: munin-node + state: restarted diff --git a/munin/tasks/main.yml b/munin/tasks/main.yml new file mode 100644 index 00000000..a4a73e65 --- /dev/null +++ b/munin/tasks/main.yml @@ -0,0 +1,71 @@ +--- + +- name: Ensure that Munin is installed + apt: + name: '{{ item }}' + state: installed + with_items: + - munin + - munin-node + - munin-plugins-core + - munin-plugins-extra + tags: + - munin + +- block: + - name: Replace localdomain in Munin config + replace: + dest: /etc/munin/munin.conf + regexp: 'localhost.localdomain' + replace: '{{ ansible_fqdn }}' + notify: restart munin-node + + - name: Rename the localdomain data dir + command: mv /var/lib/munin/localdomain /var/lib/munin/{{ ansible_domain }} + args: + creates: /var/lib/munin/{{ ansible_domain }} + removes: /var/lib/munin/localdomain + notify: restart munin-node + + when: not ansible_hostname == "localdomain" + tags: + - munin + +- name: Ensure some Munin plugins are disabled + file: + path: '/etc/munin/plugins/{{ item }}' + state: absent + with_items: + - http_loadtime + - exim_mailqueue + - exim_mailstats + - nfsd + - nfsd4 + - nfs_client + - nfs4_client + notify: restart munin-node + tags: + - munin + +- name: Ensure some Munin plugins are enabled + file: + src: "/usr/share/munin/plugins/{{ item }}" + dest: "/etc/munin/plugins/{{ item }}" + state: link + with_items: + - meminfo + - netstat_multi + - tcp + notify: restart munin-node + tags: + - munin + +- name: Enable sensors plugin unless VM detected + file: + src: /usr/share/munin/plugins/sensors_ + dest: /etc/munin/plugins/sensors_temp + state: link + when: not ansible_virtualization_role == "guest" + notify: restart munin-node + tags: + - munin