--- # ------------------------------------------------------------------------------ # FILE: roles/llm-inference-multimodel/handlers/main.yml # DESCRIPTION: Only a daemon-reload handler lives here now (harmless, no # process impact). Per-service restart/start decisions are made # explicitly in tasks/verify.yml (Phase 4), keyed off the # per-unit `changed` result registered in tasks/systemd.yml # (Phase 2) — NEVER combined, so a content change to one unit # template still never restarts the other (plan §2/§6 # requirement: independent restart/rollback). # # BUGFIX: this file used to also define "restart # llama-server-aux" / "restart llama-server-toolcall" handlers, # notified from Phase 2's template tasks and fired there via # `meta: flush_handlers` — causing both live services to # restart during Phase 2, before Phase 3/4 had run. See # tasks/systemd.yml for the full writeup. Restart logic moved # to tasks/verify.yml so it only ever fires in Phase 4. # ------------------------------------------------------------------------------ - name: Reload systemd ansible.builtin.systemd: daemon_reload: true become: true listen: "reload systemd" # Restart the llama.cpp router so it re-discovers /opt/models after a NEW GGUF # is staged. NOTIFIED ONLY from tasks/stage_model.yml when an actual download # (or permission correction) occurs — a normal idempotent re-run that finds the # files already correct will NOT fire this, so the live router is left # untouched. Safe on the idle GPU (router holds no resident model when all # entries are "unloaded"; restart is sub-second). - name: restart llama-server-router on new GGUF ansible.builtin.systemd: name: "{{ llm_router_service_name | default('llama-server-router') }}" state: restarted become: true # Restart handler for preset mode changes (notified by tasks/preset.yml when # the preset INI or unit file changes). Distinct from "restart llama-server-router # on new GGUF" so each change path can notify independently. - name: restart router ansible.builtin.systemd: name: "{{ llm_router_service_name | default('llama-server-router') }}" state: restarted become: true