This commit is contained in:
Michael Grote 2024-08-12 13:13:37 +02:00
parent fe8211e2f1
commit b11036a080
2 changed files with 21 additions and 31 deletions

View file

@ -83,43 +83,25 @@ fi
# cronjoib? timer? TODO
# sed -i "s/\*\/5/\*\/5/g" /etc/cron.d/munin kommt imho aus paket
- name: check if munin has been run
ansible.builtin.stat:
path: /var/cache/munin/www/index.html
register: placeholder
- name: Template website placeholder
ansible.builtin.template:
src: placeholder.html
dest: /var/cache/munin/www/index.html
mode: '0644'
owner: munin
group: munin
when: not placeholder.stat.exists
# generate node list
NODES=${NODES:-}
for NODE in $NODES
do
NAME=`echo $NODE | cut -d ':' -f1`
HOST=`echo $NODE | cut -d ':' -f2`
grep -q "${HOST}$" /etc/munin/munin.conf || cat << EOF >> /etc/munin/munin.conf
[$NAME]
address $HOST
use_node_name yes
EOF
done
# placeholder html to prevent permission error
if [ ! -f /var/cache/munin/www/index.html ]; then
cat << EOF > /var/cache/munin/www/index.html
<html>
<head>
<title>Munin</title>
</head>
<body>
Munin has not run yet. Please try again in a few moments.
</body>
</html>
EOF
chown -R munin: /var/cache/munin/www/index.html
fi
# ensure munin folder exist and have right permission
mkdir -p /var/lib/munin/cgi-tmp /var/cache/munin/www
chown -R munin:munin /var/lib/munin /var/cache/munin

View file

@ -0,0 +1,8 @@
<html>
<head>
<title>Munin</title>
</head>
<body>
Munin has not run yet. Please try again in a few moments.
</body>
</html>