]> arthur.barton.de Git - AnsibleRoles.git/commitdiff
postfix: Configure a satellite system and use debconf
authorAlexander Barton <alex@barton.de>
Wed, 17 May 2017 18:11:40 +0000 (20:11 +0200)
committerAlexander Barton <alex@barton.de>
Wed, 17 May 2017 18:11:40 +0000 (20:11 +0200)
Don’t mangle the generated main.cf file.

roles/postfix/defaults/main.yml
roles/postfix/tasks/main.yml

index 081ea61cc84b38418658ab410a713edae3b957f0..3f5f3be83caa164a887d4e8e0ee7d6c5486bfdb2 100644 (file)
@@ -1,6 +1,13 @@
 ---
 # defaults file for postfix
 
+postfix_destinations: "{{ inventory_hostname}}, localhost"
 postfix_interfaces: "all"
+postfix_local_networks: "127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128"
+postfix_mailbox_limit: "0"
 postfix_mailname: "{{ inventory_hostname }}"
+postfix_protocols: "all"
+postfix_recipient_delim: "+"
+postfix_root_address: ""
+postfix_sync_updates: "false"
 smtp_relay_host: ""
index 039380c231520ec62da817e644b615813f7851d0..6acc7862ce315f89e17d9b06294b519d23092e05 100644 (file)
@@ -1,8 +1,7 @@
 ---
 # postfix tasks
 
-# Set Debconf to not configure Postfix at all:
-- name: configure debconf(1) to not configure Postfix
+- name: 'debconf(1): configure Postfix as "Satellite system"'
   tags:
     - debconf
     - mail
   debconf: >
     name=postfix
     question=postfix/main_mailer_type
-    value="No configuration"
+    value="Satellite system"
     vtype=select
 
+- name: 'debconf(1): set system mail name'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/mailname
+    value="{{ postfix_mailname }}"
+    vtype=string
+
+- name: 'debconf(1): set SMTP relay host'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/relayhost
+    value="{{ smtp_relay_host }}"
+    vtype=string
+
+- name: 'debconf(1): set root and postmaster recipient'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/root_address
+    value="{{ postfix_root_address }}"
+    vtype=string
+
+- name: 'debconf(1): set other destinations to accept mail for'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/destinations
+    value="{{ postfix_destinations }}"
+    vtype=string
+
+- name: 'debconf(1): set local networks'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/mynetworks
+    value="{{ postfix_local_networks }}"
+    vtype=string
+
+- name: 'debconf(1): set mailbox size limit'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/mailbox_limit
+    value="{{ postfix_mailbox_limit }}"
+    vtype=string
+
+- name: 'debconf(1): set local address extension character'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/recipient_delim
+    value="{{ postfix_recipient_delim }}"
+    vtype=string
+
+- name: 'debconf(1): set internet protocols to use'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/protocols
+    value="{{ postfix_protocols }}"
+    vtype=string
+
+- name: 'debconf(1): configure synchronous updates on mail queue'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/chattr
+    value="{{ postfix_sync_updates }}"
+    vtype=boolean
+
 - name: install "postfix" package
   tags:
     - mail
   notify:
     - restart "postfix"
 
-- name: set Posfix "myhostname"
-  tags:
-    - mail
-    - postfix
-  lineinfile: >
-    dest=/etc/postfix/main.cf
-    group=root
-    line="myhostname = {{ postfix_mailname }}"
-    mode=0644
-    owner=root
-    regexp="^myhostname"
-  notify:
-    - restart "postfix"
-
-- name: set Posfix "mydestination"
-  tags:
-    - mail
-    - postfix
-  lineinfile: >
-    dest=/etc/postfix/main.cf
-    line="mydestination = {{ postfix_mailname }}, localhost"
-    regexp="^mydestination"
-  notify:
-    - restart "postfix"
-
 - name: set Posfix "inet_interfaces"
   tags:
     - mail
   notify:
     - restart "postfix"
 
-- name: set Posfix "relayhost"
-  tags:
-    - mail
-    - postfix
-  lineinfile: >
-    dest=/etc/postfix/main.cf
-    line="relayhost = {{ smtp_relay_host }}"
-    regexp="^relayhost"
-  notify:
-    - restart "postfix"
-
 - name: ensure service "postfix" is enabled and started
   tags:
     - mail