Use this when managing templates from build to retirement.
Template Lifecycle
Template lifecycle covers building, patching, testing, publishing, versioning and retiring templates. Update them on a schedule and record versions so new VMs never start out months behind on patches.
1. Template lifecycle: build → test → publish → patch → retire.
2. Rebuild rather than patch in place.
3. Track version in name/notes.
4. Retire old templates.
5. Re-test after major updates.
build → test → publish → use → retire
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Common mistakes Narrow the fault
- No retirement — old templates keep being used.
- No owner for template updates.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Schedule template rebuilds, for example monthly.
- Track template versions.
- Retire old templates so no one deploys them.
qm list— template versionsgit log packer/— image build historyGet-VM | ? Notes -match template— Hyper-V notes
ReferenceWhy it matters1 section · depth on demand
Reference
| Item | Record |
|---|---|
| Version | e.g. debian12-2026.11 |
| Base image and checksum | Source |
| Patch level | Date |
| Owner | Team |
| Retire date | When replaced |
ReferenceImportant terms & boundaries3 sections · depth on demand
In depth
Lifecycle stages
| Stage | Actions | Evidence to keep |
|---|---|---|
| Build | Automated build, generalise, qm template <vmid> | Build log, package list, source ISO/cloud image checksum |
| Validate | Test clone, smoke tests, destroy test clone | Test result |
| Publish | Name and tag (tpl-debian12-202611), notes field | Changelog entry |
| Use | Automation refers to the template by VMID or name | Which VMs were cloned from which version |
| Deprecate | Mark in notes, remove from automation | Date |
| Retire | Delete once no linked clones depend on it | Deletion date |
Find what depends on a template before deleting it
Linked clones keep using the template's base volumes. On Proxmox, base volumes are named base-<vmid>-disk-N and clones reference them:
pvesm list local-zfs | grep base-9000
zfs list -o name,origin -r rpool/data | grep base-9000 # ZFS clones show the origin
lvs -o lv_name,origin pve | grep base-9000 # LVM-thin
Proxmox refuses to remove a template whose base volumes are still in use. Convert dependants with a full clone or qm move-disk first.
Keep templates and automation in step
Hard-coded VMIDs in Terraform or Ansible point to one template version forever. Prefer a lookup by name or tag, or a variable updated in the same change that publishes the new template, so new VMs get the new build automatically.
Updating without patching in place
Do not start a template to patch it (Proxmox templates cannot be started anyway). Instead:
1. Full-clone the template into a normal VM.
2. Patch, generalise, test.
3. Convert the result into a new template with a new version name.
4. Deprecate the old one.
This keeps every template immutable and reproducible.
How it works
Templates are built, tested, published, used and retired. Rebuild them on a schedule (monthly patches), version them, and remove old versions so new VMs never start years out of date.
Lifecycle steps
1. Build from code (Packer) or a documented process.
2. Patch and harden.
3. Test (boot, join, application install).
4. Publish with a version number.
5. Rebuild monthly or after major updates.
6. Retire old versions.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in VM Templates → Template Lifecycle. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://libvirt.org/docs.html · confidence 94%