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 142e408..857dbe4 100644 (file)
@@ -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
index adb054c..a76cc25 100644 (file)
   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 (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 %}