From 73ef806dd615243c60494264ecf1001d32ef0012 Mon Sep 17 00:00:00 2001 From: Hermes Agent service account Date: Wed, 5 Aug 2026 16:28:34 -0500 Subject: [PATCH] llm-inference-multimodel: stop pre-existing Gemma service before Phase 4 starts new instances --- .../llm-inference-multimodel/tasks/verify.yml | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/ansible/roles/llm-inference-multimodel/tasks/verify.yml b/ansible/roles/llm-inference-multimodel/tasks/verify.yml index 31ab1c8..58fad49 100644 --- a/ansible/roles/llm-inference-multimodel/tasks/verify.yml +++ b/ansible/roles/llm-inference-multimodel/tasks/verify.yml @@ -10,6 +10,31 @@ # systemd services" intent for durability, not just this-session. # ------------------------------------------------------------------------------ +# BUGFIX (found in production): this file used to go straight from Phase 2's +# "units deployed, nothing running" state into starting/enabling both new +# services, without first stopping the pre-existing single-model Gemma +# llama-server that Phase 0 (discover.yml) confirmed is running on the same +# GPU. Plan §1's VRAM math (aux ~Xgb + toolcall ~Ygb ≈ ~23.5GB / 24GB) only +# holds if that card isn't ALSO holding the old Gemma model's VRAM at the +# same time. Running --tags verify (or the full playbook) against a host +# where Gemma was still up meant starting both new instances on top of it — +# a near-guaranteed OOM-kill, not just a "risk" the old §6 debug message +# warned about after the fact. +# +# Fix: if discover.yml found a systemd-managed Gemma unit +# (llm_existing_gemma_unit_found), stop it here, before either new service +# starts. This only stops the unit — it does not disable it, so plan §6's +# rollback ("systemctl start llama-server-gemma to fully revert") still +# works unchanged. If no such unit was found, this is a no-op and the +# original WARNING from discover.yml (any Gemma process running outside +# systemd) still stands as a human decision point. +- name: Stop pre-existing Gemma llama-server before starting new instances (avoid double VRAM usage / OOM) + ansible.builtin.systemd: + name: "{{ llm_existing_gemma_service_name_guess }}" + state: stopped + become: true + when: llm_existing_gemma_unit_found | default(false) + - name: Enable llama-server-aux and start/restart based on Phase 2 unit-content change ansible.builtin.systemd: name: "{{ llm_aux_service_name }}"