also manage sender_transport_map
authorRalf Jung <post@ralfj.de>
Mon, 2 Sep 2019 11:41:14 +0000 (13:41 +0200)
committerRalf Jung <post@ralfj.de>
Mon, 2 Sep 2019 11:41:49 +0000 (13:41 +0200)
host_vars/template.yml
roles/email/tasks/postfix.yml
roles/email/templates/sender_transport_map [new file with mode: 0644]

index 142e408e05fb8246567e8687dec221b77762a7c4..857dbe4c90a59322ddf1168ec6a4de35471c997f 100644 (file)
@@ -51,6 +51,7 @@ postfix:
   # optional: install and configure mailman
   mailman:
     default_host: lists.example.org
   # 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
     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
index adb054c8fa1c1b8c5d8258804f7908eba78c070f..a76cc250ea5d36e101e3fc4feeb5e247996588cb 100644 (file)
   when: virtual_alias_map.changed
   command: postmap /etc/postfix/virtual_alias_map
   notify: postfix
   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
   when: postfix.smtp_outgoing is defined
   register: sender_transport_map
-  copy:
+  template:
     dest: /etc/postfix/sender_transport_map
     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
 - 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 (file)
index 0000000..e59fb7c
--- /dev/null
@@ -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 %}