---

- name: Check if Munin plugins exists
  stat:
    path: /etc/munin/plugins/
  register: munin_plugins_dir
  check_mode: no
  tags:
  - drbd

# https://raw.githubusercontent.com/munin-monitoring/contrib/master/plugins/drbd/drbd
- name: Get Munin plugin
  copy:
    src: munin/drbd-plugin
    dest: /etc/munin/plugins/drbd
    mode: "0755"
  when: munin_plugins_dir.stat.exists
  notify: restart munin-node
  tags:
  - drbd

- name: Copy Munin plugin conf
  copy:
    src: munin/drbd-config
    dest: /etc/munin/plugin-conf.d/drbd
    mode: "0644"
  when: munin_plugins_dir.stat.exists
  notify: restart munin-node
  tags:
  - drbd
