32 Commits

Author SHA1 Message Date
705c5df1f5 [deploy-opentofu]
[deploy-opentofu]
2025-12-09 19:38:15 +00:00
88de7affda [deploy-opentofu]
[deploy-opentofu]
2025-12-09 13:40:55 +00:00
4934c33104 c
c
2025-12-08 15:26:32 +00:00
d2241e2dfa Update proxmox.variables.tf 2025-12-08 15:25:54 +00:00
6fc1890c1c [deploy-opentofu]
[deploy-opentofu]
2025-12-08 15:18:37 +00:00
3e49c091f5 a
a
2025-12-08 15:17:35 +00:00
39cb2a6c20 [deploy-opentofu]
[deploy-opentofu]
2025-12-08 15:05:01 +00:00
c11f2e3c25 a
a
2025-12-08 15:04:19 +00:00
badfc5fa24 [deploy-opentofu]
[deploy-opentofu]
2025-12-08 14:42:03 +00:00
d3db951dfa [deploy-opentofu]
[deploy-opentofu]
2025-12-08 14:33:59 +00:00
7a32716a23 Update proxmox.variables.tf 2025-12-08 14:26:40 +00:00
1a8f746bbd Update proxmox.tf 2025-12-02 14:14:36 +00:00
c70b254a84 [deploy-opentofu] 2025-11-07 17:21:29 +00:00
fb1f46a27d Update proxmox.tf 2025-11-05 19:15:36 +00:00
3a6706b9bc Update proxmox.tf 2025-11-05 14:33:56 +00:00
a9ad0e9330 [deploy-opentofu] 2025-11-03 22:15:43 +00:00
0e904c0366 [deploy-opentofu]
[deploy-opentofu]
2025-11-03 20:01:54 +00:00
8097582377 [deploy-opentofu] 2025-11-03 19:59:37 +00:00
a56cd76a0b [deploy-opentofu] 2025-10-29 13:02:13 +00:00
5559b61530 [deploy-opentofu]
[deploy-opentofu]
2025-10-28 20:24:17 +00:00
a4b33a570b secrets 2025-10-23 08:50:34 +01:00
c7c1388112 Add secrets/iac.vaultwarden-link 2025-10-23 07:44:00 +00:00
b875d6428b Add secrets/iac.proxmox.ssh.link 2025-10-23 07:43:24 +00:00
e1b0d702c5 Update secrets/proxmox.secrets.tfvars 2025-10-23 07:41:14 +00:00
a7f3b6d7e1 [deploy-opentofu]
[deploy-opentofu]
2025-10-21 19:25:08 +00:00
fcc7c9814a Update proxmox.tf 2025-10-21 19:24:32 +00:00
cc441d8ad8 [deploy-opentofu]
[deploy-opentofu]
2025-10-16 09:52:09 +00:00
e71295794f [deploy-opentofu]
[deploy-opentofu]
2025-10-16 09:24:35 +00:00
7c46db0253 [deploy-opentofu]
[deploy-opentofu]
2025-10-15 21:40:03 +00:00
218ca3fc2f [deploy-opentofu]
[deploy-opentofu]
2025-10-15 21:32:42 +00:00
58d080dadd a 2025-10-15 21:19:39 +00:00
f797aa6d8b [deploy-opentofu] 2025-10-15 21:19:11 +00:00
8 changed files with 47 additions and 24 deletions

View File

@ -2,7 +2,7 @@ https://spacelift.io/blog/opentofu-tutorial - explaining language of opentofu
https://opentofu.org/docs/intro/ - quick start and explaning who to work in team
https://opentofu.org/docs/intro/ - CICD for opentofu explained
https://opentofu.org/docs/intro/ - CICD for opentofu explained

View File

@ -1,5 +1,5 @@
#!/usr/bin/env python3
from ruamel.yaml import YAML
from ruamel.yaml import YAML
import sys
import json
from collections.abc import Mapping

View File

@ -19,7 +19,7 @@ resource "proxmox_virtual_environment_download_file" "latest_ubunto_cloud_img" {
content_type = "iso"
datastore_id = "local"
node_name = "fenix"
url = "https://cloud-images.ubuntu.com/jammy/20250725/jammy-server-cloudimg-amd64.img"
url = "https://cloud-images.ubuntu.com/jammy/20251206/jammy-server-cloudimg-amd64.img"
file_name = "jammyservercloudimgamd64.img"
}
@ -105,6 +105,7 @@ resource "proxmox_virtual_environment_vm" "proxmox-kubernetes-VM-template" {
cpu {
cores = 2
type = "host"
}
memory {
@ -116,16 +117,14 @@ resource "proxmox_virtual_environment_vm" "proxmox-kubernetes-VM-template" {
file_id = proxmox_virtual_environment_download_file.latest_ubunto_cloud_img.id
interface = "scsi0"
file_format = "qcow2"
size = 64
}
# Configuração da interface de rede
network_device {
bridge = "vmbr0" # rede de gestão para comunicação com Cluster A
bridge = "vmbr0" # rede de gestão para comunicação com Cluster B
}
network_device {
bridge = "vmbr2"
}
initialization {
dns {
servers = ["1.1.1.1"]
@ -136,11 +135,6 @@ initialization {
}
}
ip_config {
ipv4 {
address = "dhcp"
}
}
user_data_file_id = proxmox_virtual_environment_file.cloud_init_yaml.id
}
}
@ -155,10 +149,12 @@ resource "proxmox_virtual_environment_vm" "k8s_vms" {
clone {
vm_id = proxmox_virtual_environment_vm.proxmox-kubernetes-VM-template.id
full = true
}
cpu {
cores = each.value.cores
type = "host"
}
memory {
@ -171,6 +167,16 @@ resource "proxmox_virtual_environment_vm" "k8s_vms" {
interface = "scsi1"
}
# Bloco dinâmico para lista de hostpci
dynamic "hostpci" {
for_each = try(each.value.hostpci, [])
content {
device = hostpci.value.device
pcie = try(hostpci.value.pcie, true)
mapping = hostpci.value.mapping
}
}
initialization {
ip_config {
ipv4 {
@ -178,12 +184,6 @@ resource "proxmox_virtual_environment_vm" "k8s_vms" {
gateway = each.value.gateway
}
}
ip_config {
ipv4 {
address = each.value.ip2
gateway = each.value.gateway
}
}
user_data_file_id = proxmox_virtual_environment_file.vm_user_data[each.key].id
}

View File

@ -41,6 +41,12 @@ variable "proxmox_k8s_vms" {
node_name = string
ip = string
ip2 = string
ip3 = string
hostpci = optional(list(object({
pcie = bool
device = string
mapping = string
})))
cores = optional(number)
memory = optional(number)
data_store = optional(string)

View File

@ -0,0 +1,13 @@
[master]
master1 ansible_host=192.168.1.99 ansible_user=user ansible_ssh_pass=pass ansible_ssh_common_args='-o StrictHostKeyChecking=no'
[workers]
worker-192-168-1-101 ansible_host=192.168.1.101 ansible_user=user ansible_ssh_pass=pass ansible_ssh_common_args='-o StrictHostKeyChecking=no'

View File

@ -0,0 +1 @@
proxmox-ssh.example.com

View File

@ -0,0 +1 @@
https://vaultwarden.example.com

View File

@ -1,6 +1,6 @@
proxmox_server = "proxmox.example.com"
PM_API_TOKEN_ID = "tokenid"
PM_API_TOKEN_SECRET = "tokensecret"
#proxmox_server = "proxmox.example.com"
#PM_API_TOKEN_ID = "tokenid"
#PM_API_TOKEN_SECRET = "tokensecret"
# tokenid is read automatically from PM_API_TOKEN_ID
# token is read automatically from PM_API_TOKEN_SECRET
@ -20,6 +20,7 @@ proxmox_k8s_vms = [
vm_id = 3001
node_name = "node"
ip = "192.168.1.99/24"
ip3 = "192.168.1.199/24"
cores = 2
memory = 2000
disk_size = 32
@ -33,13 +34,14 @@ proxmox_k8s_vms = [
}
]
extra_packages = []
extra_runcmd = []
extra_runcmd = ["sudo ip addr add 192.168.1.199/24 dev eth0"]
},
{
name = "k8s-worker-01"
vm_id = 3002
node_name = "node"
ip = "192.168.1.101/24"
ip3 = "192.168.1.201/24"
cores = 1
memory = 2000
disk_size = 32
@ -53,6 +55,6 @@ proxmox_k8s_vms = [
}
]
extra_packages = []
extra_runcmd = []
extra_runcmd = ["sudo ip addr add 192.168.1.201/24 dev eth0"]
},
]