From b33922337902065919da8bdfe6c75c2046fb2335 Mon Sep 17 00:00:00 2001
From: Thomas Schneider <thomas@fsmpi.rwth-aachen.de>
Date: Sun, 16 Jul 2017 18:20:36 +0200
Subject: [PATCH] Compatibility with both Debian Jessie and Stretch

Signed-off-by: Thomas Schneider <thomas@fsmpi.rwth-aachen.de>
---
 request-tracker/tasks/main.yml                | 11 ++++++++++-
 request-tracker/templates/RT_SiteConfig.pm.j2 |  4 ++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/request-tracker/tasks/main.yml b/request-tracker/tasks/main.yml
index 79c1e1d..0ef8cea 100644
--- a/request-tracker/tasks/main.yml
+++ b/request-tracker/tasks/main.yml
@@ -4,17 +4,26 @@
     - request-tracker4
     - rt4-fcgi
     - rt4-db-postgresql
-    - cpanminus
     - debconf-utils
   tags:
     - packages
     - rt
 
+- name: Have RT packages needed in Debian Jessie installed
+  apt: name={{item}} state=present
+  with_items:
+    - cpanminus
+  when: debian_version == 'jessie'
+  tags:
+    - packages
+    - rt
+
 - name: Have RT additional Perl packages installed
   cpanm: name={{item}} system_lib=yes
   with_items:
     - RT::Extension::LDAPImport
     - RT::Authen::ExternalAuth
+  when: debian_version == 'jessie'
   tags:
     - rt
     - packages
diff --git a/request-tracker/templates/RT_SiteConfig.pm.j2 b/request-tracker/templates/RT_SiteConfig.pm.j2
index b91a268..0f894eb 100644
--- a/request-tracker/templates/RT_SiteConfig.pm.j2
+++ b/request-tracker/templates/RT_SiteConfig.pm.j2
@@ -31,8 +31,10 @@ Set($LDAPMapping, {Name         => 'sAMAccountName', # required
                    WorkPhone    => 'telephoneNumber',
                    Organization => 'departmentName'});
 
+{% if debian_version == 'jessie' %}
 # Add to any existing plugins
 Set(@Plugins, qw(RT::Extension::LDAPImport));
+{% endif %}
 
 # If you want to sync Groups from LDAP into RT
 
@@ -44,7 +46,9 @@ Set($LDAPGroupMapping, {Name               => 'cn',
                         Description        => 'description'});
 
 ### Login
+{% if debian_version == 'jessie' %}
 Plugin('RT::Authen::ExternalAuth');
+{% endif %}
 Set($ExternalAuthPriority, [ 'My_LDAP' ]);
 Set($ExternalInfoPriority, [ 'My_LDAP' ]);
 Set($AutoCreateNonExternalUsers, 1);
-- 
GitLab