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
This commit is contained in:
parent
8d5686bc38
commit
900f89c441
9 changed files with 24 additions and 19 deletions
|
@ -1,10 +1,13 @@
|
||||||
---
|
---
|
||||||
### mgrote.postfix-gmail
|
### mgrote.postfix-gmail
|
||||||
empfaenger_mail: michael.grote@posteo.de
|
empfaenger_mail: michael.grote@posteo.de
|
||||||
nutzer_gmail: michael.grote@gmail.com
|
gmail_nutzer_gmail: michael.grote@gmail.com
|
||||||
passwort_gmail: "{{ lookup('keepass', 'passwort_gmail', 'password') }}"
|
gmail_nutzer_passwort: "{{ lookup('keepass', 'gmail_nutzer_passwort', 'password') }}"
|
||||||
postfix_gmail_erlaubte_netzwerke: "127.0.0.0/8 192.168.2.0/24"
|
gmail_postfix_erlaubte_netzwerke: "127.0.0.0/8 192.168.2.0/24"
|
||||||
mail_nach_cronjob: false
|
gmail_mail_nach_cronjob: false
|
||||||
|
gmail_smtp_server: smtp.gmail.com
|
||||||
|
gmail_smtp_server_port: 587
|
||||||
|
gmail_smtp_use_tls: yes
|
||||||
### mgrote.set_apt_sources
|
### mgrote.set_apt_sources
|
||||||
acng_server: acng.grote.lan
|
acng_server: acng.grote.lan
|
||||||
acng_server_port: 9999
|
acng_server_port: 9999
|
||||||
|
|
BIN
keepass_db.kdbx
BIN
keepass_db.kdbx
Binary file not shown.
|
@ -14,5 +14,5 @@
|
||||||
---
|
---
|
||||||
- hosts: storage
|
- hosts: storage
|
||||||
roles:
|
roles:
|
||||||
- { role: mgrote.postfix-gmail, tags: "postfix-gmail" }
|
- { role: mgrote.postfix-gmail, tags: "gmail" }
|
||||||
- { role: mgrote.fileserver_smb, tags: "fileserver_smb" }
|
- { role: mgrote.fileserver_smb, tags: "fileserver_smb" }
|
||||||
|
|
|
@ -6,17 +6,16 @@ Installiert und konfiguriert postfix fuer den GMail.
|
||||||
### Funktioniert auf
|
### Funktioniert auf
|
||||||
- [x] Ubuntu (>=18.04)
|
- [x] Ubuntu (>=18.04)
|
||||||
- [x] Debian
|
- [x] Debian
|
||||||
|
|
||||||
- [x] ProxMox 6.1
|
- [x] ProxMox 6.1
|
||||||
|
|
||||||
### Variablen + Defaults
|
### Variablen + Defaults
|
||||||
##### Wer soll die Mails bekommen.
|
##### Wer soll die Mails bekommen.
|
||||||
empfaenger_mail: michael.grote@posteo.de
|
empfaenger_mail: michael.grote@posteo.de
|
||||||
##### Nutzer fuer GMail
|
##### Nutzer fuer GMail
|
||||||
nutzer_gmail: michael.grote@gmail.com
|
gmail_nutzer_gmail: michael.grote@gmail.com
|
||||||
##### Passwort fuer GMail
|
##### Passwort fuer GMail
|
||||||
passwort_gmail: FKXaOMOPv9bF5kHC
|
gmail_nutzer_passwort: FKXaOXXXXXX5kHC
|
||||||
##### Soll nach Aufuehrung eines cronjobs eine Mail versendet werden?
|
##### Soll nach Aufuehrung eines cronjobs eine Mail versendet werden?
|
||||||
mail_nach_cronjob: false
|
gmail_mail_nach_cronjob: false
|
||||||
##### Netzwerke aus denen postfix Mails annimmt
|
##### Netzwerke aus denen postfix Mails annimmt
|
||||||
postfix_gmail_erlaubte_netzwerke: "127.0.0.0/8 192.168.2.0/24"
|
gmail_postfix_erlaubte_netzwerke: "127.0.0.0/8 192.168.2.0/24"
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
---
|
---
|
||||||
mail_nach_cronjob: false
|
gmail_mail_nach_cronjob: false
|
||||||
postfix_gmail_erlaubte_netzwerke: "127.0.0.0/8 192.168.2.0/24"
|
gmail_postfix_erlaubte_netzwerke: "127.0.0.0/8 192.168.2.0/24"
|
||||||
|
gmail_smtp_server: smtp.gmail.com
|
||||||
|
gmail_smtp_server_port: 587
|
||||||
|
gmail_smtp_use_tls: yes
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
name: postfix
|
name: postfix
|
||||||
enabled: yes
|
enabled: yes
|
||||||
state: restarted
|
state: restarted
|
||||||
|
notify: postfix_testmail
|
||||||
|
|
||||||
- name: postfix_testmail
|
- name: postfix_testmail
|
||||||
shell: echo "postfix ist eingerichtet" | mail -s "{{ ansible_hostname }} - postfix" {{ empfaenger_mail }}
|
shell: echo "postfix ist eingerichtet" | mail -s "{{ ansible_hostname }} - postfix" {{ empfaenger_mail }}
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
- name: Mail Cronjob - Anlegen
|
- name: Mail Cronjob - Anlegen
|
||||||
become: yes
|
become: yes
|
||||||
when: mail_nach_cronjob # ohne parameter wird auf true geprueft https://www.buildahomelab.com/2018/11/12/using-ansible-when-statements/
|
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:
|
ansible.builtin.cron:
|
||||||
name: MAILTO
|
name: MAILTO
|
||||||
env: yes
|
env: yes
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
|
|
||||||
- name: Mail Cronjob - Entfernen
|
- name: Mail Cronjob - Entfernen
|
||||||
become: yes
|
become: yes
|
||||||
when: not mail_nach_cronjob
|
when: not gmail_mail_nach_cronjob
|
||||||
ansible.builtin.cron:
|
ansible.builtin.cron:
|
||||||
name: MAILTO
|
name: MAILTO
|
||||||
env: yes
|
env: yes
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
relayhost = [smtp.gmail.com]:587
|
relayhost = [{{ gmail_smtp_server }}]:{{ gmail_smtp_server_port }}
|
||||||
smtp_use_tls = yes
|
smtp_use_tls = {{ gmail_smtp_use_tls }}
|
||||||
smtp_sasl_auth_enable = yes
|
smtp_sasl_auth_enable = yes
|
||||||
smtp_sasl_security_options =
|
smtp_sasl_security_options =
|
||||||
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
|
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
|
||||||
|
@ -8,6 +8,6 @@ smtp_tls_session_cache_timeout = 3600s
|
||||||
inet_protocols = ipv4
|
inet_protocols = ipv4
|
||||||
append_dot_mydomain = no
|
append_dot_mydomain = no
|
||||||
|
|
||||||
mynetworks = {{ postfix_gmail_erlaubte_netzwerke }}
|
mynetworks = {{ gmail_postfix_erlaubte_netzwerke }}
|
||||||
|
|
||||||
smtpd_relay_restrictions = permit_mynetworks
|
smtpd_relay_restrictions = permit_mynetworks
|
||||||
|
|
|
@ -1,2 +1 @@
|
||||||
smtp.gmail.com {{ nutzer_gmail }}:{{ passwort_gmail }}
|
{{ gmail_smtp_server }} {{ gmail_nutzer_gmail }}:{{ gmail_nutzer_passwort }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue