Archlinux on pve working

This commit is contained in:
2026-09-08 02:51:19 -04:00
parent 02516f403a
commit c32aa4982c
6 changed files with 184 additions and 39 deletions
+4 -4
View File
@@ -1,9 +1,9 @@
data "dns_a_record_set" "guests" { data "dns_a_record_set" "guests" {
for_each = toset([ for guest in var.vm_guests: guest.name ]) for_each = var.vm_guests
host = "${each.value}.${var.local_domain}" host = "${each.key}.${var.local_domain}"
} }
data "dns_aaaa_record_set" "guests" { data "dns_aaaa_record_set" "guests" {
for_each = toset([ for guest in var.vm_guests: guest.name ]) for_each = var.vm_guests
host = "${each.value}.${var.local_domain}" host = "${each.key}.${var.local_domain}"
} }
+162 -9
View File
@@ -1,16 +1,169 @@
resource "proxmox_virtual_environment_file" "arch_qcow" { resource "proxmox_download_file" "arch_qcow" {
for_each = data.proxmox_virtual_environment_node.hvc01 for_each = data.proxmox_virtual_environment_node.hvc01
checksum = local.arch_qcow_hash
checksum_algorithm = "sha256"
content_type = "import" content_type = "import"
datastore_id = "local" datastore_id = "local"
file_name = "archlinux_cloudimg_amd64.qcow2"
node_name = each.value.id node_name = each.value.id
overwrite = true overwrite = true
source_file { overwrite_unmanaged = true
checksum = local.arch_qcow_hash upload_timeout = 300
file_name = "archlinux_cloudimg_amd64.qcow2" url = "https://${var.arch_mirror}/images/latest/Arch-Linux-x86_64-cloudimg.qcow2"
insecure = false verify = true
min_tls = "1.2"
path = "https://${var.arch_mirror}/images/latest/Arch-Linux-x86_64-cloudimg.qcow2"
} }
timeout_upload = 300
upload_mode = "stream" resource "proxmox_virtual_environment_pool" "archlinux" {
comment = "Container hosts and download client"
pool_id = "archlinux"
} }
resource "proxmox_virtual_environment_vm" "container_hosts" {
for_each = { for key, value in var.vm_guests: key => value if value.role == "container_host" }
acpi = false
agent {
enabled = true
timeout = "10m"
trim = false
type = "virtio"
wait_for_ip {
disabled = false
ipv4 = true
ipv6 = true
}
}
audio_device {
enabled = false
}
bios = "ovmf"
cpu {
# architecture = "x86_64"
cores = 1
flags = ["+aes"]
hotplugged = 0
limit = 0
numa = false
sockets = 1
type = "x86-64-v2"
units = 100
}
description = "Arch Linux container host"
disk {
aio = "io_uring"
backup = true
cache = "none"
datastore_id = "local-lvm"
# path_in_datastore = "${each.key}_root.qcow2"
discard = "ignore"
file_format = "raw"
file_id = proxmox_download_file.arch_qcow[each.value.host].id
interface = "virtio0"
iothread = false
replicate = true
size = 64
}
disk {
aio = "io_uring"
backup = true
cache = "none"
datastore_id = "local-lvm"
# path_in_datastore = "${each.key}_root.qcow2"
discard = "ignore"
file_format = "raw"
interface = "virtio1"
iothread = false
replicate = true
size = 128
}
efi_disk {
datastore_id = "local-lvm"
file_format = "raw"
type = "4m"
pre_enrolled_keys = false
}
tpm_state {
datastore_id = "local-lvm"
version = "v2.0"
}
hotplug = "network,disk,usb"
initialization {
datastore_id = "local-lvm"
interface = "sata0"
file_format = "raw"
dns {
domain = var.local_domain
servers = 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
}
}
user_account {
keys = []
password = "" # FIX
username = "" # FIX
}
}
keyboard_layout = "en-us"
machine = "q35"
memory {
dedicated = 2048
floating = 2048
shared = 0
}
migrate = true
name = each.key
network_device {
bridge = "vmbr0"
disconnected = false
firewall = false
model = "virtio"
mtu = 1
}
node_name = each.value.host
on_boot = true
operating_system {
type = "l26"
}
pool_id = proxmox_virtual_environment_pool.archlinux.pool_id
protection = false
reboot = false
reboot_after_update = true
started = true
startup{
order = 1
up_delay = 20
}
tablet_device = false
stop_on_destroy = true
purge_on_destroy = true
delete_unreferenced_disks_on_destroy = true
vga {
type = "qxl"
}
watchdog {
enabled = false
action = "reset"
model = "i6300esb"
}
}
# resource "proxmox_virtual_environment_vm" "download_clients" {
# for_each = { for key, value in var.vm_guests: key => value if value.role == "download_client" }
# acpi = false
# agent {
# enabled = true
# timeout = "10m"
# trim = false
# type = "virtio"
# }
# node_name = each.value.host
# }
+3 -8
View File
@@ -1,6 +1,5 @@
variable "vm_guests" { variable "vm_guests" {
type = list(object({ type = map(object({
name = string
host = string host = string
role = string role = string
})) }))
@@ -32,15 +31,11 @@ variable "search_domains" {
} }
variable "ipv4_nameservers" { variable "ipv4_nameservers" {
type = list(object({ type = list(string)
address = string
}))
} }
variable "ipv6_nameservers" { variable "ipv6_nameservers" {
type = list(object({ type = list(string)
address = string
}))
} }
variable "local_domain" { variable "local_domain" {
+1 -1
View File
@@ -1 +1 @@
arch_mirror = "mirrors.mit.edu/archlinux" arch_mirror = "mirrors.kernel.org/archlinux"
+2 -2
View File
@@ -2,10 +2,10 @@ ipv4_gateway = "10.96.10.254"
ipv4_subnet_mask = 24 ipv4_subnet_mask = 24
ipv6_gateway = "2600:4040:593d:8b10:6662:66ff:fe21:e9c4" ipv6_gateway = "2600:4040:593d:8b10:6662:66ff:fe21:e9c4"
ipv4_nameservers = [ ipv4_nameservers = [
{address = "10.96.10.254"} "10.96.10.254"
] ]
ipv6_nameservers = [ ipv6_nameservers = [
{address = "2600:4040:593d:8b10:6662:66ff:fe21:e9c4"} "2600:4040:593d:8b10:6662:66ff:fe21:e9c4"
] ]
local_domain = "balsillie.house" local_domain = "balsillie.house"
search_domains = [ search_domains = [
+11 -14
View File
@@ -1,17 +1,14 @@
vm_guests = [ vm_guests = {
{ ch01 ={
host = "hv02" host = "hv02"
name = "ch01"
role = "container_host" role = "container_host"
},
{
host = "hv03"
name = "ch02"
role = "container_host"
},
{
host = "hv03"
name = "dl01"
role = "download"
} }
] ch02 ={
host = "hv03"
role = "container_host"
}
dl01 ={
host = "hv03"
role = "download_client"
}
}