Case

Template factory

In use

Fresh, proven VM templates for three Linux distributions every month — without anyone tending to them.

What & why

An automated factory that maintains six VM templates: the latest and the previous version of Rocky Linux, Ubuntu and Debian. Every month it fetches the new install ISOs itself, rebuilds the templates, tests them by rolling out a real VM from each, only then puts them into production, and emails a summary of what went right and wrong.

Templates age quietly. A manual rebuild always ends up at the bottom of the list, so in practice you are still rolling out an image with hundreds of missing updates months later — and only notice when something goes wrong. We wanted the maintenance to happen on its own, and a template to become the shared base only once it is proven you can get a working machine out of it.

Approach

  1. Fourth Saturday: a check across the upstream releases. If there is a newer ISO, it is fetched, checksum-verified and recorded — including a merge request that carries itself through, so the change is in git before anything is built with it.
  2. Fourth Sunday: the build. Six templates in a row, each in its own log file, and a failed build does not block the rest.
  3. Versioning in the content library: the existing template gets the date in its name and stays as an archive; the fresh one takes its place. Rolling back is a matter of choosing, not rebuilding.
  4. Smoke test: a throwaway VM is rolled out from each fresh template and checked — does the system boot, does the version match, are central users recognised — after which it is cleaned up again, even if the test fails.
  5. Reporting: one email with, per distribution, the outcome of build and smoke test, so you see at a glance whether the month went well.

Technology

  • Packer (HCL)
  • vSphere Content Library
  • Ansible
  • Bash
  • GitLab CI
  • cron