--- - name: Ensure that Munin is installed apt: name: - munin - munin-node - munin-plugins-core - munin-plugins-extra state: present tags: - munin - packages - 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 shell: "mv /var/lib/munin/localdomain /var/lib/munin/{{ ansible_domain }} && rename \"s/localhost.localdomain/{{ ansible_fqdn }}/\" /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 loop: - 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 loop: - meminfo - netstat_multi - tcp - postfix_mailqueue - postfix_mailstats - postfix_mailvolume 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: ansible_virtualization_role != "guest" notify: restart munin-node tags: - munin - name: adjustments for grsec kernel blockinfile: dest: /etc/munin/plugin-conf.d/munin-node marker: "# {mark} ANSIBLE MANAGED GRSECURITY CUSTOMIZATIONS" block: | [processes] user root [vmstat] user root [swap] user root when: ansible_kernel is search("-grs-")