diff --git a/ansible/roles/llm-inference-multimodel/tasks/verify.yml b/ansible/roles/llm-inference-multimodel/tasks/verify.yml index 58fad49..f77cb3b 100644 --- a/ansible/roles/llm-inference-multimodel/tasks/verify.yml +++ b/ansible/roles/llm-inference-multimodel/tasks/verify.yml @@ -28,6 +28,28 @@ # 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. +# +# BUGFIX (found in production): main.yml imports each phase file with +# import_tasks + a per-phase tag (tags: [discover], tags: [verify], ...). +# Tags on import_tasks apply to every task inside that file, so running +# `--tags verify` alone — a normal, supported way to re-run just this +# phase per the header comment in main.yml — skips discover.yml entirely. +# llm_existing_gemma_unit_found was then simply undefined, and the +# `| default(false)` on this task's `when:` silently swallowed that, +# defeating the whole point of this fix: --tags verify against a host +# with Gemma still running would go straight to starting both new +# services on top of it, the exact OOM scenario this task exists to +# prevent. Gather the fact locally here too so this task is correct +# regardless of which tags were requested. +- name: Gather service facts (systemd unit inventory) — ensure available even if discover.yml's tag wasn't selected + ansible.builtin.service_facts: + when: llm_existing_gemma_unit_found is not defined + +- name: Determine whether a systemd unit matching the existing Gemma service exists (if not already known from discover.yml) + ansible.builtin.set_fact: + llm_existing_gemma_unit_found: "{{ (llm_existing_gemma_service_name_guess + '.service') in ansible_facts.services }}" + when: llm_existing_gemma_unit_found is not defined + - 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 }}"