97 lines
4.6 KiB
YAML
97 lines
4.6 KiB
YAML
---
|
|
# ------------------------------------------------------------------------------
|
|
# FILE: roles/llm-inference-multimodel/tasks/main.yml
|
|
# DESCRIPTION: Entry point — imports one task file per phase.
|
|
# Phases are additive; re-running the full playbook is always
|
|
# safe (idempotent). Use --tags to run a specific phase subset:
|
|
# --tags discover,models,systemd,firewall,verify
|
|
#
|
|
# IMPORTANT: Phase 2 (systemd) deploys but does NOT start either service.
|
|
# Phase 4 (verify) is what starts + smoke-tests them. This lets
|
|
# Ryan review "systemd units land, nothing running yet" as a
|
|
# distinct, revertable checkpoint before anything touches the
|
|
# live GPU/VRAM state.
|
|
# ------------------------------------------------------------------------------
|
|
|
|
# Phase 0 — Discover (read-only; confirm how the existing Gemma llama-server
|
|
# is actually managed today before assuming a systemd unit exists)
|
|
- import_tasks: discover.yml
|
|
tags: [discover]
|
|
|
|
# Phase 1 — Models (idempotent GGUF download, size-check guard)
|
|
- import_tasks: models.yml
|
|
tags: [models]
|
|
|
|
# Phase 2 — Systemd (template + deploy both unit files, do NOT auto-start)
|
|
- import_tasks: systemd.yml
|
|
tags: [systemd]
|
|
|
|
# Phase 3 — Firewall (scope :8001 and reconsider :8000 exposure)
|
|
- import_tasks: firewall.yml
|
|
tags: [firewall]
|
|
|
|
# Phase 4 — Verify (start both services, curl smoke test, nvidia-smi VRAM check)
|
|
- import_tasks: verify.yml
|
|
tags: [verify]
|
|
|
|
# Phase R — Router shadow deployment (port 8003)
|
|
# Gates on llm_router_enabled (default false — complete no-op until enabled).
|
|
# Use playbooks/day1_deploy_llm_router_shadow.yml which sets llm_router_enabled: true.
|
|
#
|
|
# NOTE: This phase uses include_tasks (dynamic) rather than import_tasks (static)
|
|
# to prevent Ansible's tag-inheritance from applying the router_* tags to ALL
|
|
# tasks in all other phases. With import_tasks, every task in every phase gets
|
|
# the parent tag set merged in, making --tags router_* run the full role.
|
|
# include_tasks evaluates tags at runtime, keeping phase isolation clean.
|
|
# Trade-off: include_tasks does NOT forward tags to child tasks' own tag sets,
|
|
# so individual router sub-phase tags (router_systemd, router_firewall, etc.)
|
|
# must be applied via --tags on the CLI when running in isolation.
|
|
# Added 2026-08-12 (t_0cca74a2): router mode migration — War Machine.
|
|
- include_tasks: router.yml
|
|
when: llm_router_enabled | default(false)
|
|
tags: [always]
|
|
|
|
# Phase P — Router preset mode / alias deployment
|
|
# Gates on llm_router_preset_enabled (default false — complete no-op until enabled).
|
|
# Use playbooks/day2_add_phi_alias.yml which sets llm_router_preset_enabled: true.
|
|
# Purpose: switch from --models-dir to --models-preset to enable model aliases.
|
|
# The Phi-3.5-mini-instruct-Q8_0 entry gains alias "Phi-3.5-mini-instruct-8bit".
|
|
# Added 2026-08-12 (t_9adf0889): Phi alias — War Machine.
|
|
- include_tasks: preset.yml
|
|
when: llm_router_preset_enabled | default(false)
|
|
tags: [always]
|
|
|
|
# Phase S — llama-swap mode hot-swap proxy (port 8001)
|
|
# Gates on llm_swapmode_enabled (default false — complete no-op until enabled).
|
|
# Replaces router mode entirely: single Go binary + YAML config, no INI presets.
|
|
# Additive deployment (non-invasive); production router (port 8002) stays running during Phase 1 shadow.
|
|
#
|
|
# When llm_swapmode_enabled: true, this phase:
|
|
# swapmode_binary — download + install llama-swap binary
|
|
# swapmode_config — render config.yaml.j2 template
|
|
# swapmode_systemd — deploy llama-swap.service unit
|
|
# swapmode_firewall — open port 8001 scoped to Hermes subnet
|
|
# swapmode_verify — start service, run validation gates
|
|
#
|
|
# Added 2026-08-18 (t_c1e44190): llama-swap Phase 3 Ansible integration — Wong.
|
|
- include_tasks: swapmode.yml
|
|
when: llm_swapmode_enabled | default(false)
|
|
tags: [always]
|
|
|
|
# Phase M — GPU/LLM Monitoring (VRAM exporter + Prometheus + Grafana)
|
|
# Gates on llm_monitoring_enabled (default true — but can be disabled per-host).
|
|
# Deploys:
|
|
# - VRAM textfile exporter script (runs every minute via cron)
|
|
# - Prometheus scrape config template (for GitOps deployment)
|
|
# - Grafana dashboard JSON template (for GitOps deployment)
|
|
# - PrometheusRule alert rules template (for GitOps deployment)
|
|
#
|
|
# No cluster-facing changes here; templates are staged for manual review
|
|
# and committed via Git. ArgoCD syncs them automatically afterward.
|
|
#
|
|
# Reference: roles/llm-inference-multimodel/references/monitoring-llm-homelab-ciro-luciotta-2026.md
|
|
# Added 2026-08-18 (t_57a9f82f): GPU/LLM monitoring Phase 3 — Wong.
|
|
- include_tasks: monitoring.yml
|
|
when: llm_monitoring_enabled | default(true)
|
|
tags: [always]
|