Files
ansible/email.yaml

26 lines
814 B
YAML

---
# This playbooks sends email for backups
- name: Send email for backups
hosts: all
gather_facts: false
tasks:
- name: Include email variables
include_vars: vars/email.yaml
- name: Send Email
community.general.mail:
host: mail.steinle-computer.de
port: 465
from: kontakt@steinle-computer.de (Christian Steinle)
username: kontakt@steinle-computer.de
password: "{{ mail_password }}"
to: "{{ item[1] }}"
subject: Datenbank Backup
body: Backup der Anwendung wurde erstellt.
attach:
- "{{ backup_location }}/{{ item[0].name }}/{{ item[0].database[0].container }}-{{ date }}.sql.gz"
loop: "{{ containers | subelements('email', skip_missing=true) }}"
loop_control:
label: "{{ item[1] }}"