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

72 lines
1.8 KiB
YAML
Raw Normal View History

---
- name: install packages
apt:
name: munin-node
state: present
register: install
- name: create directories
file:
path: "{{ item }}"
state: directory
loop:
- /etc/munin
- /etc/munin/plugin-conf.d
- /etc/munin/plugins
- 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: munin-node-configure --shell
ansible.builtin.shell: munin-node-configure --shell
register: output_conf
changed_when: "output_conf.rc != 0"
ignore_errors: yes # ignoriere fehler
when: install.changed
- 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