template {} block

WCL block

Declares a disk template to build: arch, version, profile, working disk, exactly one source, build media/NICs and provisions.

A template {} block declares a disk image to build. It lives in vmlab.wcl (or any file passed with -f) and is realised by a build.

wcl
import <vmlab.wcl>

template "linux-modern" {
  arch    = "x86_64"           // required — selects the QEMU system emulator
  version = "1.0"              // required
  profile = "linux-modern"     // hardware defaults
  cpus    = 4                  // optional hardware overrides (also memory, display,
  memory  = 8GiB               // firmware, tpm, secure_boot, nested, qemu_args)
  disk    = 20GiB              // working disk size for the build
  gui     = true               // watch the build VM's screen in a QEMU window

  source "iso" { url = "https://releases.ubuntu.com/.../x.iso" sha256 = "abc123..." }

  media { kind = "iso" from = "./cloudinit/" label = "CIDATA" }   // built from folder, cached
  nic { nat = true }                                              // build VM network access
  disk "extra" { size = 10GiB }                                   // extra disks during build
  provision "scripts/install.ws" { }                         // drives the installer
}

Exactly one source {} block selects what the build starts from.