This commit is contained in:
2025-02-24 06:21:11 -06:00
parent b549c9cfb2
commit 3c8bd3ffd0
3 changed files with 16 additions and 47 deletions

View File

@@ -8,7 +8,7 @@ variables:
GITLAB_TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/dmz GITLAB_TF_ADDRESS: ${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/terraform/state/dmz
image: image:
name: registry.internal.durp.info/opentofu/opentofu:latest name: registry.durp.info/opentofu/opentofu:latest
entrypoint: [""] entrypoint: [""]
.tf-init: .tf-init:
@@ -45,7 +45,7 @@ validate:
- changes: - changes:
- "dmz/terraform/*.tf" - "dmz/terraform/*.tf"
plan-dmzstructure: plan-dmz-infrastructure:
stage: plan stage: plan
variables: variables:
PLAN: plan.tfplan PLAN: plan.tfplan
@@ -66,7 +66,7 @@ plan-dmzstructure:
- changes: - changes:
- "dmz/terraform/*.tf" - "dmz/terraform/*.tf"
apply-dmzstructure: apply-dmz-infrastructure:
stage: apply stage: apply
variables: variables:
ENVIRONMENT_NAME: dmz ENVIRONMENT_NAME: dmz
@@ -78,9 +78,9 @@ apply-dmzstructure:
- changes: - changes:
- "dmz/terraform/*.tf" - "dmz/terraform/*.tf"
when: manual when: manual
needs: ["plan-dmzstructure"] needs: ["plan-dmz-infrastructure"]
destroy-dmzstructure: destroy-dmz-infrastructure:
stage: destroy stage: destroy
variables: variables:
ENVIRONMENT_NAME: dmz ENVIRONMENT_NAME: dmz
@@ -92,4 +92,4 @@ destroy-dmzstructure:
- changes: - changes:
- "dmz/terraform/*.tf" - "dmz/terraform/*.tf"
when: manual when: manual
needs: ["plan-dmzstructure"] needs: ["plan-dmz-infrastructure"]

View File

@@ -1,14 +1,13 @@
resource "proxmox_vm_qemu" "k3smaster" { resource "proxmox_vm_qemu" "k3smaster" {
lifecycle {
prevent_destroy = true
}
count = local.k3smaster.count count = local.k3smaster.count
ciuser = "administrator" ciuser = "administrator"
vmid = "${local.vlan}${local.k3smaster.ip[count.index]}"
name = local.k3smaster.name[count.index] name = local.k3smaster.name[count.index]
target_node = local.k3smaster.node[count.index] target_node = local.k3smaster.node[count.index]
clone = local.template
tags = local.k3smaster.tags tags = local.k3smaster.tags
full_clone = false
qemu_os = "l26" qemu_os = "l26"
full_clone = true
os_type = "cloud-init" os_type = "cloud-init"
agent = 1 agent = 1
cores = local.k3smaster.cores cores = local.k3smaster.cores
@@ -16,9 +15,10 @@ resource "proxmox_vm_qemu" "k3smaster" {
cpu_type = "host" cpu_type = "host"
memory = local.k3smaster.memory memory = local.k3smaster.memory
scsihw = "virtio-scsi-pci" scsihw = "virtio-scsi-pci"
boot = "order=virtio0" #bootdisk = "scsi0"
onboot = true boot = "order=virtio0"
sshkeys = local.sshkeys onboot = true
sshkeys = local.sshkeys
vga { vga {
type = "serial0" type = "serial0"
} }
@@ -57,16 +57,15 @@ resource "proxmox_vm_qemu" "k3smaster" {
} }
resource "proxmox_vm_qemu" "k3sserver" { resource "proxmox_vm_qemu" "k3sserver" {
lifecycle {
prevent_destroy = true
}
count = local.k3sserver.count count = local.k3sserver.count
ciuser = "administrator" ciuser = "administrator"
vmid = "${local.vlan}${local.k3sserver.ip[count.index]}"
name = local.k3sserver.name[count.index] name = local.k3sserver.name[count.index]
target_node = local.k3sserver.node[count.index] target_node = local.k3sserver.node[count.index]
clone = local.template
tags = local.k3sserver.tags tags = local.k3sserver.tags
qemu_os = "l26" qemu_os = "l26"
full_clone = false full_clone = true
os_type = "cloud-init" os_type = "cloud-init"
agent = 1 agent = 1
cores = local.k3sserver.cores cores = local.k3sserver.cores

View File

@@ -45,34 +45,4 @@ locals {
node = ["mothership", "overlord", "vanguard"] node = ["mothership", "overlord", "vanguard"]
ip = ["21", "22", "23"] ip = ["21", "22", "23"]
} }
haproxy = {
tags = "haproxy"
count = 3
name = ["haproxy-01", "haproxy-02", "haproxy-03"]
cores = 2
memory = "1024"
drive = 20
node = ["mothership", "overlord", "vanguard"]
ip = ["31", "32", "33"]
}
postgres = {
tags = "postgres"
count = 3
name = ["postgres-01", "postgres-02", "postgres-03"]
cores = 4
memory = "4096"
drive = 40
node = ["mothership", "overlord", "vanguard"]
ip = ["34", "35", "36"]
}
pihole = {
tags = "pihole"
count = 3
name = ["pihole-01", "pihole-02", "pihole-03"]
cores = 2
memory = "2048"
drive = 20
node = ["mothership", "overlord", "vanguard"]
ip = ["41", "42", "43"]
}
} }