infra/roles/munin_client/tasks/main.yml

63 lines
1.8 KiB
YAML

---
- name: apt install munin-node
apt:
state: present
name: munin-node
register: install_munin
- name: Configure munin node
shell: munin-node-configure --shell | grep -v ip_ | sh
when: install_munin is changed
notify: munin
- name: Copy munin-node.conf
copy:
dest: /etc/munin/munin-node.conf
content: |
log_level 4
log_file /var/log/munin/munin-node.log
pid_file /var/run/munin/munin-node.pid
background 1
setsid 1
user root
group root
ignore_file [\#~]$
ignore_file DEADJOE$
ignore_file \.bak$
ignore_file %$
ignore_file \.dpkg-(tmp|new|old|dist)$
ignore_file \.rpm(save|new)$
ignore_file \.pod$
{% for host in groups["muninservers"] %}
allow ^{{ hostvars[host]['ansible_facts']['default_ipv6']['address'] }}$
{% endfor %}
allow ^127.0.0.1$
host *
port 4949
notify: munin
- name: Setup apt_all plugin
file:
src: /usr/share/munin/plugins/apt_all
dest: /etc/munin/plugins/apt_all
state: link
notify: munin
when: ansible_facts["distribution"] == "Debian" and ansible_facts["distribution_release"] == "bullseye"
- name: Remove native munin apt update
# It does not work on Ubuntu, it's giving:
# E: The value 'stable' is invalid for APT::Default-Release as such a release is not available in the sources
# E: The value 'testing' is invalid for APT::Default-Release as such a release is not available in the sources
# E: The value 'unstable' is invalid for APT::Default-Release as such a release is not available in the sources
file:
path: /etc/munin/plugins/apt_all
state: absent
notify: munin
when: not(ansible_facts["distribution"] == "Debian" and ansible_facts["distribution_release"] == "bullseye")