# Homelab Provisioning Layer This layer prepares a Debian server to PXE boot a Debian 13 arm64 VM and install a reusable worker-node golden image for Pimox on Orange Pi 5 Plus. It is intentionally separate from `./lab.sh up`. Run it manually from the Debian homelab server only when you want to create or refresh the provisioning service. ## What It Installs - `dnsmasq` for proxyDHCP and TFTP - `nginx` for preseed, installer, and guest-prep scripts - Debian 13 arm64 netboot assets under `/opt/homelab-provisioning` - a preseed file for unattended Debian install - guest prep scripts that install Kubernetes tools, containerd, qemu guest agent, cloud-init, OpenEBS dependencies, cgroup prerequisites, swap disablement, and the local registry trust path - kernel boot options for cgroup support through `TF_VAR_kernel_cgroup_boot_options` - a template sealing script at `/usr/local/sbin/homelab-prepare-template.sh` inside the installed VM that verifies cgroup boot state before sealing ## Apply From Debian Find the LAN interface on the Debian server: ```bash ip -br addr ``` Apply the provisioning layer: ```bash cd ~/my-homelab-configs tofu -chdir=bootstrap/provisioning init TF_VAR_provisioning_interface=enp1s0 tofu -chdir=bootstrap/provisioning apply ``` Override `TF_VAR_provisioning_interface` with the interface that serves the Pimox VM network. The default VM user is `jv`. The account uses `/home/jv/.ssh/id_ed25519.pub` from the Debian server when that key exists, and the password is locked by default. Set `TF_VAR_template_user_ssh_authorized_keys` or `TF_VAR_template_user_password_hash` before applying if you want different access. Clones should get their intended hostname through cloud-init or the later clone automation. If they boot with the template hostname, the first-boot service generates a unique fallback name using `TF_VAR_clone_hostname_prefix`. ## Pimox VM Template Flow Create an arm64 VM in Pimox with UEFI firmware, a virtio disk, and a NIC on the same LAN as the Debian provisioning host. Put network boot first. PXE should load `grubaa64.efi`, boot the Debian installer, fetch the preseed from `http://192.168.100.68:8088/preseed/debian13-arm64-worker.cfg`, and install the golden image. If your Pimox firmware needs a different Debian arm64 EFI loader, override `TF_VAR_pxe_boot_file`. After the first successful boot, run this inside the VM before converting it to a template: ```bash sudo /usr/local/sbin/homelab-prepare-template.sh sudo poweroff ``` Convert the powered-off VM to a Pimox template. Clone it for each new worker, set a unique hostname and IP address through cloud-init or DHCP reservation, then add it to `bootstrap/cluster/variables.tf` or a `.tfvars` file: ```hcl worker_nodes = { pimox01 = { host = "192.168.100.90" user = "jv" node_name = "pimox01" ssh_key_path = "/home/jv/.ssh/id_ed25519" } } ``` Run the cluster layer from the Debian homelab server after the cloned VM is reachable over SSH. ## Optional Pimox Automation Set `TF_VAR_pimox_template_builder_enabled=true` to have this layer SSH into the Pimox host, create the template-build VM with `qm`, boot it from PXE, wait for the installed VM over SSH, run `/usr/local/sbin/homelab-prepare-template.sh`, power it off, switch boot order back to disk first, and run `qm template`. The automation needs a predictable temporary IP for the installed VM. Use a DHCP reservation for the generated or configured MAC address, then set: ```bash export TF_VAR_pimox_template_builder_enabled=true export TF_VAR_pimox_host=192.168.100.91 export TF_VAR_pimox_template_build_host=192.168.100.90 ``` Defaults match the observed Pimox VM shape: OVMF firmware, virtio networking, virtio-scsi disk, `vmbr0`, `local` storage, 2 vCPU, and 2 GiB memory. Override `TF_VAR_pimox_template_scsi0`, `TF_VAR_pimox_template_efidisk0`, `TF_VAR_pimox_template_cores`, or `TF_VAR_pimox_template_memory` if the Orange Pi storage layout changes.