Files
infrastructure/llm-server/llm/ansible/roles/ai_environment_switch
spektr 7ec8a970b7 GNAI-001 M4 abgeschlossen: Backup/Reboot/Alarmgrenzen (GNAI-008 14.6)
Rolle ai_backup: woechentlicher Timer, NFS-Ziel (Encoding-Pipeline-
Anbindung, Betreiberentscheid), Archiv ohne GGUF-Weights (SOURCE.yml-
Reproduzierbarkeit), SHA256-Sidecar, Retention 8; Restore-Nachweise
R1 (Baum-Diff) und R2 (environment-state restore) bestanden. Echter
Hostreboot: Recovery-Service bringt Production selbststaendig hoch.
Verfuegbarkeitsmetrik gn_ai_active_env (Textfile, 30 s) mit Regel-
vorschlag fuer die GNMON-Suite. M4 damit vollstaendig abgenommen.

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
2026-11-06 07:34:52 +01:00
..

ai_environment_switch

Exclusive switch between the AI environments (GNAI-008 section 7.3, GNAI-001 milestone 4). Deploys:

  • gnai-environment-switch (privileged host script): flock-locked transitions with stop-before-start, GPU release proof (/dev/kfd, render nodes per environment UID), health wait and atomic state file (/var/lib/ghostnet-ai/environment-state).
  • /etc/ghostnet-ai/environment-switch.conf: the environment mapping (accounts, UIDs, unit prefixes, active units) from defaults/main.yml.
  • gnai-environment-recovery.service + .timer: idempotent reconciliation — after host boots it brings the state-active environment back up; every minute it returns to the fallback (production) once a maintenance window has expired. This covers runner aborts and lost CI without production secrets in any CI path.

Subcommands of the script: status, switch-to <env> [window-minutes] and recover. Non-fallback switches require a maintenance window and are validated; the window end is recorded in the state file.

The switch itself is executed via playbooks/switch-environment.yml (-e ai_environment_target=… [-e ai_environment_window_minutes=…]). Unit names and accounts must stay in sync with the per-environment inference_engine group_vars.