---

- name: is Munin present ?
  stat:
    path: /etc/munin/plugin-conf.d/munin-node
  check_mode: no
  register: munin_node_plugins_config

- name: Munin plugins are present and configured
  block:
    - name: Install munin plugin
      copy:
        src: munin_plugin
        dest: /etc/munin/plugins/dovecot
        mode: "0755"

    - name: Install munin config
      copy:
        src: munin_config
        dest: /etc/munin/plugin-conf.d/dovecot
        mode: "0644"

  when: munin_node_plugins_config.stat.exists
