From d6f2b58f8948bad9b57ccb766cffe087aea366de Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Fri, 26 Jan 2018 16:50:06 +0100 Subject: [PATCH] postfix: Correct order of tasks, modify files after installing packages This is required because otherwise the files aren't there at all ... --- roles/postfix/tasks/main.yml | 76 +++++++++++++++++++----------------- 1 file changed, 41 insertions(+), 35 deletions(-) diff --git a/roles/postfix/tasks/main.yml b/roles/postfix/tasks/main.yml index de015fe..e65327f 100644 --- a/roles/postfix/tasks/main.yml +++ b/roles/postfix/tasks/main.yml @@ -1,41 +1,6 @@ --- # postfix tasks -# 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 - line="mydestination = {{ postfix_destinations }}" - regexp="^mydestination" - notify: - - restart "postfix" - -- name: set local networks (main.cf) - tags: - - mail - - postfix - lineinfile: > - dest=/etc/postfix/main.cf - line="mynetworks = {{ postfix_local_networks }}" - regexp="^mynetworks" - notify: - - restart "postfix" - -- name: set internet protocols to use (main.cf) - tags: - - mail - - postfix - lineinfile: > - dest=/etc/postfix/main.cf - line="inet_protocols = {{ postfix_protocols }}" - regexp="^inet_protocols" - notify: - - restart "postfix" - # Debconf - name: 'debconf(1): configure Postfix as "Satellite system"' @@ -168,6 +133,8 @@ notify: - update "postfix" configuration +# Install Debian package ... + - name: install "postfix" package tags: - mail @@ -177,6 +144,8 @@ state=installed name=postfix +# Update configuration files + - name: setup "/etc/mailname" tags: - mail @@ -190,6 +159,41 @@ notify: - restart "postfix" +# 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 + line="mydestination = {{ postfix_destinations }}" + regexp="^mydestination" + notify: + - restart "postfix" + +- name: set local networks (main.cf) + tags: + - mail + - postfix + lineinfile: > + dest=/etc/postfix/main.cf + line="mynetworks = {{ postfix_local_networks }}" + regexp="^mynetworks" + notify: + - restart "postfix" + +- name: set internet protocols to use (main.cf) + tags: + - mail + - postfix + lineinfile: > + dest=/etc/postfix/main.cf + line="inet_protocols = {{ postfix_protocols }}" + regexp="^inet_protocols" + notify: + - restart "postfix" + - name: set Posfix "myorigin" tags: - mail @@ -215,6 +219,8 @@ notify: - restart "postfix" +# Coinfigure service + - name: ensure service "postfix" is enabled and started tags: - mail -- 2.39.2