ci / test (push) Successful in 25s
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>
161 lines
3.8 KiB
Terraform
161 lines
3.8 KiB
Terraform
# GPU-Mappings, GPU-VMs und Infra-LXC aus sites/<site>/proxmox.yaml.
|
||
# Nicht gegen einen echten Cluster getestet – beim gemeinsamen Deployment zuerst `tofu plan`.
|
||
|
||
resource "proxmox_virtual_environment_hardware_mapping_pci" "gpu" {
|
||
for_each = local.site.pci_mappings
|
||
name = each.key
|
||
map = [{
|
||
node = each.value.node
|
||
path = each.value.path
|
||
id = each.value.id
|
||
subsystem_id = each.value.subsystem_id
|
||
iommu_group = each.value.iommu_group
|
||
}]
|
||
}
|
||
|
||
resource "proxmox_virtual_environment_vm" "gpu" {
|
||
for_each = local.site.vms
|
||
name = each.key
|
||
node_name = each.value.node
|
||
vm_id = each.value.vmid
|
||
tags = ["knaster", each.value.role, each.value.driver_generation]
|
||
|
||
machine = "q35"
|
||
bios = "ovmf"
|
||
on_boot = true
|
||
|
||
clone {
|
||
vm_id = local.site.cluster.template_vmid
|
||
full = true
|
||
}
|
||
|
||
cpu {
|
||
cores = each.value.cores
|
||
type = "host"
|
||
}
|
||
|
||
# PCI-Passthrough pinnt den gesamten RAM → kein Ballooning
|
||
memory {
|
||
dedicated = each.value.memory_mb
|
||
floating = 0
|
||
}
|
||
|
||
efi_disk {
|
||
datastore_id = try(each.value.storage, local.site.cluster.storage_default)
|
||
type = "4m"
|
||
}
|
||
|
||
disk {
|
||
datastore_id = try(each.value.storage, local.site.cluster.storage_default)
|
||
interface = "scsi0"
|
||
size = each.value.disk_gb
|
||
discard = "on"
|
||
ssd = true
|
||
}
|
||
|
||
# Modelle: eigenes Disk-Image, nicht repliziert, nicht gesichert (ADR-0002)
|
||
disk {
|
||
datastore_id = try(each.value.storage, local.site.cluster.storage_default)
|
||
interface = "scsi1"
|
||
size = each.value.models_disk_gb
|
||
discard = "on"
|
||
ssd = true
|
||
backup = false
|
||
replicate = false
|
||
}
|
||
|
||
# Alle Karten des Knotens in eine VM (D2); Reihenfolge = Index in der VM
|
||
dynamic "hostpci" {
|
||
for_each = each.value.gpus
|
||
content {
|
||
device = "hostpci${hostpci.key}"
|
||
mapping = proxmox_virtual_environment_hardware_mapping_pci.gpu[hostpci.value].name
|
||
pcie = true
|
||
rombar = true
|
||
}
|
||
}
|
||
|
||
network_device {
|
||
bridge = local.site.cluster.bridge
|
||
vlan_id = local.site.cluster.vlan_svc # null = flaches Netz
|
||
}
|
||
|
||
initialization {
|
||
datastore_id = try(each.value.storage, local.site.cluster.storage_default)
|
||
ip_config {
|
||
ipv4 {
|
||
address = each.value.ip
|
||
gateway = local.site.cluster.gateway
|
||
}
|
||
}
|
||
dns {
|
||
servers = [local.site.cluster.dns]
|
||
}
|
||
user_account {
|
||
username = "knaster"
|
||
keys = [local.ssh_key]
|
||
}
|
||
}
|
||
}
|
||
|
||
resource "proxmox_virtual_environment_container" "lxc" {
|
||
for_each = local.site.containers
|
||
node_name = each.value.node
|
||
vm_id = each.value.vmid
|
||
tags = ["knaster", each.key]
|
||
unprivileged = true
|
||
start_on_boot = true
|
||
|
||
features {
|
||
nesting = try(each.value.nesting, true) # Docker im LXC
|
||
}
|
||
|
||
cpu {
|
||
cores = each.value.cores
|
||
}
|
||
|
||
memory {
|
||
dedicated = each.value.memory_mb
|
||
}
|
||
|
||
disk {
|
||
datastore_id = try(each.value.storage, local.site.cluster.storage_default)
|
||
size = each.value.disk_gb
|
||
}
|
||
|
||
operating_system {
|
||
template_file_id = local.site.cluster.lxc_template
|
||
type = "debian"
|
||
}
|
||
|
||
network_interface {
|
||
name = "eth0"
|
||
bridge = local.site.cluster.bridge
|
||
vlan_id = local.site.cluster.vlan_svc
|
||
}
|
||
|
||
initialization {
|
||
hostname = each.key
|
||
dns {
|
||
servers = [local.site.cluster.dns]
|
||
}
|
||
ip_config {
|
||
ipv4 {
|
||
address = each.value.ip
|
||
gateway = local.site.cluster.gateway
|
||
}
|
||
}
|
||
user_account {
|
||
keys = [local.ssh_key]
|
||
}
|
||
}
|
||
}
|
||
|
||
resource "proxmox_virtual_environment_haresource" "infra" {
|
||
for_each = { for k, v in local.site.containers : k => v if try(v.ha, false) }
|
||
resource_id = "ct:${each.value.vmid}"
|
||
state = "started"
|
||
comment = "knaster ${each.key}"
|
||
depends_on = [proxmox_virtual_environment_container.lxc]
|
||
}
|