A collection of professional HashiCorp Packer templates written in HCL2 for building machine images across multiple platforms. All templates follow current best practices and target modern, supported OS versions.
| Template | OS | Publisher | SKU |
|---|---|---|---|
| ubuntu-24.04 | Ubuntu 24.04 LTS (Noble) | Canonical | 22_04-lts-gen2 |
| debian-12 | Debian 12 (Bookworm) | Debian | 12 |
| windows-server-2025 | Windows Server 2025 Datacenter | MicrosoftWindowsServer | 2025-datacenter-g2 |
| Template | OS | ISO |
|---|---|---|
| ubuntu-24.04 | Ubuntu 24.04.2 LTS | live-server, autoinstall |
| debian-12 | Debian 12.11 Bookworm | netinst, preseed |
| rocky-9 | Rocky Linux 9.5 | minimal, kickstart |
| Template | OS | ISO |
|---|---|---|
| ubuntu-24.04 | Ubuntu 24.04.2 LTS | live-server, autoinstall |
| debian-12 | Debian 12.11 Bookworm | netinst, preseed |
| rocky-9 | Rocky Linux 9.5 | minimal, kickstart |
| Tool | Minimum version |
|---|---|
| Packer | 1.11.0 |
| VirtualBox (VirtualBox templates) | 7.0 |
| VMware Workstation Pro (VMware templates) | 17.0 |
| Azure subscription (Azure templates) | — |
git clone https://github.com/Think-Cube/PackerExamples.git
cd PackerExamplescd <platform>/<template>
packer init .Copy the example file and fill in your values:
cp variables.pkrvars.hcl.example variables.pkrvars.hclFor Azure templates you can also export environment variables:
export ARM_CLIENT_ID="<client-id>"
export ARM_CLIENT_SECRET="<client-secret>"
export ARM_SUBSCRIPTION_ID="<subscription-id>"
export ARM_TENANT_ID="<tenant-id>"packer validate .
packer build .With a var file:
packer build -var-file="variables.pkrvars.hcl" .az ad sp create-for-rbac \
--name "packer-sp" \
--role Contributor \
--scopes /subscriptions/<subscription-id>The output provides appId → ARM_CLIENT_ID, password → ARM_CLIENT_SECRET, tenant → ARM_TENANT_ID.
The resource group referenced in resource_group_name must exist before running a build:
az group create --name packer-images-rg --location "West Europe"PackerExamples/
├── azure/
│ ├── ubuntu-24.04/ # Ubuntu 24.04 LTS managed image
│ ├── debian-12/ # Debian 12 Bookworm managed image
│ └── windows-server-2025/ # Windows Server 2025 managed image
├── virtualbox/
│ ├── ubuntu-24.04/ # Ubuntu 24.04 LTS VirtualBox image
│ ├── debian-12/ # Debian 12 Bookworm VirtualBox image
│ └── rocky-9/ # Rocky Linux 9 VirtualBox image
├── vmware/
│ ├── ubuntu-24.04/ # Ubuntu 24.04 LTS VMware image
│ ├── debian-12/ # Debian 12 Bookworm VMware image
│ └── rocky-9/ # Rocky Linux 9 VMware image
└── .github/workflows/ # CI — packer validate on every push/PR
Each template directory contains:
<template>/
├── <name>.pkr.hcl # Main Packer template (HCL2)
├── variables.pkrvars.hcl.example
├── scripts/ # Shell / PowerShell provisioners
└── http/ # Autoinstall / preseed / kickstart files
Pull requests are welcome. Please open an issue first to discuss significant changes. See CONTRIBUTING.md for details.
MIT © Think-Cube