2. Build a template from installer media
The template block: sources, an unattended install, and vmlab template build.
After this lesson you can
- Declare a template block with source media and build settings - Run vmlab template build and follow the build VM - Version the result into the store
Before you start: Boot straight from a registry
A template block is a recipe: source blocks fetch or reference installer media (ISO URLs are downloaded and cached), a media folder can carry unattended-install answer files, and a build script drives the install. vmlab template build boots a scratch VM from that recipe, runs the install to completion, and commits the disk into the store as <arch>/<name>@<version>.
Linux cloud images make the easiest first build — no interactive installer, just cloud-init answers in a media { kind = "iso" … } folder. The build_template procedure in the reference walks the full checklist, including the wscript-driven installs used for Windows.
§ 1Exercise: Build and list
Using a template recipe (e.g. one from the vmlab-templates repo), build it and confirm the store entry.
vmlab template build # builds the template {} blocks in ./vmlab.wcl
vmlab template list
Expected result
The build VM boots, installs unattended, exits, and list shows the new <arch>/<name>@<version>.
Hint
Name one template (vmlab template build linux-modern) to build a single block; -f templates.wcl points at a different file.