diff --git a/proxmox/archlinux/data_dns.tf b/proxmox/archlinux/data_dns.tf index 84dda4e..cad833e 100644 --- a/proxmox/archlinux/data_dns.tf +++ b/proxmox/archlinux/data_dns.tf @@ -4,6 +4,6 @@ data "dns_a_record_set" "guests" { } data "dns_aaaa_record_set" "guests" { - for_each = var.vm_guests + for_each = toset([for key,value in var.vm_guests: key if value.role != "download_client"]) host = "${each.key}.${var.local_domain}" } diff --git a/proxmox/archlinux/resources_proxmox.tf b/proxmox/archlinux/resources_proxmox.tf index 86e7780..1750a9f 100644 --- a/proxmox/archlinux/resources_proxmox.tf +++ b/proxmox/archlinux/resources_proxmox.tf @@ -29,7 +29,7 @@ resource "proxmox_virtual_environment_vm" "this" { wait_for_ip { disabled = false ipv4 = true - ipv6 = true + ipv6 = each.value.role == "download_client" ? false : true } } audio_device { @@ -46,7 +46,7 @@ resource "proxmox_virtual_environment_vm" "this" { type = "x86-64-v2" units = 100 } - description = each.value.role == "container_host" ? "Arch Linux container host" : "Arch Linux download client" + description = each.value.description disk { aio = "io_uring" backup = true @@ -61,7 +61,7 @@ resource "proxmox_virtual_environment_vm" "this" { size = 64 } dynamic "disk" { - for_each = each.value.role == "container_host" ? [1] : [] + for_each = each.value.role == "cluster_support" ? [1] : [] content { aio = "io_uring" backup = true @@ -92,16 +92,19 @@ resource "proxmox_virtual_environment_vm" "this" { file_format = "raw" dns { domain = var.local_domain - servers = concat(var.ipv4_nameservers, var.ipv6_nameservers) + servers = each.value.role == "download_client" ? var.ipv4_nameservers : concat(var.ipv4_nameservers, var.ipv6_nameservers) } ip_config { ipv4 { address = "${data.dns_a_record_set.guests[each.key].addrs[0]}/${var.ipv4_subnet_mask}" gateway = var.ipv4_gateway } - ipv6 { - address = "${data.dns_aaaa_record_set.guests[each.key].addrs[0]}/64" - gateway = var.ipv6_gateway + dynamic "ipv6" { + for_each = each.value.role != "download_client" ? [1] : [] + content { + address = "${data.dns_aaaa_record_set.guests[each.key].addrs[0]}/64" + gateway = var.ipv6_gateway + } } } user_account { diff --git a/proxmox/archlinux/variables.tf b/proxmox/archlinux/variables.tf index 78cdf02..1f82135 100644 --- a/proxmox/archlinux/variables.tf +++ b/proxmox/archlinux/variables.tf @@ -2,6 +2,7 @@ variable "vm_guests" { type = map(object({ host = string role = string + description = string })) } diff --git a/proxmox/archlinux/vars_archlinux.auto.tfvars b/proxmox/archlinux/vars_archlinux.auto.tfvars index 4ec38b3..85b298b 100644 --- a/proxmox/archlinux/vars_archlinux.auto.tfvars +++ b/proxmox/archlinux/vars_archlinux.auto.tfvars @@ -1,2 +1,2 @@ -arch_mirror = "mirrors.kernel.org/archlinux" +arch_mirror = "mirrors.mit.edu/archlinux" arch_username = "ladmin" \ No newline at end of file diff --git a/proxmox/archlinux/vars_vms.auto.tfvars b/proxmox/archlinux/vars_vms.auto.tfvars index 3c7596b..a06ac39 100644 --- a/proxmox/archlinux/vars_vms.auto.tfvars +++ b/proxmox/archlinux/vars_vms.auto.tfvars @@ -1,14 +1,27 @@ vm_guests = { - ch01 ={ + ns01 ={ host = "hv02" - role = "container_host" + role = "nameserver" + description = "Authoritative nameserver, 1 of 2" } - ch02 ={ + ns02 ={ host = "hv03" - role = "container_host" + role = "nameserver" + description = "Authoritative nameserver, 2 of 2" + } + cs01 ={ + host = "hv02" + role = "cluster_support" + description = "Cluster support server (registry, gitops repo), 1 of 2" + } + cs02 ={ + host = "hv03" + role = "cluster_support" + description = "Cluster support server (registry, gitops repo), 2 of 2" } dl01 ={ - host = "hv03" + host = "hv01" role = "download_client" + description = "Torrent search and download server, IPv4 only" } } \ No newline at end of file