llm-inference-multimodel: stop pre-existing Gemma service before Phase 4 starts new instances

This commit is contained in:
Hermes Agent service account
2026-08-05 16:28:34 -05:00
parent 628dae06a8
commit 73ef806dd6

View File

@@ -10,6 +10,31 @@
# systemd services" intent for durability, not just this-session. # 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 - name: Enable llama-server-aux and start/restart based on Phase 2 unit-content change
ansible.builtin.systemd: ansible.builtin.systemd:
name: "{{ llm_aux_service_name }}" name: "{{ llm_aux_service_name }}"