Add Pimox template install diagnostics
Homelab Main / deploy (push) Has been cancelled Details

This commit is contained in:
juvdiaz 2026-05-27 20:58:59 -06:00
parent 7d11fda7b3
commit 6525a744fc
2 changed files with 12 additions and 4 deletions

View File

@ -124,7 +124,7 @@ resource "null_resource" "pimox_template_vm_create" {
pimox_user = var.pimox_user pimox_user = var.pimox_user
ssh_key_path = var.pimox_ssh_key_path ssh_key_path = var.pimox_ssh_key_path
qm_bin = var.pimox_qm_bin qm_bin = var.pimox_qm_bin
builder_version = "8" builder_version = "9"
vmid = tostring(var.pimox_template_vmid) vmid = tostring(var.pimox_template_vmid)
name = var.pimox_template_name name = var.pimox_template_name
cores = tostring(var.pimox_template_cores) cores = tostring(var.pimox_template_cores)
@ -205,6 +205,7 @@ sudo "$qm_cmd" create "$vmid" \
--sockets 1 \ --sockets 1 \
--vga virtio --vga virtio
sudo "$qm_cmd" set "$vmid" --serial0 socket
sudo "$qm_cmd" set "$vmid" --efidisk0 "${self.triggers.efidisk0}" sudo "$qm_cmd" set "$vmid" --efidisk0 "${self.triggers.efidisk0}"
sudo "$qm_cmd" set "$vmid" --scsi0 "${self.triggers.scsi0}" sudo "$qm_cmd" set "$vmid" --scsi0 "${self.triggers.scsi0}"
sudo "$qm_cmd" set "$vmid" --boot "order=net0;scsi0" sudo "$qm_cmd" set "$vmid" --boot "order=net0;scsi0"
@ -242,7 +243,7 @@ resource "null_resource" "pimox_template_vm_seal" {
guest_host = var.pimox_template_build_host guest_host = var.pimox_template_build_host
guest_user = var.pimox_template_build_user guest_user = var.pimox_template_build_user
guest_key_path = var.pimox_template_build_ssh_key_path guest_key_path = var.pimox_template_build_ssh_key_path
seal_version = "5" seal_version = "6"
timeout = var.pimox_template_build_timeout timeout = var.pimox_template_build_timeout
timeout_seconds = tostring(var.pimox_template_build_timeout_seconds) timeout_seconds = tostring(var.pimox_template_build_timeout_seconds)
guest_ip_prefix = var.pimox_template_guest_ip_prefix guest_ip_prefix = var.pimox_template_guest_ip_prefix
@ -267,6 +268,7 @@ vmid="${self.triggers.vmid}"
known_hosts_file="${path.module}/../../.lab/pimox-template-known_hosts" known_hosts_file="${path.module}/../../.lab/pimox-template-known_hosts"
last_known_hosts_ip="" last_known_hosts_ip=""
last_ssh_output="" last_ssh_output=""
next_debug=0
mkdir -p "$(dirname "$known_hosts_file")" mkdir -p "$(dirname "$known_hosts_file")"
touch "$known_hosts_file" touch "$known_hosts_file"
@ -292,7 +294,8 @@ sudo '$pimox_qm_bin' status '$vmid'
echo 'Pimox VM $vmid config summary:' echo 'Pimox VM $vmid config summary:'
sudo '$pimox_qm_bin' config '$vmid' | grep -E '^(agent|bios|boot|efidisk0|net0|scsi0|serial0|vga):' || true sudo '$pimox_qm_bin' config '$vmid' | grep -E '^(agent|bios|boot|efidisk0|net0|scsi0|serial0|vga):' || true
echo 'Pimox VM $vmid guest-agent network-get-interfaces:' echo 'Pimox VM $vmid guest-agent network-get-interfaces:'
sudo '$pimox_qm_bin' guest cmd '$vmid' network-get-interfaces" >&2 || true sudo '$pimox_qm_bin' guest cmd '$vmid' network-get-interfaces
echo 'If this VM is still in the installer, inspect the serial console on the Pimox host with: sudo $pimox_qm_bin terminal $vmid'" >&2 || true
} }
guest_ip_from_agent() { guest_ip_from_agent() {
@ -333,6 +336,7 @@ fi
deadline=$((SECONDS + timeout_seconds)) deadline=$((SECONDS + timeout_seconds))
next_log=$SECONDS next_log=$SECONDS
next_debug=$((SECONDS + 300))
while (( SECONDS < deadline )); do while (( SECONDS < deadline )); do
if [ -z "$guest_host" ]; then if [ -z "$guest_host" ]; then
guest_host="$(guest_ip_from_agent || true)" guest_host="$(guest_ip_from_agent || true)"
@ -358,6 +362,10 @@ while (( SECONDS < deadline )); do
fi fi
next_log=$((SECONDS + 60)) next_log=$((SECONDS + 60))
fi fi
if (( SECONDS >= next_debug )); then
debug_pimox_vm
next_debug=$((SECONDS + 300))
fi
sleep 15 sleep 15
done done

View File

@ -2,6 +2,6 @@ set default=0
set timeout=5 set timeout=5
menuentry 'Debian 13 arm64 homelab worker template' { menuentry 'Debian 13 arm64 homelab worker template' {
linux /debian-installer/arm64/linux auto=true priority=critical url=${preseed_url} interface=auto hostname=${template_hostname} domain=${template_domain} --- quiet linux /debian-installer/arm64/linux auto=true priority=critical url=${preseed_url} interface=auto hostname=${template_hostname} domain=${template_domain} console=tty0 console=ttyS0,115200n8 --- console=tty0 console=ttyS0,115200n8
initrd /debian-installer/arm64/initrd.gz initrd /debian-installer/arm64/initrd.gz
} }