Packer: native proxmox-clone builder + selectable qemu output (#1) - #4
Open
michielvha wants to merge 2 commits into
Open
Packer: native proxmox-clone builder + selectable qemu output (#1)#4michielvha wants to merge 2 commits into
michielvha wants to merge 2 commits into
Conversation
Convert the Ubuntu template to the native hashicorp/proxmox proxmox-clone builder alongside the existing qemu builder, selectable at invocation with -only. Both share one build block and produce a generic, unidentified image. - required_plugins: proxmox >= 1.2.2 + qemu ~> 1 - source proxmox-clone.ubuntu: clones a cloud-init base template, attaches an empty cloud-init drive (cloud_init + cloud_init_storage_pool), API-token auth, ends as a Proxmox template. No per-build qm importdisk. - source qemu.ubuntu: portable qcow2, now arch-parameterized (amd64 default; arm64 for a fast HVF build on Apple Silicon). - scripts/create-base-template.sh: Stage-0 one-time base-template bootstrap. - install.sh trimmed to generic (waits for cloud-init); tooling deferred to #3. - cleanup.sh seals the image: cloud-init clean, machine-id + dbus reset, remove SSH host keys and build authorized_keys. - cloud-init seed stripped of identity (hostname vars) and amd64-only grub pkgs so it stays generic and arch-portable. - secrets: token via PKR_VAR/untracked *.auto.pkrvars.hcl (+ .example); gitignore outputs and real vars files. - remove orphaned scripts/.p10k.zsh + scripts/zshrc (zsh config returns via PDS in #3). Tested locally: packer fmt clean, packer validate green (both builders), and a full 'packer build -only=qemu.ubuntu' produced a sealed qcow2 (cleanup steps verified in the build log). proxmox-clone verified statically; live PVE build is phase-2 per spec 0002. Refs #1
The baseline tooling that lives in Ubuntu's default apt repos belongs in the cloud-init packages list (native apt integration), not deferred to PDS. Restore git, net-tools, nmap, nfs-common, build-essential, zsh, btop alongside qemu-guest-agent/curl/file. Only genuinely non-apt cases stay for PDS (#3): gh (needs the cli.github.com repo) and neofetch (deprecated; goes with the MOTD). grub-efi-amd64/shim-signed stay dropped (amd64-only, not needed for a cloud image). Re-ran packer build -only=qemu.ubuntu: green (5m53s), all packages install cleanly, image sealed as before. Refs #1
Contributor
Author
|
Good catch on the package trimming, applied. Corrected the philosophy: apt-native packages stay in cloud-init (git, net-tools, nmap, nfs-common, build-essential, zsh, btop, curl, file, qemu-guest-agent), and only genuinely non-apt things defer to PDS (#3): Re-ran |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements spec 0001 (
docs/specs/0001-packer-proxmox-native-output.md). Closes #1.What changed
One Ubuntu template, two builders sharing a single
buildblock, selected at invocation:proxmox-clone.ubuntu— native Proxmox template. Clones a cloud-image base template, customizes it, attaches an empty cloud-init drive (cloud_init+cloud_init_storage_pool), authenticates with an API token, and ends flagged as a template. No per-buildqm importdisk.qemu.ubuntu— portable qcow2, now arch-parameterized (amd64default;arm64for a fast HVF build on Apple Silicon).Supporting changes:
scripts/create-base-template.sh— Stage-0 one-time base-template bootstrap (cloud image +qemu-guest-agent→ template).install.shtrimmed to generic (just waits for cloud-init); tooling deferred to Spec 0003: Move provisioning into PDS (select and apply) #3.cleanup.shseals the image:cloud-init clean,machine-id+ dbus reset, remove SSH host keys and the buildauthorized_keys.PKR_VAR_proxmox_api_tokenor an untracked*.auto.pkrvars.hcl(.exampleadded);.gitignorecovers outputs and real vars files.scripts/.p10k.zsh+scripts/zshrc(zsh config returns via PDS in Spec 0003: Move provisioning into PDS (select and apply) #3).Testing
packer fmt -check— clean.packer validate— green for both builders (-only=qemu.ubuntuand the full template).packer build -only='qemu.ubuntu'— completed (5m29s, amd64 under TCG). Produced a sealed 922 MB qcow2; the build log confirms every generic-image step ran (machine-idtruncate + dbus symlink,rm authorized_keys,rm ssh_host_*,cloud-init clean, graceful halt, qcow2 convert).proxmox-cloneverified statically (packer validate); a live PVE build is intentionally deferred to the phase-2 self-hosted runner in spec 0002 (no token shared into the dev session).Scope notes / follow-ups
qemu-img→ raw post-processor was dropped; qcow2 is the portable artifact for now.Open (need your homelab values before a real Proxmox build)
Storage pool, bridge, node, and vmid ranges go in the untracked
proxmox.auto.pkrvars.hcl; base template created once viacreate-base-template.sh.