Virtualization

Build Repeatable KVM VMs With cloud-init

Build a reusable base without embedded secrets; Generate unique NoCloud identity and network data; Create two guests from independent overlays; Prove unique UUIDs, MACs, hostnames, machine IDs, SSH keys, and addresses.

By InventiveHQ Team

Episode 16 of the InventiveHQ KVM virtualization series.

Lab verified July 2026 · Ubuntu 26.04 · libvirt 12.0.0 · QEMU 10.2.1

What this episode proves

  • Build a reusable base without embedded secrets
  • Generate unique NoCloud identity and network data
  • Create two guests from independent overlays
  • Prove unique UUIDs, MACs, hostnames, machine IDs, SSH keys, and addresses

Validated workflow

1. Build a reusable base without embedded secrets

./provision-cloud-vm.sh ep16-app01 52:54:00:77:16:01 192.168.122.61 ~/.ssh/id_ed25519.pub

2. Generate unique NoCloud identity and network data

cloud-init status --long

3. Create two guests from independent overlays

virsh domuuid ep16-app01

4. Prove unique UUIDs, MACs, hostnames, machine IDs, SSH keys, and addresses

ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub

Finished state

The sanitized base and cloud-init templates remain; disposable proof guests are removed. The public scripts contain no private keys, passwords, or tokens. Review names, addresses, paths, ownership, backups, quorum, and fencing for your own environment before running them.

Need help from an IT & cybersecurity partner?

InventiveHQ helps businesses secure, modernize, and run their technology. Let's talk about your goals.

Get in touch