Tested with with Proxmox 9.1.2, Packer 1.14 and Packer Proxmox Plugin v1.2.3
Build VM Templates with Packer for Proxmox. The generated templates are meant to be used with cloud-init, they come without a User or root login.
Only the Windows Server Template has a Administrator user by default (Password packer). It's ready for Ansible setup via winrm.
All templates are made for my personal environment and may need adjustments for yours!
| OS | Status | Username / Password |
|---|---|---|
| Ubnuntu 24.04 | ||
| Ubnuntu 22.04 | ||
| Ubnuntu 20.04 | ||
| Ubnuntu 18.04 | ||
| Debian 13 | ||
| Debian 12 | ||
| Debian 11 | ||
| AlmaLinux 10 | ||
| AlmaLinux 9 | ||
| Rocky 10 | ||
| Rocky 9 | ||
| Alpine 3.22 | ||
| Alpine 3.21 | ||
| Alpine 3.20 | ||
| Windows Server 2025 | Administrator / packer | |
| Windows Server 2022 | Administrator / packer | |
| Windows Server 2019 | Administrator / packer | |
| Windows 11 | Administrator / packer | |
| Talos Linux 1.12 | None | |
| OPNsense 25.7 | root / opnsense | |
| VyOS rolling | vyos / vyos |
First initialize the proxmox packer plugin:
packer init config.pkr.hclThe templates all use a generic source builder (generic.pkr.hcl) that's driven by variables. The OS specific settings are only variables and preseed files.
To build packer templates you need to set some variables via file (-var-file=my.pkrvars.hcl), cli (-var variablename=value), or environment (PKR_VAR_variablename=value):
- proxmox_host
- proxmox_user
- proxmox_password
- proxmox_token
- node
- vmid
Other interesting variables are:
- pool
- proxmox_insecure_tls
- disk_storage_pool
- iso_storage_pool
- cloud_init_storage_pool
- iso_download
- Windows:
- windows_edition
- windows_language / windows_input_language
- winrm_username / winrm_password (Win11 alway creates a user, Win Server will use Administrator)
See variables.pkr.hcl for all varaibles.
To build a template (e.g. debian-13) run:
packer build -var-file="debian-13.pkrvars.hcl" .You can run additional setup actions for windows by creating a file http/windows-scripts/custom/custom.ps1.
Example:
# debloat Windows 11: https://github.com/Raphire/Win11Debloat
& ([scriptblock]::Create((irm "https://debloat.raphi.re/"))) -RunDefaults -Sysprep -SilentIn some cases your proxmox server might be in a datacatenter. You can ssh to the proxmox server but the proxmox server can't connect to your build computer.
Set the following variables in your configuration.
- packer_http_interface to
127.0.0.1 - packer_http_port to
8000
Your Proxmox Server can be reached via ssh
Start this in a console on your build host and keep it open during build time.
# forward 127.0.0.1:8000 to the remote proxmox to 127.0.0.1:8000
ssh -N -R 127.0.0.1:8000:127.0.0.1:8000 root@proxmoxYour Proxmox Server can't be reached from the build computer via ssh
In this case you need a 2nd computer that can be reached from the proxmox computer and the build computer acting as relais.
On the proxmox host:
ssh -N -L 127.0.0.1:8000:127.0.0.1:8000 user@lighthouseOn the build computer:
ssh -N -R 127.0.0.1:8000:127.0.0.1:8000 user@lighthouse