Try to send Email with database backup.

This commit is contained in:
2024-02-24 10:37:50 +01:00
parent b089f31b6d
commit a8fa28d1a0
2 changed files with 26 additions and 0 deletions

View File

@@ -57,6 +57,24 @@
loop_control:
label: "{{ item.key }}"
- name: Sending Email
community.general.mail:
host: smtp.vodafonemail.de
port: 465
username: christiansteinle@arcor.de
password: "{{ mail-password }}"
to: {{ item.value.email }}
subject: Datenbank Backup
body: System {{ ansible_hostname }} has been successfully provisioned.
attach:
- {{ backup_dir }}/{{ item }}/db-{{ ansible_date_time.iso8601_basic_short }}.sql.gz
delegate_to: localhost
when: item.value.email is defined
loop: "{{ lookup('dict', customers) }}"
loop_control:
label: "{{ item.key }}"
- name: Clean backup directory
file:
path: "{{ backup_dir }}"