From b11036a080009efcf0fbe5e875a8ee921f866d09 Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Mon, 12 Aug 2024 13:13:37 +0200 Subject: [PATCH] dd --- roles/mgrote_munin_server/tasks/main.yml | 44 ++++++------------- .../templates/placeholder.html | 8 ++++ 2 files changed, 21 insertions(+), 31 deletions(-) create mode 100644 roles/mgrote_munin_server/templates/placeholder.html diff --git a/roles/mgrote_munin_server/tasks/main.yml b/roles/mgrote_munin_server/tasks/main.yml index 016f67ae..5ea07e57 100644 --- a/roles/mgrote_munin_server/tasks/main.yml +++ b/roles/mgrote_munin_server/tasks/main.yml @@ -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 - - - Munin - - - Munin has not run yet. Please try again in a few moments. - - -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 diff --git a/roles/mgrote_munin_server/templates/placeholder.html b/roles/mgrote_munin_server/templates/placeholder.html new file mode 100644 index 00000000..707a402a --- /dev/null +++ b/roles/mgrote_munin_server/templates/placeholder.html @@ -0,0 +1,8 @@ + + + Munin + + + Munin has not run yet. Please try again in a few moments. + +