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
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:
parent
cc26fb97a6
commit
70f29227f0
3 changed files with 63 additions and 9 deletions
|
|
@ -25,27 +25,38 @@ resource "proxmox_vm_qemu" "k3s_server_1" {
|
||||||
vmid = 1000
|
vmid = 1000
|
||||||
name = "k3s-server-1"
|
name = "k3s-server-1"
|
||||||
target_node = "acemagician"
|
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 {
|
cpu {
|
||||||
cores = var.k3s_server_1_config.cores
|
cores = var.k3s_server_1_config.cores
|
||||||
sockets = 1
|
sockets = 1
|
||||||
|
type = "host"
|
||||||
}
|
}
|
||||||
|
|
||||||
memory = var.k3s_server_1_config.memory
|
memory = var.k3s_server_1_config.memory
|
||||||
agent = 1
|
agent = 1
|
||||||
|
|
||||||
|
bios = "seabios"
|
||||||
boot = "order=scsi0"
|
boot = "order=scsi0"
|
||||||
scsihw = "virtio-scsi-single"
|
scsihw = "virtio-scsi-single"
|
||||||
onboot = true
|
onboot = true
|
||||||
|
|
||||||
|
# Standard VGA pour compatibilité
|
||||||
|
vga {
|
||||||
|
type = "std"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Réseau
|
||||||
network {
|
network {
|
||||||
id = 0
|
id = 0
|
||||||
model = "virtio"
|
model = "virtio"
|
||||||
bridge = var.k3s_network_bridge
|
bridge = var.k3s_network_bridge
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Disque sur LINSTOR
|
||||||
disk {
|
disk {
|
||||||
slot = "scsi0"
|
slot = "scsi0"
|
||||||
size = var.k3s_server_1_config.disk_size
|
size = var.k3s_server_1_config.disk_size
|
||||||
|
|
@ -54,12 +65,19 @@ resource "proxmox_vm_qemu" "k3s_server_1" {
|
||||||
iothread = true
|
iothread = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Cloud-init configuration
|
||||||
ipconfig0 = "ip=${var.k3s_server_1_config.ip},gw=${var.k3s_gateway}"
|
ipconfig0 = "ip=${var.k3s_server_1_config.ip},gw=${var.k3s_gateway}"
|
||||||
cicustom = "user=${var.snippets_storage}:snippets/cloud-init-k3s-server-1.yaml"
|
cicustom = "user=${var.snippets_storage}:snippets/cloud-init-k3s-server-1.yaml"
|
||||||
nameserver = join(" ", var.k3s_dns)
|
nameserver = join(" ", var.k3s_dns)
|
||||||
|
|
||||||
|
# Pour cloud-init
|
||||||
|
os_type = "cloud-init"
|
||||||
|
|
||||||
lifecycle {
|
lifecycle {
|
||||||
ignore_changes = [network]
|
ignore_changes = [
|
||||||
|
network,
|
||||||
|
iso
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
depends_on = [local_file.k3s_server_cloud_init]
|
depends_on = [local_file.k3s_server_cloud_init]
|
||||||
|
|
|
||||||
|
|
@ -25,27 +25,38 @@ resource "proxmox_vm_qemu" "k3s_server_2" {
|
||||||
vmid = 1001
|
vmid = 1001
|
||||||
name = "k3s-server-2"
|
name = "k3s-server-2"
|
||||||
target_node = "elitedesk"
|
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 {
|
cpu {
|
||||||
cores = var.k3s_server_2_config.cores
|
cores = var.k3s_server_2_config.cores
|
||||||
sockets = 1
|
sockets = 1
|
||||||
|
type = "host"
|
||||||
}
|
}
|
||||||
|
|
||||||
memory = var.k3s_server_2_config.memory
|
memory = var.k3s_server_2_config.memory
|
||||||
agent = 1
|
agent = 1
|
||||||
|
|
||||||
|
bios = "seabios"
|
||||||
boot = "order=scsi0"
|
boot = "order=scsi0"
|
||||||
scsihw = "virtio-scsi-single"
|
scsihw = "virtio-scsi-single"
|
||||||
onboot = true
|
onboot = true
|
||||||
|
|
||||||
|
# Standard VGA pour compatibilité
|
||||||
|
vga {
|
||||||
|
type = "std"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Réseau
|
||||||
network {
|
network {
|
||||||
id = 0
|
id = 0
|
||||||
model = "virtio"
|
model = "virtio"
|
||||||
bridge = var.k3s_network_bridge
|
bridge = var.k3s_network_bridge
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Disque sur LINSTOR
|
||||||
disk {
|
disk {
|
||||||
slot = "scsi0"
|
slot = "scsi0"
|
||||||
size = var.k3s_server_2_config.disk_size
|
size = var.k3s_server_2_config.disk_size
|
||||||
|
|
@ -54,12 +65,19 @@ resource "proxmox_vm_qemu" "k3s_server_2" {
|
||||||
iothread = true
|
iothread = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Cloud-init configuration
|
||||||
ipconfig0 = "ip=${var.k3s_server_2_config.ip},gw=${var.k3s_gateway}"
|
ipconfig0 = "ip=${var.k3s_server_2_config.ip},gw=${var.k3s_gateway}"
|
||||||
cicustom = "user=${var.snippets_storage}:snippets/cloud-init-k3s-server-2.yaml"
|
cicustom = "user=${var.snippets_storage}:snippets/cloud-init-k3s-server-2.yaml"
|
||||||
nameserver = join(" ", var.k3s_dns)
|
nameserver = join(" ", var.k3s_dns)
|
||||||
|
|
||||||
|
# Pour cloud-init
|
||||||
|
os_type = "cloud-init"
|
||||||
|
|
||||||
lifecycle {
|
lifecycle {
|
||||||
ignore_changes = [network]
|
ignore_changes = [
|
||||||
|
network,
|
||||||
|
iso
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
depends_on = [local_file.k3s_server_cloud_init]
|
depends_on = [local_file.k3s_server_cloud_init]
|
||||||
|
|
|
||||||
|
|
@ -25,27 +25,38 @@ resource "proxmox_vm_qemu" "etcd_witness" {
|
||||||
vmid = 1002
|
vmid = 1002
|
||||||
name = "etcd-witness"
|
name = "etcd-witness"
|
||||||
target_node = "thinkpad"
|
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 {
|
cpu {
|
||||||
cores = var.etcd_witness_config.cores
|
cores = var.etcd_witness_config.cores
|
||||||
sockets = 1
|
sockets = 1
|
||||||
|
type = "host"
|
||||||
}
|
}
|
||||||
|
|
||||||
memory = var.etcd_witness_config.memory
|
memory = var.etcd_witness_config.memory
|
||||||
agent = 1
|
agent = 1
|
||||||
|
|
||||||
|
bios = "seabios"
|
||||||
boot = "order=scsi0"
|
boot = "order=scsi0"
|
||||||
scsihw = "virtio-scsi-single"
|
scsihw = "virtio-scsi-single"
|
||||||
onboot = true
|
onboot = true
|
||||||
|
|
||||||
|
# Standard VGA pour compatibilité
|
||||||
|
vga {
|
||||||
|
type = "std"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Réseau
|
||||||
network {
|
network {
|
||||||
id = 0
|
id = 0
|
||||||
model = "virtio"
|
model = "virtio"
|
||||||
bridge = var.k3s_network_bridge
|
bridge = var.k3s_network_bridge
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Disque sur local-lvm
|
||||||
disk {
|
disk {
|
||||||
slot = "scsi0"
|
slot = "scsi0"
|
||||||
size = var.etcd_witness_config.disk_size
|
size = var.etcd_witness_config.disk_size
|
||||||
|
|
@ -54,12 +65,19 @@ resource "proxmox_vm_qemu" "etcd_witness" {
|
||||||
iothread = true
|
iothread = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Cloud-init configuration
|
||||||
ipconfig0 = "ip=${var.etcd_witness_config.ip},gw=${var.k3s_gateway}"
|
ipconfig0 = "ip=${var.etcd_witness_config.ip},gw=${var.k3s_gateway}"
|
||||||
cicustom = "user=${var.snippets_storage}:snippets/cloud-init-etcd-witness.yaml"
|
cicustom = "user=${var.snippets_storage}:snippets/cloud-init-etcd-witness.yaml"
|
||||||
nameserver = join(" ", var.k3s_dns)
|
nameserver = join(" ", var.k3s_dns)
|
||||||
|
|
||||||
|
# Pour cloud-init
|
||||||
|
os_type = "cloud-init"
|
||||||
|
|
||||||
lifecycle {
|
lifecycle {
|
||||||
ignore_changes = [network]
|
ignore_changes = [
|
||||||
|
network,
|
||||||
|
iso
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|
||||||
depends_on = [local_file.etcd_witness_cloud_init]
|
depends_on = [local_file.etcd_witness_cloud_init]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue