aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Joe Banks <[email protected]>2024-08-30 18:54:59 +0100
committerGravatar Joe Banks <[email protected]>2024-08-30 18:54:59 +0100
commitd2276e05edf72c05aa3bd228ebce8f0f0e0cf587 (patch)
tree64223ff9c7deb2a5f027946931635d23313949d1
parentAdd scraping config to munin master against all Ansible hosts (diff)
Update munin-node config template to allow scraping from any host
-rw-r--r--ansible/roles/munin-node/templates/munin-node.conf.j29
1 files changed, 8 insertions, 1 deletions
diff --git a/ansible/roles/munin-node/templates/munin-node.conf.j2 b/ansible/roles/munin-node/templates/munin-node.conf.j2
index 4e89883..bdd3cec 100644
--- a/ansible/roles/munin-node/templates/munin-node.conf.j2
+++ b/ansible/roles/munin-node/templates/munin-node.conf.j2
@@ -1,8 +1,11 @@
# Managed by Ansible
log_level 4
+
+{% if ansible_distribution == 'Debian' %}
log_file /var/log/munin/munin-node.log
pid_file /var/run/munin/munin-node.pid
+{% endif %}
background 1
setsid 1
@@ -42,6 +45,10 @@ host_name {{ ansible_fqdn }}
allow ^127\.0\.0\.1$
allow ^::1$
+{% for host in hostvars %}
+allow ^{{ hostvars[host]['ansible_wg0']['ipv4']['address'] | regex_replace('\.', '\\.') }}$
+{% endfor %}
+
# If you have installed the Net::CIDR perl module, you can use one or more
# cidr_allow and cidr_deny address/mask patterns. A connecting client must
# match any cidr_allow, and not match any cidr_deny. Note that a netmask
@@ -55,7 +62,7 @@ allow ^::1$
# Which address to bind to;
# host *
-host 127.0.0.1
+host {{ ansible_wg0.ipv4.address }}
# And which port
port 4949