/proxmox-packer-templates

Proxmox VM Templates with Packer

Primary LanguageHCLMIT LicenseMIT

Packer Templates for Proxmox

Tested with Packer 1.10 and with Proxmox 8.1.4

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!

Overview

OS Status
Ubnuntu 22.04 ubuntu-22.04
Ubnuntu 20.04 ubuntu-20.04
Ubnuntu 18.04 ubuntu-18.04
Debian 12 debian-12
Debian 11 debian-11
Debian 10 debian-10
AlmaLinux 9 almalinux-9
Rocky 9 rocky-9
Alpine 3.15 alpine-3.15
Alpine 3.19 alpine-3.19
Windows Server 2019 windows-server-2019
Windows Server 2022 windows-server-2022

How to build

Prepare Packer

First initialize the proxmox packer plugin:

packer init config.pkr.hcl

Prepare your variables

The 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
  • node
  • vmid

Other interesting variables are:

  • pool
  • proxmox_insecure_tls
  • disk_storage_pool
  • iso_storage_pool
  • cloud_init_storage_pool
  • iso_download

See variables.pkr.hcl for all varaibles.

Build a template

To build a template (e.g. debian-11) run:

packer build -var-file="debian-11.pkrvars.hcl" -only="linux.*" .

For windows:

packer build -var-file="windows-server-2019.pkrvars.hcl" -only="windows.*" .