refactor: extract generic workload-layer from node configs
This commit is contained in:
parent
f9e883d1b8
commit
e23006d701
7 changed files with 3 additions and 41 deletions
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue