diff --git a/lmn-client.yml b/lmn-client.yml
index 3c0a471..2733d0d 100644
--- a/lmn-client.yml
+++ b/lmn-client.yml
@@ -85,6 +85,8 @@
- lmn_printer
- kerberize
- lmn_security
+ - role: lmn_localhome
+ when: when: groups.localhome is defined and inventory_hostname in groups.localhome
tasks:
## Temporary fixes and quirks:
diff --git a/roles/lmn_fvs/files/lmn-patch-dolphin.sh b/roles/lmn_fvs/files/lmn-patch-dolphin.sh
index 7e7c8e2..4c807d6 100755
--- a/roles/lmn_fvs/files/lmn-patch-dolphin.sh
+++ b/roles/lmn_fvs/files/lmn-patch-dolphin.sh
@@ -16,19 +16,44 @@ fi
id="$(grep ID "$file" | sed -E "s|^.+ID>([[:digit:]]+)/([[:digit:]]+)
++
Home@Server
++
++
++
++
++
++ $IDENTITY/${NUM1}
++ true
++
++
++ "
+else
+ HOMEONSERVER=$'\n\n\n\n\n\n\n\n\n\n\n\n'
+fi
patch="
--- a/$file
+++ b/$file
-@@ -98,9 +98,33 @@
+@@ -98,9 +98,45 @@
true
+$HOMEONSERVER
+
+ Tausch
+
@@ -36,7 +61,7 @@ patch="
+
+
+
-+ $IDENTITY/${NUM1}
++ $IDENTITY/${NUM2}
+ true
+
+
@@ -48,7 +73,7 @@ patch="
+
+
+
-+ $IDENTITY/${NUM2}
++ $IDENTITY/${NUM3}
+ true
+
+
diff --git a/roles/lmn_localhome/files/lmn-create-unisonconfig.sh b/roles/lmn_localhome/files/lmn-create-unisonconfig.sh
new file mode 100644
index 0000000..56f3b4e
--- /dev/null
+++ b/roles/lmn_localhome/files/lmn-create-unisonconfig.sh
@@ -0,0 +1,29 @@
+#!/usr/bin/bash
+#
+# create ~/.unison/SyncHome.prf if not exists
+#
+set -eu
+
+[[ -f ~/.unison/SyncHome.prf ]] && exit 0
+
+mkdir -p ~/.unison
+
+if id | grep teachers; then
+ NETHOME="$(find /srv/samba/schools/default-school/teachers/ -maxdepth 1 -type d -name "${USER}")"
+else
+ NETHOME="$(find /srv/samba/schools/default-school/students/ -maxdepth 2 -type d -name "${USER}")"
+fi
+
+if [[ ! -f ~/.unison/SyncHome.prf ]]; then
+ echo "# Unison preferences
+label = Sync Home on Server
+path = Bilder
+path = Dokumente
+path = Musik
+path = Videos
+root = $HOME
+root = $NETHOME
+dontchmod = true
+perms = 0" > ~/.unison/SyncHome.prf
+fi
+
diff --git a/roles/lmn_localhome/tasks/main.yml b/roles/lmn_localhome/tasks/main.yml
new file mode 100644
index 0000000..1f8b499
--- /dev/null
+++ b/roles/lmn_localhome/tasks/main.yml
@@ -0,0 +1,35 @@
+---
+- name: enable pam_mkhomedir.so
+ lineinfile:
+ dest: /etc/pam.d/common-session
+ line: "session optional pam_mkhomedir.so umask=0077"
+ insertbefore: "session optional pam_mount.so"
+
+- name: Patch sddm login screen to inform about localhome
+ blockinfile:
+ path: /usr/share/sddm/themes/debian-breeze/Main.qml
+ marker: // {mark} ANSIBLE MANAGED BLOCK localhome
+ insertbefore: '\s+//Footer'
+ block: |
+ Text {
+ id: localhome
+ anchors.top: parent.top
+ anchors.left: parent.left
+ anchors.topMargin: 10
+ anchors.leftMargin: 15
+ color: "#ffffff"
+ text: "Lokale Anmeldung!\nHome-Verzeichnis liegt nicht im Netz!"
+ font.pointSize: config.fontSize
+ }
+
+- name: Copy unison-createconfig scripts
+ ansible.builtin.copy:
+ src: lmn-create-unisonconfig.sh
+ dest: /usr/local/bin/
+ mode: 0755
+
+- name: Install auto-logout-script for first login in /etc/profile.d/
+ copy:
+ dest: /etc/profile.d/lmn-logout.sh
+ content: |
+ [[ "${UID}" -gt 10000 ]] && ! findmnt "/lmn/media/${USER}/home" > /dev/null && exit 0
diff --git a/roles/lmn_sssd/templates/sssd.conf.j2 b/roles/lmn_sssd/templates/sssd.conf.j2
index 0c10c3c..f059f14 100644
--- a/roles/lmn_sssd/templates/sssd.conf.j2
+++ b/roles/lmn_sssd/templates/sssd.conf.j2
@@ -17,3 +17,6 @@ ad_gpo_access_control = disabled
ad_gpo_ignore_unreadable = True
ad_maximum_machine_account_password_age = 0
ignore_group_members = True
+{% if groups.localhome is defined and inventory_hostname in groups.localhome %}
+override_homedir = /home/%u
+{% endif %}
diff --git a/roles/lmn_vm/tasks/main.yml b/roles/lmn_vm/tasks/main.yml
index 0d87a4e..d109fca 100644
--- a/roles/lmn_vm/tasks/main.yml
+++ b/roles/lmn_vm/tasks/main.yml
@@ -48,6 +48,20 @@
insertafter: ""
+- name: Configure pam_mount for VM bind mounts
+ blockinfile:
+ dest: /etc/security/pam_mount.conf.xml
+ marker: ""
+ block: |
+ rootansibleDebian-gdmsddm{{ localuser }}
+
+ insertafter: ""
+ when: groups.localhome is defined and inventory_hostname in groups.localhome
+
- name: Use umount script for proper cleanup
blockinfile:
dest: /etc/security/pam_mount.conf.xml