diff --git a/group_vars/all.yml b/group_vars/all.yml index 0b49676c..752a9919 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -7,7 +7,7 @@ gmail_mail_nach_cronjob: false gmail_smtp_server: smtp.gmail.com gmail_smtp_server_port: 587 - gmail_smtp_use_tls: yes + gmail_smtp_use_tls: "yes" ### mgrote.set_apt_sources acng_server: acng.grote.lan acng_server_port: 9999 diff --git a/roles/mgrote.restic/meta/main.yml b/roles/mgrote.restic/meta/main.yml new file mode 100644 index 00000000..b3cb6676 --- /dev/null +++ b/roles/mgrote.restic/meta/main.yml @@ -0,0 +1,3 @@ +--- + dependencies: + - role: mgrote.postfix-gmail diff --git a/roles/mgrote.restic/templates/restic_backup.sh b/roles/mgrote.restic/templates/restic_backup.sh index 931d99fe..f96a08b6 100644 --- a/roles/mgrote.restic/templates/restic_backup.sh +++ b/roles/mgrote.restic/templates/restic_backup.sh @@ -19,12 +19,18 @@ function unlock() { # Damit prueft ob das Script ob es schon laeuft exlock ( - echo "--------------------------------------------------" +echo "--------------------------------------------------" echo $(date) mount -t cifs -o credentials="/etc/restic/smb_password.txt",vers=3.0 {{ restic_repository }} {{ restic_mount }} restic -r {{ restic_mount }} --password-file /etc/restic/password.txt backup --exclude-file /etc/restic/exclude.txt {{ restic_folders_to_backup }} +# Mail wenn Restix Exit != 0 #https://stackoverflow.com/a/45817972 +retVal=$? +if [ $retVal -ne 0 ]; then + echo "ERROR - Restic - $HOSTNAME" | mail -s "ERROR - Restic - $HOSTNAME" {{ empfaenger_mail }} +fi + umount {{ restic_mount }} echo "--------------------------------------------------"