From 351f27a1c16ce65d93d8c935634c3b213b29e46d Mon Sep 17 00:00:00 2001
From: Lars Beckers <lars.beckers@rwth-aachen.de>
Date: Mon, 15 Mar 2021 14:46:30 +0100
Subject: [PATCH] shell: adapt main sudoers configuration to bullseye

---
 shell/tasks/sudo.yml                               | 4 ++--
 shell/{files/sudo/default => templates/sudoers.j2} | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)
 rename shell/{files/sudo/default => templates/sudoers.j2} (76%)

diff --git a/shell/tasks/sudo.yml b/shell/tasks/sudo.yml
index 9154a4c..5f65bd4 100644
--- a/shell/tasks/sudo.yml
+++ b/shell/tasks/sudo.yml
@@ -9,8 +9,8 @@
     - sudo
 
 - name: ensure we got a sane sudo config
-  copy:
-    src: sudo/default
+  template:
+    src: sudoers.j2
     dest: /etc/sudoers
     owner: root
     group: root
diff --git a/shell/files/sudo/default b/shell/templates/sudoers.j2
similarity index 76%
rename from shell/files/sudo/default
rename to shell/templates/sudoers.j2
index 28f0f60..dedfefa 100644
--- a/shell/files/sudo/default
+++ b/shell/templates/sudoers.j2
@@ -19,6 +19,12 @@ Defaults	secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/b
 # User privilege specification
 root	ALL=(ALL:ALL) ALL
 
+{% if ansible_distribution_major_version|int(default=99) < 11 %}
 # See sudoers(5) for more information on "#include" directives:
 
 #includedir /etc/sudoers.d
+{% else %}
+# See sudoers(5) for more information on "@include" directives:
+
+@includedir /etc/sudoers.d
+{% endif %}
-- 
GitLab