Skip to content

Latest commit

 

History

155 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

packer-templates

Packer HCL templates for building Windows and Ubuntu QEMU/KVM virtual machine images.

Used by osw-builder to automate OS image creation.

Supported OS

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)

Prerequisites

  • Packer >= 1.8
  • QEMU/KVM (qemu-system-x86_64, libvirt)
  • Docker (for the containerized build approach)
  • KVM-capable host (/dev/kvm available)

Providing your own ISO

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:

Build

Direct Packer build

packer build -var-file=win10.pkrvars.hcl windows.pkr.hcl
packer build -var-file=ubuntu.pkrvars.hcl ubuntu.pkr.hcl

Docker build (recommended)

The 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-templates

Expose VNC on port 5900 to monitor the installation:

docker run ... -p 5900:5900 packer-templates

Answer files

Unattended 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

License

Apache 2.0 — see LICENSE.

About

My packer templates

Resources

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages