# Architektur
Stand: 2026-07-13
## Ueberblick
Zwei getrennte Wege: **laufende Updates** (haeufig, automatisch, uebers Netz) und
**Komplett-Reimage** (~1×/Jahr, von der externen Platte, ohne Netz).
```mermaid
flowchart LR
subgraph Herb["Herb (laptop03 = Master)"]
REPO["~/projekte/schul-laptops
(git)"]
end
subgraph Hetzner["Hetzner 46.225.114.15 (nur Git!)"]
GITEA["Gitea
admin/schul-laptops (public)"]
NGINX["Nginx
git.lehrstun.de:443"]
NGINX --> GITEA
end
subgraph Laptop["Schul-Laptop (laptop01–16)"]
TIMER["systemd-Timer
Boot + alle 30 min"]
PULL["schul-pull.sh →
ansible-pull local.yml"]
TIMER --> PULL
CHECK["reimage-check.service
(frueh im Boot)"]
GRUB["GRUB-Eintrag
Schul-Neuinstallation
(Clonezilla toram)"]
CHECK -- "Platte + neueres Image" --> GRUB
end
REPO -- "git push (SSH :2222)" --> GITEA
PULL -- "HTTPS 443 (Standard)" --> NGINX
PULL -. "Fallback: SSH :2222
Deploy-Key (read-only)" .-> GITEA
subgraph Platte["Externe Platte DEZNTRSICHERUNG"]
IMG["schule-laptop-JJJJ-MM-TT/
(mehrere, neuestes gewinnt)"]
end
GRUB -- "Mini-Menue: AUFSPIELEN (auto) /
IMAGE ERSTELLEN / Abbrechen" --> IMG
```
## Ablauf Reimage (ohne Stick)
```mermaid
sequenceDiagram
participant P as Platte (DEZNTRSICHERUNG)
participant L as Laptop (altes System)
participant C as Clonezilla (toram, aus /boot/clonezilla)
Note over L: Platte anstecken, einschalten
L->>P: reimage-check: neuestes Image > /etc/schul-image-version?
L->>L: grub-reboot "Schul-Neuinstallation" + Reboot
C->>L: Hostname aus altem /etc/hostname lesen
Note over C: Mini-Menue, "AUFSPIELEN" startet nach ~20 s
C->>L: ocs-sr restoredisk (Batch, ohne Nachpruefung)
C->>L: Hostname, SSH-Host-Keys, Machine-ID,
Versionsdatei schreiben; Admin-Key loeschen (ausser laptop03)
Note over L: Poweroff → naechster Boot: fertig, Pull laeuft weiter
```
## Komponenten im Repo
| Pfad | Zweck |
|---|---|
| `local.yml` | ansible-pull-Playbook (Updates, Pakete, Selbstverwaltung der Mechanik) |
| `group_vars/all.yml` | Paketliste u.a. Variablen |
| `files/schul-pull.sh` | Pull-Wrapper: HTTPS zuerst, SSH-Fallback, Journal-Log |
| `files/ansible-pull.service/.timer` | systemd-Units (Boot + 30 min, RandomizedDelay) |
| `files/first-boot-setup.sh` | Einmalig nach Erstinstallation: Hostname etc. |
| `files/reimage-check.*` | Boot-Check: Platte erkannt → Reboot in Clonezilla |
| `files/clonezilla/` | Mini-Menue + ocs-sr-Batch-Skripte (Restore/Save) |
| `playbooks/`, `inventory.yml`, `update-ips.sh` | Legacy-Push (nur Heimnetz) |
## Sicherheit
- Repo public (nur Lesen), enthaelt keine Secrets.
- Privater Gitea-Admin-Key existiert nur auf laptop03 (E-005).
- Deploy-Key (Fallback) ist read-only und liegt unter `/root/.ssh/` (600).
- laptop03: `reimage-check` deaktiviert — der Master ueberschreibt sich nie selbst.