diff --git a/doc/configuration.md b/doc/configuration.md index cdeb7d4e..632ef51d 100644 --- a/doc/configuration.md +++ b/doc/configuration.md @@ -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-.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.