--- # ------------------------------------------------------------------------------ # FILE: roles/llm-inference-multimodel/tasks/systemd.yml # DESCRIPTION: Phase 2 (REVISED 2026-08-06) — consolidated to a single # production unit: llama-server-qwen (Qwen2.5-14B-Instruct-1M, # port 8002), serving BOTH the friday and war-machine Hermes # profiles. Ryan explicitly accepted the tradeoffs of running # one model for both profiles instead of the original # aux+toolcall two-model split. # # llama-server-aux (Phi-4, port 8000) and llama-server-toolcall # (Mistral-Small-24B, port 8001) are RETIRED: services stopped # + disabled, unit files removed from astro-orbiter, and their # GGUF weights deleted from /opt/models (~45GB reclaimed). # Ansible no longer templates or manages either unit — see git # log for the prior task definitions if a future rollback needs # them restored. # # The pre-existing Gemma unit/weights (llama-server.service, # gemma-2-27b-it-Q4_K_M.gguf) were ALSO removed as part of this # consolidation (superseded baseline, no longer a rollback # target once Qwen was accepted as sole production model). # ------------------------------------------------------------------------------ - name: Deploy llama-server-qwen systemd unit (production, port 8002) ansible.builtin.template: src: llama-server-qwen.service.j2 dest: "/etc/systemd/system/{{ llm_qwen_service_name }}.service" owner: root group: root mode: "0644" become: true register: llm_qwen_unit_deployed notify: - reload systemd - name: Flush handlers so daemon-reload lands before any later phase acts on unit state ansible.builtin.meta: flush_handlers # NOTE: no `ansible.builtin.systemd: state: started / enabled: true / restarted` # task here on purpose. Units exist on disk after this phase; nothing is # running or restarted. # # BUGFIX (found in production): this file used to `notify: restart # llama-server-*` on the template tasks above, followed by the # flush_handlers meta task. That combination meant Phase 2 (the `systemd` # tag) fired the restart handlers itself — on any run where either unit's # rendered content changed (including the very first apply), BOTH services # got restarted immediately, right here in Phase 2, before Phase 3's # firewall scoping or Phase 4's smoke tests ever ran. That directly # contradicted this file's own stated purpose (units land on disk, nothing # starts/restarts until Phase 4) and caused live services to bounce # unexpectedly on a routine re-run of just `--tags systemd`. # # Fix: Phase 2 only reloads the systemd daemon (harmless, no process # impact) and records whether each unit's content actually changed via # `llm_aux_unit_deployed` / `llm_toolcall_unit_deployed` (both `.changed` # booleans, persisted as play vars for later phases in this same run). # Phase 4 (verify.yml) is the only phase that starts OR restarts either # service, and it does so per-instance using those recorded `changed` # flags — so a content change to one unit's template still never causes # the other to restart, and no restart happens at all until Phase 4 has # been reached.