homeserver/roles/mgrote.postfix-gmail/tasks/main.yml
mg 900f89c441 Rolle: Postfix parametrisiert (#2)
Merge branch 'master' into postfix

Housekeeping

Testmail nach postfix reload

Tag gmail in Playbook angepasst

Variable aus defaults in GroupVars übertragen

Keepass: nutzer_passwort --> gmail_nutzer_passwort

Beispiel Kennwort geändert

postfix_gmail_erlaubte_netzwerke --> gmail_postfix_erlaubte_netzwerke

smtp_use_tls --> gmail_smtp_use_tls

passwort_gmail --> gmail_nutzer_passwort

nutzer_gmail --> gmail_nutzer_gmail

smtp_server --> gmail_smtp_server

mail_nach_cronjob --> gmail_mail_nach_cronjob

Parameter eingebaut

Co-authored-by: Michael Grote <38253905+quotengrote@users.noreply.github.com>
Reviewed-on: mg/ansible#2
2020-12-14 15:06:04 +01:00

48 lines
1.2 KiB
YAML

### postfix fuer gmail; http://dokuwiki2.grote.lan/artikel/technik/postfix_mit_gmail_fuer_benachrichtigungen_einrichten
- name: postfix + Hilfsprogramme installieren
become: yes
ansible.builtin.apt:
name:
- postfix
- mailutils
- libsasl2-modules
state: present
- name: kopiere sasl_passwd
become: yes
ansible.builtin.template:
src: sasl_passwd
dest: /etc/postfix/sasl_passwd
force: yes
notify:
- create_db_passwordfile
- postfix_testmail
- name: kopiere postfix_main.cf
become: yes
ansible.builtin.template:
src: main.cf
dest: /etc/postfix/main.cf
notify:
- postfix_reload
- postfix_testmail
- name: Mail Cronjob - Anlegen
become: yes
when: gmail_mail_nach_cronjob # ohne parameter wird auf true geprueft https://www.buildahomelab.com/2018/11/12/using-ansible-when-statements/
ansible.builtin.cron:
name: MAILTO
env: yes
job: "{{ empfaenger_mail }}"
notify:
- postfix_testmail
- name: Mail Cronjob - Entfernen
become: yes
when: not gmail_mail_nach_cronjob
ansible.builtin.cron:
name: MAILTO
env: yes
job: ""