Try to send Email with database backup.
This commit is contained in:
@@ -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 }}"
|
||||
|
||||
Reference in New Issue
Block a user