From c29818efb362b9b451d103a1a4e403f971e1816f Mon Sep 17 00:00:00 2001
From: Lars Beckers <lars.beckers@rwth-aachen.de>
Date: Mon, 15 Mar 2021 14:22:34 +0100
Subject: [PATCH] spamassassin: template /etc/default/ configuration

---
 spamassassin/tasks/main.yml                            | 4 ++--
 spamassassin/{files/defaults => templates/defaults.j2} | 7 +++++++
 2 files changed, 9 insertions(+), 2 deletions(-)
 rename spamassassin/{files/defaults => templates/defaults.j2} (76%)

diff --git a/spamassassin/tasks/main.yml b/spamassassin/tasks/main.yml
index 5062acd..f877d45 100644
--- a/spamassassin/tasks/main.yml
+++ b/spamassassin/tasks/main.yml
@@ -22,8 +22,8 @@
     - spamassassin
 
 - name: ensure spamassassin is enabled -- the nasty debian way
-  copy:
-    src: defaults
+  template:
+    src: defaults.j2
     dest: /etc/default/spamassassin
     owner: root
     group: root
diff --git a/spamassassin/files/defaults b/spamassassin/templates/defaults.j2
similarity index 76%
rename from spamassassin/files/defaults
rename to spamassassin/templates/defaults.j2
index b79daf1..5b75851 100644
--- a/spamassassin/files/defaults
+++ b/spamassassin/templates/defaults.j2
@@ -4,11 +4,18 @@
 # WARNING: please read README.spamd before using.
 # There may be security risks.
 
+{% if ansible_distribution_major_version|int(default=99) < 11 %}
 # If you're using systemd (default for jessie), the ENABLED setting is
 # not used. Instead, enable spamd by issuing:
 # systemctl enable spamassassin.service
 # Change to "1" to enable spamd on systems using sysvinit:
 ENABLED=1
+{% else %}
+# Prior to version 3.4.2-1, spamd could be enabled by setting
+# ENABLED=1 in this file. This is no longer supported. Instead, please
+# use the update-rc.d command, invoked for example as "update-rc.d
+# spamassassin enable", to enable the spamd service.
+{% endif %}
 
 # Options
 # See man spamd for possible options. The -d option is automatically added.
-- 
GitLab