Files
cluster-knaster/platform/proxmox/tofu/outputs.tf
T
Robert RappandClaude Opus 5.5 ff74c1a7b2
ci / test (push) Successful in 28s
tofu: GPU-VMs mit allen Karten des Knotens, DHCP über Gast-Agent, Provider für PVE 9
bpg/proxmox ~> 0.116.0 (nur API). Template je Knoten, Speicher je Gast,
hostpci dynamisch aus vms.*.gpus, kein Secure Boot (DKMS), Vendor-Snippet
für den qemu-guest-agent, Ausgabe ansible_inventory für die DHCP-Adressen.
scripts/make-template.sh legt das Ubuntu-24.04-Template mit Prüfsumme an.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-12 19:04:56 +02:00

27 lines
987 B
Terraform

locals {
# Erste IPv4 der Gast-Netzkarte laut qemu-guest-agent (ohne lo, Docker- und Bridge-Interfaces)
gpu_vm_ipv4 = {
for k, v in proxmox_virtual_environment_vm.gpu : k => try(flatten([
for i, name in v.network_interface_names : v.ipv4_addresses[i]
if !contains(["lo"], name) && !startswith(name, "docker") && !startswith(name, "br-") && !startswith(name, "veth")
])[0], null)
}
}
output "gpu_vms" {
value = { for k, v in proxmox_virtual_environment_vm.gpu : k => { node = v.node_name, vmid = v.vm_id, ipv4 = local.gpu_vm_ipv4[k] } }
}
output "infra_containers" {
value = { for k, v in proxmox_virtual_environment_container.infra : k => { node = v.node_name, vmid = v.vm_id } }
}
# tofu output -raw ansible_inventory > ../ansible/inventory.generated.yml
output "ansible_inventory" {
value = yamlencode({
all = { children = { gpu_vms = { hosts = {
for k, ip in local.gpu_vm_ipv4 : k => { ansible_host = ip } if ip != null
} } } }
})
}