mirror of
https://github.com/GoodOlClint/PSProxmoxVE.git
synced 2026-08-09 05:49:24 +00:00
b3005e1e72
Replace 4 per-node auto-install ISOs (~4GB) with 2 generic ISOs (~2GB) served by an HTTP answer server that routes per-node configs by MAC address. New flow: 1. Deterministic MAC addresses assigned per node (AA:BB:CC:00:VV:NN) 2. Per-MAC answer.toml files generated in answers/ directory 3. HTTP answer server (slothcroissant/proxmox-auto-installer-server) managed by Terraform, serves answer files on port 8000 4. Generic ISOs prepared with --fetch-from http --url pointing to the answer server 5. PVE installer POSTs system info, server matches MAC to answer file Benefits: - 50% reduction in ISO disk/tmp usage (2 ISOs instead of 4) - Faster ISO preparation (2 builds instead of 4) - Answer files can be updated without rebuilding ISOs - First-boot script embedded in generic ISO via --on-first-boot Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
96 lines
1.8 KiB
Terraform
96 lines
1.8 KiB
Terraform
terraform {
|
|
required_version = ">= 1.5.0"
|
|
required_providers {
|
|
proxmox = {
|
|
source = "bpg/proxmox"
|
|
version = ">= 0.70.0"
|
|
}
|
|
docker = {
|
|
source = "kreuzwerker/docker"
|
|
version = ">= 3.0.0"
|
|
}
|
|
}
|
|
}
|
|
|
|
provider "proxmox" {
|
|
endpoint = var.proxmox_endpoint
|
|
api_token = var.proxmox_api_token
|
|
insecure = var.proxmox_insecure
|
|
}
|
|
|
|
provider "docker" {
|
|
# Uses the Docker socket from the dev-infra container
|
|
# (mounted at /var/run/docker.sock)
|
|
}
|
|
|
|
resource "proxmox_virtual_environment_file" "auto_iso" {
|
|
for_each = var.pve_instances
|
|
content_type = "iso"
|
|
datastore_id = var.iso_storage
|
|
node_name = var.target_node
|
|
|
|
source_file {
|
|
path = each.value.iso_local_path
|
|
}
|
|
}
|
|
|
|
# ── Nested PVE VMs ────────────────────────────────────────────────────
|
|
|
|
resource "proxmox_virtual_environment_vm" "nested_pve" {
|
|
for_each = var.pve_instances
|
|
name = each.value.vm_name
|
|
node_name = var.target_node
|
|
vm_id = each.value.vm_id
|
|
|
|
machine = "q35"
|
|
bios = "ovmf"
|
|
boot_order = ["scsi0", "ide2"]
|
|
|
|
cpu {
|
|
type = "host"
|
|
cores = var.cores
|
|
sockets = 1
|
|
}
|
|
|
|
memory {
|
|
dedicated = var.memory
|
|
}
|
|
|
|
efi_disk {
|
|
datastore_id = var.disk_storage
|
|
type = "4m"
|
|
}
|
|
|
|
disk {
|
|
datastore_id = var.disk_storage
|
|
interface = "scsi0"
|
|
size = var.disk_size
|
|
file_format = "raw"
|
|
}
|
|
|
|
cdrom {
|
|
file_id = proxmox_virtual_environment_file.auto_iso[each.key].id
|
|
interface = "ide2"
|
|
}
|
|
|
|
network_device {
|
|
bridge = var.network_bridge
|
|
model = "virtio"
|
|
mac_address = each.value.mac_address
|
|
}
|
|
|
|
operating_system {
|
|
type = "l26"
|
|
}
|
|
|
|
agent {
|
|
enabled = true
|
|
}
|
|
|
|
started = true
|
|
|
|
lifecycle {
|
|
ignore_changes = [started, cdrom]
|
|
}
|
|
}
|