Files
cluster-knaster/platform/proxmox/ansible/roles/infra-stack/tasks/targets.yml
T
2026-10-13 17:05:43 +02:00

31 lines
1.3 KiB
YAML

# file_sd-Ziele der GPU-VMs (node, gpu, llamacpp). Auch einzeln aufrufbar: playbooks/monitoring-targets.yml
# (nach refresh-vm-access.sh, wenn sich DHCP-Adressen geändert haben). Prometheus liest die Dateien selbst neu.
- name: file_sd-Ziele aus tofu output erzeugen (auf ops)
ansible.builtin.shell: |
set -euo pipefail
tofu output -json gpu_vms | python3 {{ infra_repo_src }}/platform/proxmox/scripts/monitoring-targets.py \
--registry {{ infra_repo_src }}/sites/{{ knaster_site }}/registry.yaml --out {{ infra_targets_dir }} \
--llamacpp '{{ dict(_llamacpp_hosts | zip(_llamacpp_hosts | map('extract', hostvars, 'llamacpp_profiles'))) | to_json }}'
args:
chdir: "{{ infra_tofu_dir }}"
executable: /bin/bash
delegate_to: localhost
run_once: true
vars:
# Profile je VM aus dem Inventar (Gruppe gpu_llamacpp, Task 6.1)
_llamacpp_hosts: "{{ groups['gpu_llamacpp'] | default([]) }}"
changed_when: false
- name: file_sd-Verzeichnis
ansible.builtin.file:
path: "{{ infra_state_dir }}/file_sd"
state: directory
mode: "0755"
- name: file_sd-Ziele in den Container kopieren
ansible.builtin.copy:
src: "{{ infra_targets_dir }}/{{ item }}.json"
dest: "{{ infra_state_dir }}/file_sd/{{ item }}.json"
mode: "0644"
loop: [node, gpu, llamacpp]