Skip to content

Latest commit

 

History

History
155 lines (95 loc) · 4.84 KB

File metadata and controls

155 lines (95 loc) · 4.84 KB

Packer Template for Microsoft Windows

Introduction

The Packer templates in this directory creates Windows Server images for use with MAAS.

Prerequisites (to create the image)

  • A machine running Ubuntu 18.04+ with the ability to run KVM virtual machines.
  • qemu-utils, libnbd-bin, nbdkit and fuse2fs
  • qemu-system
  • ovmf
  • cloud-image-utils
  • Packer, v1.7.0 or newer
  • Ubuntu 22.04+ is required to build Windows 11 images (swtpm package)

Requirements (to deploy the image)

Supported Microsoft Windows Versions

This process has been build and deployment tested with the following versions of Microsoft Windows:

  • Azure Local 23H2
  • Windows Server 2025
  • Windows Server 2022
  • Windows Server 2019
  • Windows Server 2016
  • Windows 10 PRO+
  • Windows 11 PRO+

Known Limitations

  • The current process builds UEFI compatible images only.

windows.pkr.hcl Template

This template builds a dd.tgz MAAS image from an official Microsoft Windows ISO/VHDX. This process also installs the latest VirtIO drivers as well as Cloudbase-init.

Obtaining Microsoft Windows ISO images

You can obtains Microsoft Windows Evaluation ISO/VHDX images from the following links:

To download an ISO image for Azure Local (formerly Azure Stack HCI), follow the instructions here.

Building the image

The build the image you give the template a script which has all the customization:

sudo make ISO=<path-to-iso> VERSION=<windows-version>

Example:

sudo make ISO=/path/to/Windows_Server_2025_SERVER_EVAL_x64FRE_en-us.iso VERSION=2025

Makefile Parameters

BOOT

Currently uefi is the only supported value.

EDIT

The edition of a targeted ISO image. It defaults to PRO for Microsoft Windows 10/11 and SERVERSTANDARD for Microsoft Windows Servers. Many Microsoft Windows Server ISO images do contain multiple editions and this prarameter is useful to build a particular edition such as Standard or Datacenter etc.

HEADLESS

Whether VNC viewer should not be launched. Default is set to false. This requires GTK or SDL libraries to be present on the machine. If building on headless servers, set this to true. The use a VNC client to connecto to the displayed VNC port during the build.

ISO

Path to Microsoft Windows ISO image used to build the image. Do not use this if using VHDX images. See the VHDX parameter below.

PACKER_LOG

Enable (1) or Disable (0) verbose packer logs. The default value is set to 0.

PKEY

User supplied Microsoft Windows Product Key. When usimg KMS, you can obtain the activation keys from the link below:

Please note that PKEY is an optional parameter but it might be required during the build time depending on the type of ISO being used. Evaluation series ISO images usually do not require a product key to proceed, however this is not true with Enterprise and Retail ISO images.

TIMEOUT

Defaults to 1h. Supports variables in h (hour) and m (Minutes).

VHDX

Path to Microsoft Windows VHDX image used to build the image.

VERSION

Specify the Microsoft Windows Version. Example inputs include: HCI, 2025, 2022, 2019, 2016, 10 and 11.

Customizing the image

At build time

Change the baseline defaults of the image by editing the respective answer file template (e.g. http/Autounattend.xml.ISO.template).

At run time

You can add arbitrary PowerShell commands to be run once at deploy time by Cloudbase-Init in http/custom.ps1. This may be useful in situations where you wish to do some common configuration for each instance, such as joining an existing domain.

Uploading images to MAAS

Use MAAS CLI to upload the image:

maas admin boot-resources create \
    name='windows/windows-server' \
    title='Windows Server' \
    architecture='amd64/generic' \
    filetype='ddgz' \
    content@=windows.dd.gz