Archlinux up

This commit is contained in:
2026-09-08 12:31:12 -04:00
parent c32aa4982c
commit b4c05a9b76
9 changed files with 66 additions and 35 deletions
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGH9QqREEaJkDbOGOdKMBiKn9Kq/tgiz6XL9WXZWI/R+ ladmin@archlinux
+1
View File
@@ -1,3 +1,4 @@
locals { locals {
arch_qcow_hash = split(" ", data.http.arch_qcow_hash.response_body)[0] arch_qcow_hash = split(" ", data.http.arch_qcow_hash.response_body)[0]
arch_public_key = file("${path.root}/files/ladmin@archlinux.pub")
} }
+7
View File
@@ -26,3 +26,10 @@ provider "proxmox" {
provider "dns" {} provider "dns" {}
provider "http" {} provider "http" {}
provider "random" {}
provider "pass" {
refresh_store = false
store_dir = pathexpand("~/.config/pass")
}
+5
View File
@@ -0,0 +1,5 @@
resource "pass_password" "arch_password" {
for_each = toset([for key,value in var.vm_guests: key])
password = random_password.this[each.value].result
path = "ansible/become-passwords/${each.value}"
}
+13 -22
View File
@@ -13,13 +13,13 @@ resource "proxmox_download_file" "arch_qcow" {
verify = true verify = true
} }
resource "proxmox_virtual_environment_pool" "archlinux" { resource "proxmox_virtual_environment_pool" "this" {
comment = "Container hosts and download client" comment = "Container hosts and download client"
pool_id = "archlinux" pool_id = "archlinux"
} }
resource "proxmox_virtual_environment_vm" "container_hosts" { resource "proxmox_virtual_environment_vm" "this" {
for_each = { for key, value in var.vm_guests: key => value if value.role == "container_host" } for_each = var.vm_guests
acpi = false acpi = false
agent { agent {
enabled = true enabled = true
@@ -53,7 +53,6 @@ resource "proxmox_virtual_environment_vm" "container_hosts" {
backup = true backup = true
cache = "none" cache = "none"
datastore_id = "local-lvm" datastore_id = "local-lvm"
# path_in_datastore = "${each.key}_root.qcow2"
discard = "ignore" discard = "ignore"
file_format = "raw" file_format = "raw"
file_id = proxmox_download_file.arch_qcow[each.value.host].id file_id = proxmox_download_file.arch_qcow[each.value.host].id
@@ -62,12 +61,13 @@ resource "proxmox_virtual_environment_vm" "container_hosts" {
replicate = true replicate = true
size = 64 size = 64
} }
disk { dynamic "disk" {
for_each = each.value.role == "container_host" ? [1] : []
content {
aio = "io_uring" aio = "io_uring"
backup = true backup = true
cache = "none" cache = "none"
datastore_id = "local-lvm" datastore_id = "local-lvm"
# path_in_datastore = "${each.key}_root.qcow2"
discard = "ignore" discard = "ignore"
file_format = "raw" file_format = "raw"
interface = "virtio1" interface = "virtio1"
@@ -75,6 +75,7 @@ resource "proxmox_virtual_environment_vm" "container_hosts" {
replicate = true replicate = true
size = 128 size = 128
} }
}
efi_disk { efi_disk {
datastore_id = "local-lvm" datastore_id = "local-lvm"
file_format = "raw" file_format = "raw"
@@ -105,9 +106,11 @@ resource "proxmox_virtual_environment_vm" "container_hosts" {
} }
} }
user_account { user_account {
keys = [] keys = [
password = "" # FIX local.arch_public_key
username = "" # FIX ]
password = random_password.this[each.key].result
username = var.arch_username
} }
} }
keyboard_layout = "en-us" keyboard_layout = "en-us"
@@ -133,7 +136,7 @@ resource "proxmox_virtual_environment_vm" "container_hosts" {
operating_system { operating_system {
type = "l26" type = "l26"
} }
pool_id = proxmox_virtual_environment_pool.archlinux.pool_id pool_id = proxmox_virtual_environment_pool.this.pool_id
protection = false protection = false
reboot = false reboot = false
reboot_after_update = true reboot_after_update = true
@@ -155,15 +158,3 @@ resource "proxmox_virtual_environment_vm" "container_hosts" {
model = "i6300esb" 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
# }
+13
View File
@@ -0,0 +1,13 @@
resource "random_password" "this" {
for_each = toset([for key,value in var.vm_guests: key])
length = 16
lower = true
min_lower = 1
min_numeric = 1
min_special = 1
min_upper = 1
numeric = true
override_special = "!@#%&?-_+"
special = true
upper = true
}
+8
View File
@@ -14,6 +14,14 @@ terraform {
source = "registry.terraform.io/hashicorp/http" source = "registry.terraform.io/hashicorp/http"
version = ">= 3.6.1" version = ">= 3.6.1"
} }
random = {
source = "registry.terraform.io/hashicorp/random"
version = ">= 3.9.0"
}
pass = {
source = "registry.terraform.io/digipost/pass"
version = ">= 2.1.1"
}
} }
backend "local" { backend "local" {
+4
View File
@@ -45,3 +45,7 @@ variable "local_domain" {
variable "arch_mirror" { variable "arch_mirror" {
type = string type = string
} }
variable "arch_username" {
type = string
}
@@ -1 +1,2 @@
arch_mirror = "mirrors.kernel.org/archlinux" arch_mirror = "mirrors.kernel.org/archlinux"
arch_username = "ladmin"