From 8ea958fa4ea2eb26e05ed1e352c90f108dd710f6 Mon Sep 17 00:00:00 2001 From: Michael Grote Date: Mon, 27 May 2024 10:55:54 +0200 Subject: [PATCH] mail: set FROM address --- roles/mgrote_cv4pve_autosnap/templates/cv4pve_mail.service.j2 | 2 +- roles/mgrote_postfix/handlers/main.yml | 2 +- roles/mgrote_youtubedl/templates/youtubedl_mail.service.j2 | 2 +- roles/mgrote_zfs_sanoid/templates/sanoid_mail.service.j2 | 2 +- roles/mgrote_zfs_sanoid/templates/syncoid_mail.service.j2 | 2 +- roles/mgrote_zfs_scrub/templates/zpool-scrub-mail.service.j2 | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/roles/mgrote_cv4pve_autosnap/templates/cv4pve_mail.service.j2 b/roles/mgrote_cv4pve_autosnap/templates/cv4pve_mail.service.j2 index 691cc4e6..db58fddf 100644 --- a/roles/mgrote_cv4pve_autosnap/templates/cv4pve_mail.service.j2 +++ b/roles/mgrote_cv4pve_autosnap/templates/cv4pve_mail.service.j2 @@ -4,4 +4,4 @@ Description=Send a Mail in case of an error in cv4pve.service. [Service] Type=oneshot -ExecStart=/bin/bash -c '/bin/systemctl status cv4pve.service | mail -s "[ERROR] cv4pve - %H" {{ my_mail }}' +ExecStart=/bin/bash -c '/bin/systemctl status cv4pve.service | mail -aFROM:cv4pve-autosnap@mgrote.net -s "[ERROR] cv4pve - %H" {{ my_mail }}' diff --git a/roles/mgrote_postfix/handlers/main.yml b/roles/mgrote_postfix/handlers/main.yml index 3413daae..c0ac8ef2 100644 --- a/roles/mgrote_postfix/handlers/main.yml +++ b/roles/mgrote_postfix/handlers/main.yml @@ -9,5 +9,5 @@ - name: send testmail # noqa no-changed-when ansible.builtin.shell: - cmd: "set -o pipefail && echo 'postfix ist eingerichtet' | mail -s '{{ ansible_hostname }} - postfix' {{ my_mail }}" + cmd: "set -o pipefail && echo 'postfix ist eingerichtet' | mail -aFROM:postfix@mgrote.net -s '{{ ansible_hostname }} - postfix' {{ my_mail }}" executable: /bin/bash diff --git a/roles/mgrote_youtubedl/templates/youtubedl_mail.service.j2 b/roles/mgrote_youtubedl/templates/youtubedl_mail.service.j2 index 7ff89dce..1d599790 100644 --- a/roles/mgrote_youtubedl/templates/youtubedl_mail.service.j2 +++ b/roles/mgrote_youtubedl/templates/youtubedl_mail.service.j2 @@ -5,4 +5,4 @@ Description=Send a Mail in case of an error in youtubedl.service. [Service] Type=oneshot -ExecStart=/bin/bash -c '/bin/systemctl status youtubedl.service | mail -s "[ERROR] youtubedl" {{ my_mail }}' +ExecStart=/bin/bash -c '/bin/systemctl status youtubedl.service | mail -aFROM:youtubedl@mgrote.net -s "[ERROR] youtubedl" {{ my_mail }}' diff --git a/roles/mgrote_zfs_sanoid/templates/sanoid_mail.service.j2 b/roles/mgrote_zfs_sanoid/templates/sanoid_mail.service.j2 index 8abcd298..3c3a9727 100644 --- a/roles/mgrote_zfs_sanoid/templates/sanoid_mail.service.j2 +++ b/roles/mgrote_zfs_sanoid/templates/sanoid_mail.service.j2 @@ -5,4 +5,4 @@ Description=Send a Mail in case of an error in sanoid.service. [Service] Type=oneshot -ExecStart=/bin/bash -c '/bin/systemctl status sanoid.service | mail -s "[ERROR] sanoid - %H" {{ my_mail }}' +ExecStart=/bin/bash -c '/bin/systemctl status sanoid.service | mail -aFROM:sanoid@mgrote.net -s "[ERROR] sanoid - %H" {{ my_mail }}' diff --git a/roles/mgrote_zfs_sanoid/templates/syncoid_mail.service.j2 b/roles/mgrote_zfs_sanoid/templates/syncoid_mail.service.j2 index 57846710..caa59b24 100644 --- a/roles/mgrote_zfs_sanoid/templates/syncoid_mail.service.j2 +++ b/roles/mgrote_zfs_sanoid/templates/syncoid_mail.service.j2 @@ -5,4 +5,4 @@ Description=Send a Mail for sanoid service after error or success sanoid.service [Service] Type=oneshot -ExecStart=/bin/bash -c '/usr/bin/journalctl -u syncoid.service -n 30 | mail -s "syncoid - %H" {{ my_mail }}' +ExecStart=/bin/bash -c '/usr/bin/journalctl -u syncoid.service -n 30 | mail -aFROM:syncoid@mgrote.net -s "syncoid - %H" {{ my_mail }}' diff --git a/roles/mgrote_zfs_scrub/templates/zpool-scrub-mail.service.j2 b/roles/mgrote_zfs_scrub/templates/zpool-scrub-mail.service.j2 index 885bfee2..c456a851 100644 --- a/roles/mgrote_zfs_scrub/templates/zpool-scrub-mail.service.j2 +++ b/roles/mgrote_zfs_scrub/templates/zpool-scrub-mail.service.j2 @@ -5,4 +5,4 @@ Description=Send a Mail in case of an error in zpool-scrub@.service. [Service] Type=oneshot -ExecStart=/bin/bash -c '{{ zfs_extra_path_zpool }} status | mail -s "[ERROR] zpool scrub - %H" {{ my_mail }}' +ExecStart=/bin/bash -c '{{ zfs_extra_path_zpool }} status | mail -aFROM:zpool-scrub@mgrote.net -s "[ERROR] zpool scrub - %H" {{ my_mail }}'