From 6b0ff384c00714c8854b90b1848f7dd34f8c7085 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Mon, 2 Sep 2019 13:41:14 +0200 Subject: [PATCH] also manage sender_transport_map --- host_vars/template.yml | 1 + roles/email/tasks/postfix.yml | 7 +++---- roles/email/templates/sender_transport_map | 6 ++++++ 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 roles/email/templates/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 %} -- 2.30.2