diff --git a/group_vars/munin.yml b/group_vars/munin.yml index 25b109ae..83388801 100644 --- a/group_vars/munin.yml +++ b/group_vars/munin.yml @@ -42,6 +42,7 @@ munin_node_bind_port: "4949" munin_node_allowed_cidrs: [127.0.0.1] ### mgrote_munin_master +munin_mode: cron # or cgi munin_mail_user: munin@mgrote.net munin_mail_server: "{{ postfix_smtp_server }}" munin_mail_port: "{{ 1025 }}" diff --git a/host_vars/pbs.mgrote.net.yml b/host_vars/pbs.mgrote.net.yml index 85e84a22..f9315299 100644 --- a/host_vars/pbs.mgrote.net.yml +++ b/host_vars/pbs.mgrote.net.yml @@ -68,6 +68,7 @@ zfs_extra_zfs_pools: ### mgrote_zfs_sanoid sanoid_snaps_enable: true + ## syncoid sanoid_syncoid_destination_host: true sanoid_syncoid_ssh_privkey: "{{ lookup('viczem.keepass.keepass', 'sanoid_syncoid_private_key', 'notes') }}" diff --git a/roles/mgrote_munin_server/defaults/main.yml b/roles/mgrote_munin_server/defaults/main.yml index 13509f1e..494f7465 100644 --- a/roles/mgrote_munin_server/defaults/main.yml +++ b/roles/mgrote_munin_server/defaults/main.yml @@ -6,12 +6,12 @@ munin_packages: - wget - libapache2-mod-fcgid - libcgi-fast-perl - - ssmtp - perl - mailutils - curl - tzdata - munin-node + - s-nail - libfile-readbackwards-perl munin_servername: "{{ ansible_fqdn }}.mgrote.net" munin_dirs: @@ -27,10 +27,6 @@ munin_cron_job: present munin_dbdir: "/var/lib/munin" munin_enable_alerts: false -munin_mail_server: mail.server.com -munin_mail_port: 25 -munin_mail_tls: false -munin_alerts_to: nobody@nowhere.com munin_mode: cgi # or cron diff --git a/roles/mgrote_munin_server/tasks/main.yml b/roles/mgrote_munin_server/tasks/main.yml index 7f605c54..0ae1e90a 100644 --- a/roles/mgrote_munin_server/tasks/main.yml +++ b/roles/mgrote_munin_server/tasks/main.yml @@ -75,12 +75,4 @@ owner: munin group: munin when: not placeholder.stat.exists - -- name: Template ssmtp config - ansible.builtin.template: - src: ssmtp.conf - dest: /etc/ssmtp/ssmtp.conf - mode: '0644' - owner: root - group: root ... diff --git a/roles/mgrote_munin_server/templates/munin.conf b/roles/mgrote_munin_server/templates/munin.conf index 1d8effa0..5924073b 100644 --- a/roles/mgrote_munin_server/templates/munin.conf +++ b/roles/mgrote_munin_server/templates/munin.conf @@ -91,7 +91,7 @@ html_strategy {{ munin_mode }} # something changes (OK -> WARNING, CRITICAL -> OK, etc) # test with: sudo -u munin /usr/share/munin/munin-limits --contact someuser --force {% if munin_enable_alerts is sameas true %} -contact.someuser.command mail -aFROM:munin@mgrote.net -s "Munin ${var:worst}: ${var:group}::${var:host}::${var:plugin}" {{ munin_alerts_to }} +contact.someuser.command s-nail --set=from='munin@mgrote.net' -s "Munin ${var:worst}: ${var:group}::${var:host}::${var:plugin}" {{ munin_alerts_to }} {% endif %} #contact.anotheruser.command mail -s "Munin ${var:worst}: ${var:group}::${var:host}::${var:plugin}" anotheruser@blibb.comm # diff --git a/roles/mgrote_munin_server/templates/ssmtp.conf b/roles/mgrote_munin_server/templates/ssmtp.conf deleted file mode 100644 index 27a5b091..00000000 --- a/roles/mgrote_munin_server/templates/ssmtp.conf +++ /dev/null @@ -1,12 +0,0 @@ -# The user that gets all the mails (UID < 1000, usually the admin) -root={{ munin_alerts_to }} - -# The mail server (where the mail is sent to), both port 465 or 587 should be acceptable -# See also https://support.google.com/mail/answer/78799 -mailhub={{ munin_mail_server }}:{{ munin_mail_port }} - -# The full hostname. Must be correctly formed, fully qualified domain name or GMail will reject connection. -hostname={{ munin_servername }} - -# Use implicit TLS (port 465). When using port 587, change UseSTARTTLS=Yes -UseTLS={{ munin_mail_tls }} diff --git a/roles/mgrote_zfs_sanoid/tasks/main.yml b/roles/mgrote_zfs_sanoid/tasks/main.yml index 32fce206..4e46c86f 100644 --- a/roles/mgrote_zfs_sanoid/tasks/main.yml +++ b/roles/mgrote_zfs_sanoid/tasks/main.yml @@ -19,6 +19,16 @@ deb: "{{ sanoid_deb_url }}" state: present +- name: Overwrite syncoid script from package + become: true + ansible.builtin.get_url: + url: https://raw.githubusercontent.com/jimsalterjrs/sanoid/master/syncoid + dest: /usr/bin/syncoid + mode: '0755' + owner: root + group: root + force: true + - name: create sanoid directories become: true ansible.builtin.file: diff --git a/roles/mgrote_zfs_sanoid/templates/syncoid.sh.j2 b/roles/mgrote_zfs_sanoid/templates/syncoid.sh.j2 index 6394ffae..68b2f752 100644 --- a/roles/mgrote_zfs_sanoid/templates/syncoid.sh.j2 +++ b/roles/mgrote_zfs_sanoid/templates/syncoid.sh.j2 @@ -8,5 +8,5 @@ # check if source host is reachable ping -c1 -W1 {{ item.source_host }} > /dev/null || {{ item.source_host }} not reachable! # syncoid -export HOME=/root ; /usr/bin/syncoid --compress=zstd-fast --sshoption=StrictHostKeyChecking=no --delete-target-snapshots --use-hold --preserve-recordsize --sshkey "/etc/sanoid/.ssh/id_sanoid" --source-bwlimit {{ sanoid_syncoid_bwlimit }} {{ sanoid_user }}@{{ item.source_host }}:{{ item.source_dataset }} {{ item.destination_dataset }} 2> /dev/null +export HOME=/root ; /usr/bin/syncoid --compress=zstd-fast --sshoption=StrictHostKeyChecking=no --delete-target-snapshots --use-hold --preserve-recordsize --sshkey "/etc/sanoid/.ssh/id_sanoid" --source-bwlimit {{ sanoid_syncoid_bwlimit }} {{ sanoid_user }}@{{ item.source_host }}:{{ item.source_dataset }} {{ item.destination_dataset }} {% endfor %}