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