postfix: Fix local mail delivery to relayhost

This commit is contained in:
Timo Makinen 2020-09-02 17:13:13 +00:00
parent 8d1fed8695
commit 574916dfaf

View file

@ -17,6 +17,26 @@
line: "myhostname = {{ inventory_hostname }}" line: "myhostname = {{ inventory_hostname }}"
notify: restart postfix notify: restart postfix
- name: configure myorigin
lineinfile:
path: /etc/postfix/main.cf
regexp: '^myorigin\s*='
insertafter: '^#myorigin\s*='
line: "myorigin = {{ mail_domain }}"
notify: restart postfix
when: mail_domain is defined
- name: configure mydestination
lineinfile:
path: /etc/postfix/main.cf
regexp: '^mydestination\s*='
insertafter: '^#mydestination\s*='
line: 'mydestination = ""'
notify: restart postfix
when:
- mail_domain is defined
- mail_server is defined
- name: configure relayhost - name: configure relayhost
lineinfile: lineinfile:
path: /etc/postfix/main.cf path: /etc/postfix/main.cf
@ -26,24 +46,6 @@
notify: restart postfix notify: restart postfix
when: mail_server is defined when: mail_server is defined
- name: configure masquerade_classes
lineinfile:
path: /etc/postfix/main.cf
regexp: '^masquerade_classes\s*='
insertafter: '^#?relayhost\s*='
line: "masquerade_classes = envelope_sender"
notify: restart postfix
when: mail_domain is defined
- name: configure masquerade_domains
lineinfile:
path: /etc/postfix/main.cf
regexp: '^masquerade_domains\s*='
insertafter: '^masquerade_classes\s*='
line: "masquerade_domains = {{ mail_domain }}"
notify: restart postfix
when: mail_domain is defined
- name: configure smtp_tls_security_level - name: configure smtp_tls_security_level
lineinfile: lineinfile:
path: /etc/postfix/main.cf path: /etc/postfix/main.cf
@ -53,7 +55,7 @@
notify: restart postfix notify: restart postfix
when: mail_server is defined when: mail_server is defined
- name: configure smtp_tls_security_level - name: configure smtp_tls_wrappermode
lineinfile: lineinfile:
path: /etc/postfix/main.cf path: /etc/postfix/main.cf
regexp: '^smtp_tls_wrappermode\s*=' regexp: '^smtp_tls_wrappermode\s*='