Files
cluster-knaster/platform/proxmox/ansible/roles/pve-host/tasks/main.yml
T
rorappandClaude Opus 5.5 c81e372c49
ci / test (push) Successful in 25s
sites: Inventar und Zielbild an echte Knoten (pve44–pve61) angepasst; ADR-0001/0002/0006 ergänzt
Aufbauplan Task 0.4:
- inventory.yaml: pve44/46/48/52/61 und GODE-PC-05/06 (Ada, Windows, cpu_roles: false)
- proxmox.yaml: eine GPU-VM pro Knoten mit allen Karten (D2), local-lvm/tank (D1 B),
  192.168.100.0/24 ohne VLAN, Gast-IPs .220–.239 (ANNAHME bis Task 0.2)
- registry.yaml/prometheus.yml: ops-Labels auf gpu-pve44/46/48, Ada ohne pve_node/vmid
- tofu: dynamische hostpci, Speicher je Gast; Ansible: pve_gpu_hosts/pve_kiosk,
  Replikation auf mehrere Ziele
- Placement: cpu_roles=false schließt Arbeitsplätze/Kiosk von CPU-Rollen aus
- PLAN §1.3/§1.4/§9 und ADR-Nachträge (D1 entschieden, D2/D3 Bestätigung offen)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 01:39:49 +02:00

78 lines
2.7 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.
- name: Site-Datei laden
ansible.builtin.set_fact:
knaster_pve: "{{ lookup('ansible.builtin.file', pve_site_file) | from_yaml }}"
run_once: true
delegate_to: localhost
- name: Bootloader erkennen (systemd-boot bei ZFS-Root, sonst GRUB)
ansible.builtin.stat:
path: /etc/kernel/cmdline
register: kernel_cmdline
- name: IOMMU aktivieren (systemd-boot)
ansible.builtin.replace:
path: /etc/kernel/cmdline
regexp: '^((?!.*intel_iommu=on).*)$'
replace: '\1 {{ pve_iommu_cmdline }}'
when: kernel_cmdline.stat.exists
notify: refresh boot
- name: IOMMU aktivieren (GRUB)
ansible.builtin.lineinfile:
path: /etc/default/grub
regexp: '^GRUB_CMDLINE_LINUX_DEFAULT="((?!.*intel_iommu=on).*)"$'
line: 'GRUB_CMDLINE_LINUX_DEFAULT="\1 {{ pve_iommu_cmdline }}"'
backrefs: true
when: not kernel_cmdline.stat.exists
notify: refresh boot
- name: VFIO-Module laden
ansible.builtin.copy:
dest: /etc/modules-load.d/vfio.conf
content: "{{ pve_vfio_modules | join('\n') }}\n"
mode: "0644"
- name: NVIDIA-Treiber auf dem Host sperren (GPU gehört der VM)
ansible.builtin.copy:
dest: /etc/modprobe.d/blacklist-nvidia.conf
content: |
blacklist nouveau
blacklist nvidia
blacklist nvidiafb
mode: "0644"
notify: refresh boot
- name: ZFS-Pool tank vorhanden?
ansible.builtin.command: zpool list -H -o name tank
register: tank
changed_when: false
failed_when: false
- name: Hinweis, falls tank fehlt (Pool wird bewusst NICHT automatisch angelegt – Datenverlustgefahr)
ansible.builtin.debug:
msg: >-
Auf {{ inventory_hostname }} fehlt der ZFS-Pool 'tank'. Nach Freigabe (D1) und Prüfung mit
`lsblk -o NAME,SIZE,FSTYPE,LABEL /dev/sdb`: zpool create -o ashift=12 -O compression=lz4 -O atime=off
tank /dev/disk/by-id/<ssd2> && pvesm add zfspool tank --pool tank --content images,rootdir
when:
- tank.rc != 0
- knaster_pve.nodes[inventory_hostname].zfs_tank | default(false)
- name: Bestehende Replikationsjobs lesen
ansible.builtin.command: pvesr list
register: pvesr_jobs
changed_when: false
# Ein Job pro Ziel: <vmid>-0, <vmid>-1, … (Reihenfolge aus replicate_to)
- name: ZFS-Replikation für HA-Gäste
ansible.builtin.command: >
pvesr create-local-job {{ item.0.value.vmid }}-{{ idx }} {{ item.1 }}
--schedule '{{ knaster_pve.replication_schedule }}' --comment 'knaster {{ item.0.key }}'
loop: "{{ knaster_pve.containers | dict2items | subelements('value.replicate_to', skip_missing=true) }}"
vars:
idx: "{{ item.0.value.replicate_to.index(item.1) }}"
when:
- item.0.value.node == inventory_hostname
- ((item.0.value.vmid | string) + '-' + (idx | string)) not in pvesr_jobs.stdout
changed_when: true