Packer configuration for creating Debian 12 virtual machine templates for Proxmox VE.
Time and time again you create a VM and go through the setup manually. This method automatically goes through all manual options using a preseed.
More info on preseeding: preseed documentation
If you don't have one already. Create a new keypair.
ssh-keygen
I've just saved the key to the default location and left the passphrase empty. After doing that you'll find your private (id_rsa) and public keys (id_rsa.pub) in your profile .ssh directory. (/Users/YourUsername/.ssh)
Copy the contents of your public key file and paste it in cloud.cfg Replace or remove the example if you need to.
Templates are created by converting an existing VM to a template. Navigate to the project directory and execute the following command:
packer init .
packer build -var-file vars/debian_12.pkrvars.hcl -var "proxmox_api_password=PASSWORD_HERE" .
Right-click the template in Proxmox VE, and select "Clone".
- full clone is a complete copy and is fully independent from the original VM or VM Template, but it requires the same disk space as the original
- linked clone requires less disk space but cannot run without access to the base VM Template. Not supported with LVM & ISCSI storage types
(Change the IP with your new VM's IP)
The certificate should do and no further passwords are needed.