homeserver/roles/mgrote.munin-node/tasks/main.yml

56 lines
1.4 KiB
YAML
Raw Normal View History

---
- name: install packages
apt:
name: munin-node
state: present
register: install
- name: Copy munin-node configuration.
template:
src: munin-node.conf.j2
dest: /etc/munin/munin-node.conf
owner: root
group: root
mode: 0644
notify: restart munin-node
- name: Generate plugin configuration.
template:
src: plugin-conf.j2
dest: /etc/munin/plugin-conf.d/ansible.conf
owner: root
group: root
mode: 0644
notify: restart munin-node
- name: Install additional plugins.
get_url:
url: "{{ item.src }}"
dest: "{{ munin_plugin_src_path }}{{ item.name }}"
mode: '0755'
loop: "{{ munin_node_additional_plugins }}"
when: (item.src is defined) and (item.name is defined)
- name: Enable additional plugins.
file:
src: "{{ munin_plugin_src_path }}{{ item.name }}"
dest: "{{ munin_plugin_dest_path }}{{ item.name }}"
state: link
loop: "{{ munin_node_additional_plugins }}"
notify: restart munin-node
when: item.name is defined
- name: disable unwanted plugins
file:
path: "{{ munin_plugin_dest_path }}{{ item.name }}"
state: absent
loop: "{{ munin_node_disabled_plugins }}"
notify: restart munin-node
when: item.name is defined
- name: Ensure munin-node is running.
service:
name: munin-node
state: started
enabled: yes