1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

docs(configuration): how to make a template the cloud-init seed works with

A template installed from an ISO has no cloud-init, and the seed does
nothing there. The steps install it, clean the template and empty its
machine-id (a deleted one leaves a Debian 12 clone without a DHCP
address), then create VMs from its disk with the seed ticked. Run end
to end on AlmaLinux 8 (cloud-init 23.4) and Debian 12 (22.4) templates
without cloud-init.
This commit is contained in:
catborise 2026-11-25 00:12:38 +03:00
parent bda6826f76
commit fe9ca0231d

View file

@ -108,6 +108,24 @@ datasource:
Without the network: tick **Cloud-init seed** (Advanced) when creating a VM. The VM gets a CD-ROM with its hostname and your SSH keys (a NoCloud seed, `cidata-<uuid>.iso` in the disk's directory pool), which the image's cloud-init reads at first boot; it is deleted with the VM's disks.
### A template for the seed
Distribution cloud images (`GenericCloud`, `genericcloud`) come with cloud-init. A template installed from an ISO needs it once:
1. Start a VM on the template disk and install cloud-init in it: `dnf install -y cloud-init` or `apt install -y cloud-init`.
2. Remove what makes it this machine and shut it down:
```sh
cloud-init clean --logs --seed
truncate -s 0 /etc/machine-id
poweroff
```
Empty `/etc/machine-id`, do not delete it: without the file a Debian 12 clone gets no DHCP address (`cloud-init clean --machine-id` deletes it there).
3. Turn on **Settings > Options > Use as a template**, so the VM is not started again.
Create VMs with **Clone from template**, this VM's disk as **Template volume** and **Cloud-init seed** ticked. At first boot a VM takes its name as hostname and gets new SSH host keys and a new machine-id; your keys go to the image's default user (`default_user` in `/etc/cloud/cloud.cfg`, for example `almalinux` or `debian`), and `cloud-init status` says `done`. The seed sets no password and no static address: the network comes up with DHCP. A copy made on the VM's **Clone** tab gets no seed.
## Two-factor login (OTP)
Set `OTP_ENABLED = True` in [`data/local_settings.py`](#local-settings) to ask for a one-time code at login. It is per user: a user without a confirmed device signs in with the password alone.