Files
cluster-knaster/platform/proxmox/ansible/roles/gpu-llamacpp/tasks/main.yml
T
Robert RappandClaude Opus 5.5 986f1116fe
ci / test (push) Failing after 22s
k3s: llama.cpp-Server als Deployments (Task 6.1)
Ein Pod je GPU-VM (Embed+Rerank bzw. Chat), Host-Netz mit den Ports aus dem
Compose, P2000 fest per UUID (NVIDIA_VISIBLE_DEVICES). Das Device Plugin
vergibt nur noch Index 0 (M4000). Rolle gpu-llamacpp: gemeinsame Vorbereitung
(prepare.yml), k3s.yml mit Image-Import und Compose-Stopp; gpu-llamacpp.yml
bricht ohne -e llamacpp_compose=true ab.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-19 17:27:23 +02:00

77 lines
2.5 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# llama.cpp-Server je Profil (Task 6.1). Idempotent: Modelle per Prüfsumme, Image nur bauen, wenn es fehlt
# (Image-Tag enthält Stand und CUDA-Version), compose ändert nur, was sich geändert hat.
- name: Profile, Karten, Modelle
ansible.builtin.include_tasks: prepare.yml
# Compose baut nur mit buildx (BuildKit, auch für den Git-Kontext mit Commit-Pin)
- name: docker-buildx installieren
ansible.builtin.apt:
name: docker-buildx
state: present
# --- Compose-Projekt ---
- name: Projektverzeichnis
ansible.builtin.file:
path: "{{ llamacpp_dir }}"
state: directory
mode: "0755"
- name: Compose-Datei kopieren
ansible.builtin.copy:
src: "{{ playbook_dir }}/../../../../deploy/compose/gpu-llamacpp/docker-compose.yml"
dest: "{{ llamacpp_dir }}/docker-compose.yml"
mode: "0644"
- name: .env schreiben (keine Geheimnisse)
ansible.builtin.copy:
dest: "{{ llamacpp_dir }}/.env"
mode: "0644"
content: |
# Verwaltet von Ansible (Rolle gpu-llamacpp)
COMPOSE_PROFILES={{ llamacpp_profiles | join(',') }}
{% for k, v in (llamacpp_env | combine(llamacpp_gpu_env)).items() %}
{{ k }}={{ v }}
{% endfor %}
# ufw-Regeln wirken auch bei inaktivem ufw (werden vorgemerkt). Fremde Regeln bleiben unberührt.
- name: Ist ufw vorhanden?
ansible.builtin.stat:
path: /usr/sbin/ufw
register: llamacpp_ufw
- name: ufw – llama.cpp-Ports aus dem LAN vormerken
community.general.ufw:
rule: allow
src: "{{ llamacpp_allow_from }}"
port: "{{ item.port | string }}"
proto: tcp
comment: knaster-llamacpp
loop: "{{ llamacpp_profiles | map('extract', llamacpp_services) | flatten }}"
loop_control:
label: "{{ item.name }}:{{ item.port }}"
when: llamacpp_ufw.stat.exists
# Der erste Build dauert lange (llama.cpp mit CUDA, sm_52/61, alle CPU-Varianten auf 4 vCPU)
- name: Image bauen (falls es fehlt) und Dienste starten
community.docker.docker_compose_v2:
project_src: "{{ llamacpp_dir }}"
profiles: "{{ llamacpp_profiles }}"
build: policy
state: present
remove_orphans: true
wait: false
async: 7200
poll: 30
- name: Warten, bis alle Dienste gesund sind
ansible.builtin.uri:
url: "http://127.0.0.1:{{ item.port }}/health"
status_code: 200
register: llamacpp_health
until: llamacpp_health.status == 200
retries: 60
delay: 10
loop: "{{ llamacpp_profiles | map('extract', llamacpp_services) | flatten }}"
loop_control:
label: "{{ item.name }}:{{ item.port }}"