]> arthur.barton.de Git - AnsibleRoles.git/blobdiff - roles/postfix/tasks/main.yml
Apt module: Update "state=installed" to "state=present"
[AnsibleRoles.git] / roles / postfix / tasks / main.yml
index 039380c231520ec62da817e644b615813f7851d0..eeb111bb354c100bd771fdc18ab4de8d18ab69c2 100644 (file)
@@ -1,8 +1,9 @@
 ---
 # postfix tasks
 
-# Set Debconf to not configure Postfix at all:
-- name: configure debconf(1) to not configure Postfix
+# Debconf
+
+- 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
+  notify:
+    - update "postfix" configuration
+
+- name: 'debconf(1): set system mail name'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/mailname
+    value="{{ postfix_mailname }}"
+    vtype=string
+  notify:
+    - update "postfix" configuration
+
+- name: 'debconf(1): set SMTP relay host'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/relayhost
+    value="{{ smtp_relay_host }}"
+    vtype=string
+  notify:
+    - update "postfix" configuration
+
+- 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
+  notify:
+    - update "postfix" configuration
+
+- 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
+  notify:
+    - update "postfix" configuration
+
+- name: 'debconf(1): set local networks'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/mynetworks
+    value="{{ postfix_local_networks }}"
+    vtype=string
+  notify:
+    - update "postfix" configuration
+
+- name: 'debconf(1): set mailbox size limit'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/mailbox_limit
+    value="{{ postfix_mailbox_limit }}"
+    vtype=string
+  notify:
+    - update "postfix" configuration
+
+- 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
+  notify:
+    - update "postfix" configuration
+
+- name: 'debconf(1): set internet protocols to use'
+  tags:
+    - debconf
+    - mail
+    - postfix
+  debconf: >
+    name=postfix
+    question=postfix/protocols
+    value="{{ postfix_protocols }}"
     vtype=select
+  notify:
+    - update "postfix" configuration
+
+- 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
+  notify:
+    - update "postfix" configuration
+
+# Install Debian package ...
 
 - name: install "postfix" package
   tags:
     - packages
     - postfix
   apt: >
-    state=installed
+    state=present
     name=postfix
 
+# Update configuration files
+
 - name: setup "/etc/mailname"
   tags:
     - mail
   notify:
     - restart "postfix"
 
-- name: set Posfix "myorigin"
+# Make sure settings in /etc/postfix/main.cf are the same than for debconf!
+
+- name: set other destinations to accept mail for (main.cf)
   tags:
     - mail
     - postfix
   lineinfile: >
     dest=/etc/postfix/main.cf
-    group=root
-    line="myorigin = /etc/mailname"
-    mode=0644
-    owner=root
-    regexp="^myorigin"
+    line="mydestination = {{ postfix_destinations }}"
+    regexp="^mydestination"
   notify:
     - restart "postfix"
 
-- name: set Posfix "myhostname"
+- name: set local networks (main.cf)
   tags:
     - mail
     - postfix
   lineinfile: >
     dest=/etc/postfix/main.cf
-    group=root
-    line="myhostname = {{ postfix_mailname }}"
-    mode=0644
-    owner=root
-    regexp="^myhostname"
+    line="mynetworks = {{ postfix_local_networks }}"
+    regexp="^mynetworks"
   notify:
     - restart "postfix"
 
-- name: set Posfix "mydestination"
+- name: set internet protocols to use (main.cf)
   tags:
     - mail
     - postfix
   lineinfile: >
     dest=/etc/postfix/main.cf
-    line="mydestination = {{ postfix_mailname }}, localhost"
-    regexp="^mydestination"
+    line="inet_protocols = {{ postfix_protocols }}"
+    regexp="^inet_protocols"
   notify:
     - restart "postfix"
 
-- name: set Posfix "inet_interfaces"
+- name: set Posfix "myorigin"
   tags:
     - mail
     - postfix
   lineinfile: >
     dest=/etc/postfix/main.cf
-    line="inet_interfaces = {{ postfix_interfaces }}"
-    regexp="^inet_interfaces"
+    group=root
+    line="myorigin = /etc/mailname"
+    mode=0644
+    owner=root
+    regexp="^myorigin"
   notify:
     - restart "postfix"
 
-- name: set Posfix "relayhost"
+- name: set Posfix "inet_interfaces"
   tags:
     - mail
     - postfix
   lineinfile: >
     dest=/etc/postfix/main.cf
-    line="relayhost = {{ smtp_relay_host }}"
-    regexp="^relayhost"
+    line="inet_interfaces = {{ postfix_interfaces }}"
+    regexp="^inet_interfaces"
   notify:
     - restart "postfix"
 
+# Coinfigure service
+
 - name: ensure service "postfix" is enabled and started
   tags:
     - mail