diff --git a/nixos/modules/services/hypervisor-gitops/default.nix b/nixos/modules/services/hypervisor-gitops/default.nix index 2d9d05b..a7f5b7c 100644 --- a/nixos/modules/services/hypervisor-gitops/default.nix +++ b/nixos/modules/services/hypervisor-gitops/default.nix @@ -80,7 +80,7 @@ in { StateDirectory = "hypervisor-gitops"; WorkingDirectory = "/var/lib/hypervisor-gitops"; - ExecStart = "${hypervisorSyncScript}/bin/hypervisor-sync ${cfg.repoUrl} opentofu/nodes/mikoshi"; + ExecStart = "${hypervisorSyncScript}/bin/hypervisor-sync ${cfg.repoUrl} opentofu/workload-layer/production"; }; }; diff --git a/opentofu/modules/proxmox-node/main.tf b/opentofu/modules/proxmox-node/main.tf index a0fc0f7..8588875 100644 --- a/opentofu/modules/proxmox-node/main.tf +++ b/opentofu/modules/proxmox-node/main.tf @@ -7,40 +7,7 @@ terraform { } } -# Bare Metal Host Configurations (SSH Provisioning) -# We use a null_resource to run imperative commands on the Debian host -# that are not currently supported by the bpg/proxmox provider. -resource "null_resource" "bare_metal_setup" { - triggers = { - node = var.node_name - data_disk_id = var.data_disk_id - pool_name = var.zfs_pool_name - } - - connection { - type = "ssh" - user = "root" - # Assuming running locally on the node during bootstrap, or via SSH if run from a laptop. - # We default to local host if run from Control Center, but for flexibility we use the endpoint. - host = var.node_name - agent = true - } - - provisioner "remote-exec" { - inline = [ - # Set laptop lid switch to ignore (prevents sleeping when closed) - "sed -i 's/^#\\?HandleLidSwitch=.*/HandleLidSwitch=ignore/' /etc/systemd/logind.conf", - "systemctl restart systemd-logind", - - # Format the ZFS pool if it doesn't already exist - "zpool list ${var.zfs_pool_name} || zpool create -f ${var.zfs_pool_name} /dev/disk/by-id/${var.data_disk_id}", - - # Register the ZFS pool in Proxmox if it's not already registered - "pvesm status -storage ${var.zfs_pool_name} || pvesm add zfspool ${var.zfs_pool_name} --pool ${var.zfs_pool_name} --content images,rootdir" - ] - } -} # Resource Pools diff --git a/opentofu/modules/proxmox-node/variables.tf b/opentofu/modules/proxmox-node/variables.tf index 3bb24ed..25b521a 100644 --- a/opentofu/modules/proxmox-node/variables.tf +++ b/opentofu/modules/proxmox-node/variables.tf @@ -3,10 +3,6 @@ variable "node_name" { description = "The name of the Proxmox node (e.g. pve)" } -variable "data_disk_id" { - type = string - description = "The persistent block device ID for the data disk (e.g. wwn-0x500...)" -} variable "zfs_pool_name" { type = string diff --git a/opentofu/nodes/mikoshi/main.tf b/opentofu/workload-layer/production/main.tf similarity index 95% rename from opentofu/nodes/mikoshi/main.tf rename to opentofu/workload-layer/production/main.tf index 7e7a512..4d9a22d 100644 --- a/opentofu/nodes/mikoshi/main.tf +++ b/opentofu/workload-layer/production/main.tf @@ -19,7 +19,6 @@ provider "proxmox" { module "proxmox_node" { source = "../../modules/proxmox-node" node_name = "mikoshi" - data_disk_id = "nvme-KXG80ZNV2T04_NVMe_KIOXIA_2048GB_241C11Y5EHAK" zfs_pool_name = "data" } diff --git a/opentofu/staging-env/main.tf b/opentofu/workload-layer/staging/main.tf similarity index 100% rename from opentofu/staging-env/main.tf rename to opentofu/workload-layer/staging/main.tf diff --git a/scripts/hypervisor-sync.sh b/scripts/hypervisor-sync.sh index dba7a6a..809baa7 100644 --- a/scripts/hypervisor-sync.sh +++ b/scripts/hypervisor-sync.sh @@ -5,7 +5,7 @@ # Usage: ./hypervisor-sync.sh REPO_URL=${1:-"https://git.depeuter.dev/Bos55/nix-config.git"} -OPENTOFU_DIR=${2:-"opentofu/nodes/mikoshi"} +OPENTOFU_DIR=${2:-"opentofu/workload-layer/production"} echo "Starting Hypervisor GitOps sync..." diff --git a/scripts/staging-sync.sh b/scripts/staging-sync.sh index 0732afe..a62879e 100644 --- a/scripts/staging-sync.sh +++ b/scripts/staging-sync.sh @@ -26,7 +26,7 @@ fi # Ensure workspace directory exists for this PR WORKSPACE="/var/lib/hypervisor-gitops/staging-pr-${PR_NUMBER}" -OPENTOFU_SRC="/var/lib/hypervisor-gitops/nix-config/opentofu/staging-env" +OPENTOFU_SRC="/var/lib/hypervisor-gitops/nix-config/opentofu/workload-layer/staging" # TrueNAS API variables TRUENAS_URL=${TRUENAS_URL:-"https://192.168.0.11"}