feat(terraform): Create VMs from scratch with Ubuntu 24.04 cloud image
Some checks failed
CD - Deploy Infrastructure / Terraform Validation (push) Failing after 5s
CD - Deploy Infrastructure / Deploy on pve1 (push) Has been skipped
CD - Deploy Infrastructure / Deploy on pve2 (push) Has been skipped
CD - Deploy Infrastructure / Deploy on pve3 (push) Has been skipped
CD - Deploy Infrastructure / Validate K3s Cluster (push) Has been skipped
CD - Deploy Infrastructure / Deployment Notification (push) Failing after 1s

Changements majeurs:
- Supprime le clonage de template (clone/full_clone)
- Utilise l'image cloud Ubuntu 24.04 LTS directement
- Ajoute os_type = cloud-init pour support natif
- Configure Standard VGA pour compatibilité
- CPU type host pour meilleures performances
- BIOS seabios explicite

Avantages:
- Proxmox crée automatiquement les ressources LINSTOR
- Plus besoin de script Python de pré-provisioning
- Pas de dépendance sur template pré-existant
- Configuration via cloud-init uniquement

Pré-requis:
- Télécharger ubuntu-24.04-server-cloudimg-amd64.img sur chaque nœud
- Placer dans /var/lib/vz/template/iso/
This commit is contained in:
Tellsanguis 2025-11-27 13:09:18 +01:00
parent cc26fb97a6
commit 70f29227f0
3 changed files with 63 additions and 9 deletions

View file

@ -25,27 +25,38 @@ resource "proxmox_vm_qemu" "k3s_server_1" {
vmid = 1000
name = "k3s-server-1"
target_node = "acemagician"
clone = var.ubuntu_template
full_clone = true
# Création from scratch avec ISO Ubuntu 24.04
iso = "local:iso/ubuntu-24.04-server-cloudimg-amd64.img"
# Configuration matérielle
cpu {
cores = var.k3s_server_1_config.cores
sockets = 1
type = "host"
}
memory = var.k3s_server_1_config.memory
agent = 1
bios = "seabios"
boot = "order=scsi0"
scsihw = "virtio-scsi-single"
onboot = true
# Standard VGA pour compatibilité
vga {
type = "std"
}
# Réseau
network {
id = 0
model = "virtio"
bridge = var.k3s_network_bridge
}
# Disque sur LINSTOR
disk {
slot = "scsi0"
size = var.k3s_server_1_config.disk_size
@ -54,12 +65,19 @@ resource "proxmox_vm_qemu" "k3s_server_1" {
iothread = true
}
# Cloud-init configuration
ipconfig0 = "ip=${var.k3s_server_1_config.ip},gw=${var.k3s_gateway}"
cicustom = "user=${var.snippets_storage}:snippets/cloud-init-k3s-server-1.yaml"
nameserver = join(" ", var.k3s_dns)
# Pour cloud-init
os_type = "cloud-init"
lifecycle {
ignore_changes = [network]
ignore_changes = [
network,
iso
]
}
depends_on = [local_file.k3s_server_cloud_init]

View file

@ -25,27 +25,38 @@ resource "proxmox_vm_qemu" "k3s_server_2" {
vmid = 1001
name = "k3s-server-2"
target_node = "elitedesk"
clone = var.ubuntu_template
full_clone = true
# Création from scratch avec ISO Ubuntu 24.04
iso = "local:iso/ubuntu-24.04-server-cloudimg-amd64.img"
# Configuration matérielle
cpu {
cores = var.k3s_server_2_config.cores
sockets = 1
type = "host"
}
memory = var.k3s_server_2_config.memory
agent = 1
bios = "seabios"
boot = "order=scsi0"
scsihw = "virtio-scsi-single"
onboot = true
# Standard VGA pour compatibilité
vga {
type = "std"
}
# Réseau
network {
id = 0
model = "virtio"
bridge = var.k3s_network_bridge
}
# Disque sur LINSTOR
disk {
slot = "scsi0"
size = var.k3s_server_2_config.disk_size
@ -54,12 +65,19 @@ resource "proxmox_vm_qemu" "k3s_server_2" {
iothread = true
}
# Cloud-init configuration
ipconfig0 = "ip=${var.k3s_server_2_config.ip},gw=${var.k3s_gateway}"
cicustom = "user=${var.snippets_storage}:snippets/cloud-init-k3s-server-2.yaml"
nameserver = join(" ", var.k3s_dns)
# Pour cloud-init
os_type = "cloud-init"
lifecycle {
ignore_changes = [network]
ignore_changes = [
network,
iso
]
}
depends_on = [local_file.k3s_server_cloud_init]

View file

@ -25,27 +25,38 @@ resource "proxmox_vm_qemu" "etcd_witness" {
vmid = 1002
name = "etcd-witness"
target_node = "thinkpad"
clone = var.ubuntu_template
full_clone = true
# Création from scratch avec ISO Ubuntu 24.04
iso = "local:iso/ubuntu-24.04-server-cloudimg-amd64.img"
# Configuration matérielle
cpu {
cores = var.etcd_witness_config.cores
sockets = 1
type = "host"
}
memory = var.etcd_witness_config.memory
agent = 1
bios = "seabios"
boot = "order=scsi0"
scsihw = "virtio-scsi-single"
onboot = true
# Standard VGA pour compatibilité
vga {
type = "std"
}
# Réseau
network {
id = 0
model = "virtio"
bridge = var.k3s_network_bridge
}
# Disque sur local-lvm
disk {
slot = "scsi0"
size = var.etcd_witness_config.disk_size
@ -54,12 +65,19 @@ resource "proxmox_vm_qemu" "etcd_witness" {
iothread = true
}
# Cloud-init configuration
ipconfig0 = "ip=${var.etcd_witness_config.ip},gw=${var.k3s_gateway}"
cicustom = "user=${var.snippets_storage}:snippets/cloud-init-etcd-witness.yaml"
nameserver = join(" ", var.k3s_dns)
# Pour cloud-init
os_type = "cloud-init"
lifecycle {
ignore_changes = [network]
ignore_changes = [
network,
iso
]
}
depends_on = [local_file.etcd_witness_cloud_init]