From: Ralf Jung Date: Mon, 2 Sep 2019 11:41:14 +0000 (+0200) Subject: also manage sender_transport_map X-Git-Url: https://git.ralfj.de/ansible.git/commitdiff_plain/6b0ff384c00714c8854b90b1848f7dd34f8c7085?ds=inline also manage sender_transport_map --- diff --git a/host_vars/template.yml b/host_vars/template.yml index 142e408..857dbe4 100644 --- a/host_vars/template.yml +++ b/host_vars/template.yml @@ -51,6 +51,7 @@ postfix: # optional: install and configure mailman mailman: default_host: lists.example.org + smtp_outgoing: smtp2 default_lang: en # if you change this, also run "dpkg-reconfigure mailman" to enable more languages domains: # the file /etc/postfix/virtual_alias_map can be used to configure aliases - lists.example.org diff --git a/roles/email/tasks/postfix.yml b/roles/email/tasks/postfix.yml index adb054c..a76cc25 100644 --- a/roles/email/tasks/postfix.yml +++ b/roles/email/tasks/postfix.yml @@ -45,13 +45,12 @@ when: virtual_alias_map.changed command: postmap /etc/postfix/virtual_alias_map notify: postfix -- name: create empty sender_transport_map +- name: create sender_transport_map when: postfix.smtp_outgoing is defined register: sender_transport_map - copy: + template: dest: /etc/postfix/sender_transport_map - content: "" - force: no + src: templates/sender_transport_map - name: postmap sender_transport_map when: sender_transport_map.changed command: postmap /etc/postfix/sender_transport_map diff --git a/roles/email/templates/sender_transport_map b/roles/email/templates/sender_transport_map new file mode 100644 index 0000000..e59fb7c --- /dev/null +++ b/roles/email/templates/sender_transport_map @@ -0,0 +1,6 @@ +# default is {{ postfix.default_smtp_outgoing }} +{% if postfix.mailman is defined and postfix.mailman.smtp_outgoing is defined %} +{% for item in postfix.mailman.domains %} +@{{item}} {{ postfix.mailman.smtp_outgoing }} +{% endfor %} +{% endif %}