From 1643279372d6ddf42d25eb69687f46c00095ff2f Mon Sep 17 00:00:00 2001
From: Lars Beckers <lars.beckers@rwth-aachen.de>
Date: Sun, 25 Apr 2021 23:48:37 +0200
Subject: [PATCH] postfix: add missing conditions on templated configs

---
 postfix/tasks/main.yml | 29 +++++++++++++++++++++++++++--
 1 file changed, 27 insertions(+), 2 deletions(-)

diff --git a/postfix/tasks/main.yml b/postfix/tasks/main.yml
index 9af4803..481ad35 100644
--- a/postfix/tasks/main.yml
+++ b/postfix/tasks/main.yml
@@ -32,10 +32,35 @@
     src: "{{ item }}.j2"
     dest: "/etc/postfix/{{ item }}"
   with_items:
-    - login_maps.pcre
     - master.cf
     - main.cf
-    - postscreen_access.cidr
+  notify:
+    - restart postfix
+  tags:
+    - postfix
+    - mail
+
+- name: ensure login maps list is present
+  template:
+    src: "login_maps.pcre.j2"
+    dest: "/etc/postfix/login_maps.pcre"
+  when:
+    - not postfix_satellite_only
+    - postfix_enable_dovecot
+    - not postfix_fsmpi|default(false)
+  notify:
+    - restart postfix
+  tags:
+    - postfix
+    - mail
+
+- name: ensure postscreen access list is present
+  template:
+    src: "postscreen_access.cidr.j2"
+    dest: "/etc/postfix/postscreen_access.cidr"
+  when:
+    - not postfix_satellite_only
+    - postfix_enable_postscreen
   notify:
     - restart postfix
   tags:
-- 
GitLab