From 5b4a287cca135fbcb377cf10c72f24e9db967093 Mon Sep 17 00:00:00 2001
From: Raphael Dannecker <raphael.dannecker@steinbeisschule-reutlingen.de>
Date: Thu, 27 Feb 2025 18:34:44 +0100
Subject: [PATCH] Direct logout, when mount of server shares failed

Sometimes mounting the server shares fails when logging in (missing
krb5-tickts). On devices with localhome, users can still log in. To
prevent this, users are immediately logged out if the server mounts are
missing.
---
 roles/lmn_localhome/tasks/main.yml | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/roles/lmn_localhome/tasks/main.yml b/roles/lmn_localhome/tasks/main.yml
index 30da94d..d4f4b40 100644
--- a/roles/lmn_localhome/tasks/main.yml
+++ b/roles/lmn_localhome/tasks/main.yml
@@ -33,6 +33,9 @@
     dest: /etc/profile.d/lmn-logout.sh
     content: |
       [[ "${UID}" -gt 10000 ]] && ! findmnt "/lmn/media/${USER}/home" > /dev/null && exit 0
+      {% if 'teacherlaptop' not in group_names %}
+      [[ "${UID}" -gt 10000 ]] && ! findmnt /srv/samba/schools/default-school > /dev/null && exit 0
+      {% endif %}
 
 - name: Provide rmexam script
   ansible.builtin.copy: