infra/roles/munin_client/tasks/main.yml

60 lines
1.3 KiB
YAML
Raw Normal View History

2023-02-01 15:15:04 +00:00
---
- 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
- name: Remove native munin apt update
# It is no longer supported
# and raises errors.
# The doc tells to use APT::Periodic::Update-Package-Lists "1"; instead.
ansible.builtin.lineinfile:
path: /etc/cron.d/munin-node
state: absent
regexp: '/etc/munin/plugins/apt_all update'