another one bites the dust

This commit is contained in:
Alex
2025-09-03 15:29:13 +02:00
parent 7ec0331d31
commit 482add90dc

View File

@@ -48,6 +48,7 @@ resource "proxmox_vm_qemu" "controller" {
} }
memory = 1024 memory = 1024
scsihw = "virtio-scsi-pci" scsihw = "virtio-scsi-pci"
os_type = "cloud-init"
disks { disks {
scsi { scsi {
scsi0 { scsi0 {
@@ -75,15 +76,19 @@ resource "proxmox_vm_qemu" "controller" {
cipassword = var.admin_password cipassword = var.admin_password
sshkeys = var.ssh_public_key sshkeys = var.ssh_public_key
cicustom = <<EOT connection {
#cloud-config type = "ssh"
package_update: true user = var.admin_user
packages: private_key = var.ssh_public_key
- curl host = var.controller_ip
runcmd: port = 22
- | }
curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="server --cluster-init --token=${random_password.k3s_token.result} --write-kubeconfig-mode=644" sh -
EOT provisioner "remote-exec" {
inline = [
"curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC=\"server --cluster-init --token=${random_password.k3s_token.result} --write-kubeconfig-mode=644\" sh -"
]
}
} }
# ---------------------- # ----------------------
@@ -94,6 +99,7 @@ resource "proxmox_vm_qemu" "worker1" {
target_node = var.target_nodes["worker1"] target_node = var.target_nodes["worker1"]
clone_id = var.template_id clone_id = var.template_id
full_clone = true full_clone = true
os_type = "cloud-init"
cpu { cpu {
cores = 2 cores = 2
sockets = 1 sockets = 1
@@ -127,15 +133,19 @@ resource "proxmox_vm_qemu" "worker1" {
cipassword = var.admin_password cipassword = var.admin_password
sshkeys = var.ssh_public_key sshkeys = var.ssh_public_key
cicustom = <<EOT connection {
#cloud-config type = "ssh"
package_update: true user = var.admin_user
packages: private_key = var.ssh_public_key
- curl host = var.worker1_ip
runcmd: port = 22
- | }
curl -sfL https://${var.controller_ip}:6443 | K3S_URL=https://${var.controller_ip}:6443 K3S_TOKEN=${random_password.k3s_token.result} sh -
EOT provisioner "remote-exec" {
inline = [
"curl -sfL https://${var.controller_ip}:6443 | K3S_URL=https://${var.controller_ip}:6443 K3S_TOKEN=${random_password.k3s_token.result} sh -"
]
}
} }
# ---------------------- # ----------------------
@@ -146,6 +156,7 @@ resource "proxmox_vm_qemu" "worker2" {
target_node = var.target_nodes["worker2"] target_node = var.target_nodes["worker2"]
clone_id = var.template_id clone_id = var.template_id
full_clone = true full_clone = true
os_type = "cloud-init"
cpu { cpu {
cores = 2 cores = 2
sockets = 1 sockets = 1
@@ -179,15 +190,19 @@ resource "proxmox_vm_qemu" "worker2" {
cipassword = var.admin_password cipassword = var.admin_password
sshkeys = var.ssh_public_key sshkeys = var.ssh_public_key
cicustom = <<EOT connection {
#cloud-config type = "ssh"
package_update: true user = var.admin_user
packages: private_key = var.ssh_public_key
- curl host = var.worker2_ip
runcmd: port = 22
- | }
curl -sfL https://${var.controller_ip}:6443 | K3S_URL=https://${var.controller_ip}:6443 K3S_TOKEN=${random_password.k3s_token.result} sh -
EOT provisioner "remote-exec" {
inline = [
"curl -sfL https://${var.controller_ip}:6443 | K3S_URL=https://${var.controller_ip}:6443 K3S_TOKEN=${random_password.k3s_token.result} sh -"
]
}
} }
# ---------------------- # ----------------------