Packer HCL templates for building Windows and Ubuntu QEMU/KVM virtual machine images.
Used by osw-builder to automate OS image creation.
| Template | Varfile | Notes |
|---|---|---|
windows.pkr.hcl |
win10.pkrvars.hcl |
Windows 10 |
windows.pkr.hcl |
win11.pkrvars.hcl |
Windows 11 |
windows.pkr.hcl |
win8.pkrvars.hcl |
Windows 8 |
windows.pkr.hcl |
win7.pkrvars.hcl |
Windows 7 |
windows.pkr.hcl |
winxp.pkrvars.hcl |
Windows XP |
ubuntu.pkr.hcl |
ubuntu.pkrvars.hcl |
Ubuntu (configurable version) |
- Packer >= 1.8
- QEMU/KVM (
qemu-system-x86_64,libvirt) - Docker (for the containerized build approach)
- KVM-capable host (
/dev/kvmavailable)
The varfiles include iso_url and iso_checksum fields that you must fill in with your own ISO sources:
iso_url = "/path/to/your/windows.iso"
iso_checksum = "sha1:your_checksum_here"Where to get ISOs legally:
- Windows 10/11: Microsoft Evaluation Center
- Windows 7/8: Internet Archive
- Ubuntu: ubuntu.com/download
packer build -var-file=win10.pkrvars.hcl windows.pkr.hclpacker build -var-file=ubuntu.pkrvars.hcl ubuntu.pkr.hclThe repo ships a Dockerfile that packages Packer + QEMU in a container, avoiding local dependency management.
Build the image:
docker build -t packer-templates .Run a build (example: Windows 10):
docker run -ti --rm \
-v $HOME/.cache/packer:/cache \
-v $PWD:/output_parent \
--device /dev/kvm \
--network none \
--user "$(id -u):$(id -g)" \
--group-add kvm \
-v $PWD/win10.pkrvars.hcl:/packer/win10.pkrvars.hcl \
-v $PWD/answer_files/10/Autounattend.xml:/packer/answer_files/10/Autounattend.xml \
packer-templatesExpose VNC on port 5900 to monitor the installation:
docker run ... -p 5900:5900 packer-templatesUnattended installation answer files are in answer_files/:
answer_files/
├── 7/ # Windows 7 Autounattend.xml
├── 8/ # Windows 8 Autounattend.xml
├── 10/ # Windows 10 Autounattend.xml
├── 11/ # Windows 11 Autounattend.xml
├── ubuntu/ # Ubuntu preseed.cfg
└── xp/ # Windows XP WINNT.SIF
Apache 2.0 — see LICENSE.