From bb516260e2de221babfa514e280ecc24616266d1 Mon Sep 17 00:00:00 2001 From: v Date: Fri, 30 Oct 2026 17:33:26 +0300 Subject: [PATCH] refactor(infra): wire atlas.yaml SSOT to ansible and opentofu --- ansible/group_vars/all.yml | 4 ++++ tofu/compute.tf | 30 +++++++++--------------------- tofu/locals.tf | 3 +++ 3 files changed, 16 insertions(+), 21 deletions(-) create mode 100644 ansible/group_vars/all.yml create mode 100644 tofu/locals.tf diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml new file mode 100644 index 0000000..0a54be8 --- /dev/null +++ b/ansible/group_vars/all.yml @@ -0,0 +1,4 @@ +atlas: "{{ lookup('file', playbook_dir + '/../../atlas.yaml') | from_yaml }}" +root_domain: "{{ atlas.domain.root }}" +reality_server_name: "{{ atlas.domain.reality }}" +traefik_vip: "{{ atlas.network.traefik_vip }}" diff --git a/tofu/compute.tf b/tofu/compute.tf index aa344ee..6e5d25a 100644 --- a/tofu/compute.tf +++ b/tofu/compute.tf @@ -4,10 +4,6 @@ variable "talos_iso_file_id" { default = "local:iso/talos-amd64.iso" } -# ============================================================================== -# ROUTING & EDGE (VyOS) -# ============================================================================== - resource "proxmox_virtual_environment_vm" "vyos_router" { vm_id = 100 name = "vyos-router" @@ -69,7 +65,7 @@ resource "proxmox_virtual_environment_vm" "vyos_router" { } user_account { username = "vyos" - keys = var.authorized_keys + keys = local.atlas.access.authorized_keys } } @@ -82,10 +78,6 @@ resource "proxmox_virtual_environment_vm" "vyos_router" { } } -# ============================================================================== -# TIER-0 LXC CONTAINERS (AIR-GAP FOUNDATION) -# ============================================================================== - resource "proxmox_virtual_environment_container" "dns0" { vm_id = 101 node_name = "pve0" @@ -115,7 +107,7 @@ resource "proxmox_virtual_environment_container" "dns0" { gateway = "10.0.10.1" } } - user_account { keys = var.authorized_keys } + user_account { keys = local.atlas.access.authorized_keys } } operating_system { @@ -162,7 +154,7 @@ resource "proxmox_virtual_environment_container" "vault0" { gateway = "10.0.10.1" } } - user_account { keys = var.authorized_keys } + user_account { keys = local.atlas.access.authorized_keys } } operating_system { @@ -209,7 +201,7 @@ resource "proxmox_virtual_environment_container" "git0" { gateway = "10.0.10.1" } } - user_account { keys = var.authorized_keys } + user_account { keys = local.atlas.access.authorized_keys } } operating_system { @@ -256,7 +248,7 @@ resource "proxmox_virtual_environment_container" "storage0" { gateway = "10.0.10.1" } } - user_account { keys = var.authorized_keys } + user_account { keys = local.atlas.access.authorized_keys } } operating_system { @@ -299,7 +291,7 @@ resource "proxmox_virtual_environment_container" "registry0" { gateway = "10.0.10.1" } } - user_account { keys = var.authorized_keys } + user_account { keys = local.atlas.access.authorized_keys } } operating_system { @@ -317,10 +309,6 @@ resource "proxmox_virtual_environment_container" "registry0" { } } -# ============================================================================== -# TALOS KUBERNETES CLUSTER -# ============================================================================== - resource "proxmox_virtual_environment_vm" "talos_master_1" { vm_id = 201 name = "talos-master-1" @@ -355,7 +343,7 @@ resource "proxmox_virtual_environment_vm" "talos_master_1" { bridge = "vmbr0" vlan_id = 20 model = "virtio" - mac_address = "BC:24:11:71:B6:82" + mac_address = upper(local.atlas.hosts.talos_master_1.mac) } operating_system { @@ -401,7 +389,7 @@ resource "proxmox_virtual_environment_vm" "talos_worker_1" { bridge = "vmbr0" vlan_id = 20 model = "virtio" - mac_address = "BC:24:11:12:C5:1B" + mac_address = upper(local.atlas.hosts.talos_worker_1.mac) } network_device { @@ -453,7 +441,7 @@ resource "proxmox_virtual_environment_vm" "talos_worker_2" { bridge = "vmbr0" vlan_id = 20 model = "virtio" - mac_address = "BC:24:11:EF:1A:D4" + mac_address = upper(local.atlas.hosts.talos_worker_2.mac) } network_device { diff --git a/tofu/locals.tf b/tofu/locals.tf new file mode 100644 index 0000000..387b0c4 --- /dev/null +++ b/tofu/locals.tf @@ -0,0 +1,3 @@ +locals { + atlas = yamldecode(file("${path.module}/../atlas.yaml")) +}