8 Commits

Author SHA1 Message Date
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
6 changed files with 23 additions and 45 deletions

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

@ -122,9 +122,6 @@ resource "proxmox_virtual_environment_vm" "proxmox-kubernetes-VM-template" {
network_device {
bridge = "vmbr0" # rede de gestão para comunicação com Cluster A
}
network_device {
bridge = "vmbr2"
}
initialization {
dns {
@ -136,11 +133,6 @@ initialization {
}
}
ip_config {
ipv4 {
address = "dhcp"
}
}
user_data_file_id = proxmox_virtual_environment_file.cloud_init_yaml.id
}
}
@ -178,12 +170,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
}
@ -192,28 +178,3 @@ resource "proxmox_virtual_environment_vm" "k8s_vms" {
enabled = true
}
}
resource "null_resource" "add_api_ip" {
for_each = {
for vm in var.proxmox_k8s_vms : vm.name => vm
}
triggers = {
vm_id = each.value.vm_id
}
provisioner "remote-exec" {
inline = [
"sudo ip addr add ${each.value.ip3} dev eth0"
]
connection {
type = "ssh"
host = split("/", each.value.ip)[0] // remove a máscara para conectar
user = each.value.extra_users[0].name
password = each.value.extra_users[0].password
timeout = "4m"
agent = false
}
}
}

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"]
},
]