From f071302722b8e5d4be55766c395671e9d7d29538 Mon Sep 17 00:00:00 2001 From: fenix-gitea-admin Date: Thu, 28 Aug 2025 16:50:07 +0000 Subject: [PATCH 1/5] revert 0d2aa11fcabde47d0640ebc24b529870c3490bd4 revert Update .gitea/workflows/ci-test.yaml --- .gitea/workflows/ci-test.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/ci-test.yaml b/.gitea/workflows/ci-test.yaml index 17d9af4..5301525 100644 --- a/.gitea/workflows/ci-test.yaml +++ b/.gitea/workflows/ci-test.yaml @@ -121,7 +121,8 @@ jobs: - name: Install dependencies run: | - pip install ruamel.yaml + pip install pyyaml + pip install yamllint - name: Init OpenTofu working-directory: infra/iac From 9c0adce319d051784afa3083361c925de2a6cfaf Mon Sep 17 00:00:00 2001 From: fenix-gitea-admin Date: Thu, 28 Aug 2025 16:51:11 +0000 Subject: [PATCH 2/5] Update .gitea/workflows/ci-test.yaml --- .gitea/workflows/ci-test.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitea/workflows/ci-test.yaml b/.gitea/workflows/ci-test.yaml index 5301525..17d9af4 100644 --- a/.gitea/workflows/ci-test.yaml +++ b/.gitea/workflows/ci-test.yaml @@ -121,8 +121,7 @@ jobs: - name: Install dependencies run: | - pip install pyyaml - pip install yamllint + pip install ruamel.yaml - name: Init OpenTofu working-directory: infra/iac From db3fdaa087064afe04c198b0d25e8ba7a7a23770 Mon Sep 17 00:00:00 2001 From: fenix-gitea-admin Date: Thu, 28 Aug 2025 16:52:38 +0000 Subject: [PATCH 3/5] Add cloud-init-wrapper.yaml.tftpl --- cloud-init-wrapper.yaml.tftpl | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 cloud-init-wrapper.yaml.tftpl diff --git a/cloud-init-wrapper.yaml.tftpl b/cloud-init-wrapper.yaml.tftpl new file mode 100644 index 0000000..b12fc44 --- /dev/null +++ b/cloud-init-wrapper.yaml.tftpl @@ -0,0 +1,2 @@ +#cloud-config +${content} \ No newline at end of file From 492bfc9519a062e845a71d5987f8a7e344a0ce53 Mon Sep 17 00:00:00 2001 From: fenix-gitea-admin Date: Thu, 28 Aug 2025 16:56:09 +0000 Subject: [PATCH 4/5] Update proxmox.tf --- proxmox.tf | 81 +++++++++++++++++------------------------------------- 1 file changed, 25 insertions(+), 56 deletions(-) diff --git a/proxmox.tf b/proxmox.tf index 569b7fe..0430dfa 100644 --- a/proxmox.tf +++ b/proxmox.tf @@ -79,7 +79,9 @@ resource "proxmox_virtual_environment_file" "vm_user_data" { content_type = "snippets" source_raw { file_name = "cloud-init-iac-k8s-${each.key}.yaml" - data = data.external.merged_yaml[each.key].result["merged_yaml"] + data = templatefile("${path.module}/cloud-init-wrapper.yaml.tpl", { + content = data.external.merged_yaml[each.key].result["merged_yaml"] + }) } } @@ -109,13 +111,6 @@ resource "proxmox_virtual_environment_vm" "proxmox-kubernetes-VM-template" { dedicated = 4096 } - # Configuração do disco rígido - #disk { - # datastore_id = "local-lvm" - # interface = "scsi1" - # size = 64 - #} - disk { datastore_id = "local-lvm" file_id = proxmox_virtual_environment_download_file.latest_ubunto_cloud_img.id @@ -128,17 +123,17 @@ resource "proxmox_virtual_environment_vm" "proxmox-kubernetes-VM-template" { bridge = "vmbr0" } -#initialization { -# dns { -# servers = ["1.1.1.1"] -# } -# ip_config { -# ipv4 { -# address = "dhcp" -# } -# } - #user_data_file_id = proxmox_virtual_environment_file.cloud_init_yaml.id -# } +initialization { + dns { + servers = ["1.1.1.1"] + } + ip_config { + ipv4 { + address = "dhcp" + } + } + user_data_file_id = proxmox_virtual_environment_file.cloud_init_yaml.id + } } @@ -148,12 +143,6 @@ resource "proxmox_virtual_environment_vm" "k8s_vms" { name = each.value.name node_name = each.value.node_name vm_id = each.value.vm_id - - started = false - tags = ["opentofu", "kubernetes", "fedora"] - machine = "q35" - bios = "seabios" - description = "kubernetes VM Template created via iac" cpu { cores = each.value.cores @@ -169,38 +158,18 @@ resource "proxmox_virtual_environment_vm" "k8s_vms" { interface = "scsi1" } - -initialization { - dns { - servers = ["1.1.1.1"] - } - ip_config { - ipv4 { - address = "dhcp" + initialization { + ip_config { + ipv4 { + address = each.value.ip + gateway = each.value.gateway + } } + + user_data_file_id = proxmox_virtual_environment_file.vm_user_data[each.key].id } - # ip_config { - # ipv4 { - # address = each.value.ip - # gateway = each.value.gateway - # } - # } - user_data_file_id = proxmox_virtual_environment_file.vm_user_data[each.key].id + agent { + enabled = true + } } - - disk { - datastore_id = "local-lvm" - file_id = proxmox_virtual_environment_download_file.latest_ubunto_cloud_img.id - interface = "scsi0" - file_format = "qcow2" - } - - # Configuração da interface de rede - network_device { - bridge = "vmbr0" - } - agent { - enabled = true - } -} From 37f5c52cc0de30e36a95a8508b3dd3eeb57c8738 Mon Sep 17 00:00:00 2001 From: fenix-gitea-admin Date: Thu, 28 Aug 2025 16:57:04 +0000 Subject: [PATCH 5/5] Update cloud-init-base.yaml --- cloud-init-base.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/cloud-init-base.yaml b/cloud-init-base.yaml index 0f65b2b..572b4c1 100644 --- a/cloud-init-base.yaml +++ b/cloud-init-base.yaml @@ -1,5 +1,10 @@ -hostname: test-ubuntu -timezone: America/Toronto +locale: "pt_PT.UTF-8" +keyboard: + layout: "pt" + variant: "nodeadkeys" + +users: + - default ssh_pwauth: true