From 36ad021bd6c42511f54e4c8c1efe1fb11bfa7005 Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Mon, 12 Aug 2024 13:06:55 +0200 Subject: [PATCH] ff --- roles/mgrote_munin_server/defaults/main.yml | 7 ++++++ roles/mgrote_munin_server/tasks/main.yml | 17 ++++++++----- .../mgrote_munin_server/templates/munin.conf | 16 +++++++++--- .../mgrote_munin_server/templates/revaliases | 8 ------ .../mgrote_munin_server/templates/ssmtp.conf | 25 ------------------- 5 files changed, 30 insertions(+), 43 deletions(-) delete mode 100644 roles/mgrote_munin_server/templates/revaliases delete mode 100644 roles/mgrote_munin_server/templates/ssmtp.conf diff --git a/roles/mgrote_munin_server/defaults/main.yml b/roles/mgrote_munin_server/defaults/main.yml index 66184a14..a3e8e1c4 100644 --- a/roles/mgrote_munin_server/defaults/main.yml +++ b/roles/mgrote_munin_server/defaults/main.yml @@ -18,3 +18,10 @@ munin_servername: "{{ ansible_fwdn }}" munin_dirs: - /var/run/munin - /etc/munin/plugins +munin_server_plugins: + - munin_stats + - munin_update +munin_hosts: + - name: "{{ ansible_fqdn }}" + address: "127.0.0.1" + extra: ["use_node_name yes"] diff --git a/roles/mgrote_munin_server/tasks/main.yml b/roles/mgrote_munin_server/tasks/main.yml index 31aaad66..111642b5 100644 --- a/roles/mgrote_munin_server/tasks/main.yml +++ b/roles/mgrote_munin_server/tasks/main.yml @@ -36,16 +36,21 @@ mode: '0755' loop: "{{ munin_server_plugins }}" +- name: Template munin config + ansible.builtin.template: + src: munin.conf + dest: /etc/munin/munin.conf + mode: '0644' + owner: munin + group: munin - -COPY munin.conf /etc/munin/munin.conf -COPY ssmtp.conf /etc/ssmtp/ssmtp.conf -COPY revaliases /etc/ssmtp/revaliases -COPY munin_mail.conf /etc/munin/munin-conf.d/munin_mail.conf +# TODO mail config? wie senden? +# COPY munin_mail.conf /etc/munin/munin-conf.d/munin_mail.conf # launcher CMD ["/usr/local/bin/run"] COPY run.sh /usr/local/bin/run +chmod +x /usr/local/bin/run - chmod +x /usr/local/bin/run +# cronjoib? timer? diff --git a/roles/mgrote_munin_server/templates/munin.conf b/roles/mgrote_munin_server/templates/munin.conf index 014f5534..7ca92ef2 100644 --- a/roles/mgrote_munin_server/templates/munin.conf +++ b/roles/mgrote_munin_server/templates/munin.conf @@ -1,7 +1,15 @@ includedir /etc/munin/munin-conf.d -[munin-container] - address localhost - use_node_name yes +# Munin hosts. +{% for host in munin_hosts %} +[{{ host.name }}] +{% if host.address is defined %} + address {{ host.address }} +{% endif %} +{% if host.extra is defined %} +{% for extra in host.extra %} + {{ extra }} +{% endfor %} +{% endif %} -# remote host +{% endfor %} diff --git a/roles/mgrote_munin_server/templates/revaliases b/roles/mgrote_munin_server/templates/revaliases deleted file mode 100644 index 1f834110..00000000 --- a/roles/mgrote_munin_server/templates/revaliases +++ /dev/null @@ -1,8 +0,0 @@ -# sSMTP aliases -# -# Format: local_account:outgoing_address:mailhub -# -# Example: root:your_login@your.domain:mailhub.your.domain[:port] -# where [:port] is an optional port number that defaults to 25. -root:mailfrom:mailserver:mailport -munin:mailfrom:mailserver:mailport diff --git a/roles/mgrote_munin_server/templates/ssmtp.conf b/roles/mgrote_munin_server/templates/ssmtp.conf deleted file mode 100644 index e8ee9958..00000000 --- a/roles/mgrote_munin_server/templates/ssmtp.conf +++ /dev/null @@ -1,25 +0,0 @@ -# -# Config file for sSMTP sendmail -# -# The person who gets all mail for userids < 1000 -# Make this empty to disable rewriting. -root=mailuser - -# The place where the mail goes. The actual machine name is required no -# MX records are consulted. Commonly mailhosts are named mail.domain.com -mailhub=mailserver:mailport -AuthUser=mailuser -AuthPass=mailpassword -UseTLS=YES -UseSTARTTLS=YES - -# Where will the mail seem to come from? -rewriteDomain=maildomain - -# The full hostname -hostname=mailhost - -# Are users allowed to set their own From: address? -# YES - Allow the user to specify their own From: address -# NO - Use the system generated From: address -FromLineOverride=NO