Thomas Stallinger 770c3a6c95 feat: echte Rolleninhalte für guest-session/brave-fedora/onlyoffice-fedora
Ersetzt die reinen Marker-Datei-Platzhalter durch echte Anforderungen des
Schulcomputer-Workspace:

- guest-session: flüchtige Gastsitzung über lokalen gast-User +
  pam_namespace-tmpfs-Polyinstantiation, nopasswdlogin-Login. PAM-Layout
  wird über ansible_facts os_family erkannt (RedHat vs. Debian), da der
  Rollenname für beide Backends geteilt wird.
- brave-fedora: Installation via Flatpak/Flathub, neue optionale
  standardbrowser-Option (tuxflotte_optionen) setzt/entfernt den
  System-Default in /etc/xdg/mimeapps.list, mit Firefox-Fallback.
- onlyoffice-fedora: Installation via Flatpak/Flathub.

site.yml reicht zusätzlich zu tuxflotte_auftrag_states auch
tuxflotte_auftrag_optionen pro Rolle durch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-08-04 15:28:57 +02:00

95 lines
3.6 KiB
YAML

- name: Ensure marker directory exists
ansible.builtin.file:
path: /run/tuxflotte/agent/applied
state: directory
mode: "0755"
# PAM-Dateilayout unterscheidet sich zwischen RedHat- (GDM/authselect) und
# Debian-Familie (LightDM/common-*) - beide Backends (fedora, mint) nutzen
# denselben Rollennamen "guest-session" (siehe blueprints-Seed), die Rolle
# muss also auf beiden funktionieren.
- name: Determine PAM file locations for this distribution family
ansible.builtin.set_fact:
tuxflotte_guest_pam_auth_file: "{{ '/etc/pam.d/gdm-password' if ansible_facts['os_family'] == 'RedHat' else '/etc/pam.d/lightdm' }}"
tuxflotte_guest_pam_session_file: "{{ '/etc/pam.d/postlogin' if ansible_facts['os_family'] == 'RedHat' else '/etc/pam.d/common-session' }}"
- name: Ensure nopasswdlogin group exists (present)
ansible.builtin.group:
name: nopasswdlogin
state: present
when: tuxflotte_state == "present"
- name: Ensure gast user exists (present)
ansible.builtin.user:
name: gast
comment: "Tuxflotte Gastsitzung"
groups: nopasswdlogin
append: true
shell: /bin/bash
password_lock: true
when: tuxflotte_state == "present"
# Debian/LightDM bringt diese Zeile bereits standardmäßig mit (idempotent,
# lineinfile dupliziert nicht) - auf Fedora/GDM muss sie ergänzt werden.
- name: Allow passwordless login for nopasswdlogin group
ansible.builtin.lineinfile:
path: "{{ tuxflotte_guest_pam_auth_file }}"
line: "auth sufficient pam_succeed_if.so user ingroup nopasswdlogin"
insertbefore: BOF
state: present
when: tuxflotte_state == "present"
- name: Ensure ephemeral tmpfs home for gast (pam_namespace polyinstantiation)
ansible.builtin.lineinfile:
path: /etc/security/namespace.conf
line: "/home/gast tmpfs tmpfs:mntopts=size=2G,mode=0700 root,gast"
regexp: '^/home/gast\s'
state: present
when: tuxflotte_state == "present"
- name: Enable pam_namespace for login sessions
ansible.builtin.lineinfile:
path: "{{ tuxflotte_guest_pam_session_file }}"
line: "session required pam_namespace.so"
state: present
when: tuxflotte_state == "present"
- name: Record that the guest-session role ran
ansible.builtin.copy:
dest: /run/tuxflotte/agent/applied/guest-session.marker
content: "{{ ansible_date_time.iso8601 }}\n"
mode: "0644"
when: tuxflotte_state == "present"
- name: Remove ephemeral tmpfs home entry for gast (Auftrag abgewählt)
ansible.builtin.lineinfile:
path: /etc/security/namespace.conf
regexp: '^/home/gast\s'
state: absent
when: tuxflotte_state == "absent"
# Entfernt die nopasswdlogin-Regel vollständig, nicht nur den gast-Account -
# betrifft auf Debian/LightDM auch den distributionseigenen Default-Eintrag.
# Bewusst in Kauf genommen: diese Rolle ist der einzige Verwalter der
# nopasswdlogin-Konvention in diesem Katalog, Wiederherstellung beim
# nächsten present-Lauf ist kostenlos.
- name: Remove passwordless login rule for nopasswdlogin group (Auftrag abgewählt)
ansible.builtin.lineinfile:
path: "{{ tuxflotte_guest_pam_auth_file }}"
line: "auth sufficient pam_succeed_if.so user ingroup nopasswdlogin"
state: absent
when: tuxflotte_state == "absent"
- name: Remove gast user and home (Auftrag abgewählt)
ansible.builtin.user:
name: gast
state: absent
remove: true
when: tuxflotte_state == "absent"
- name: Remove guest-session marker (Auftrag abgewählt)
ansible.builtin.file:
path: /run/tuxflotte/agent/applied/guest-session.marker
state: absent
when: tuxflotte_state == "absent"