44 lines
2.4 KiB
Markdown
44 lines
2.4 KiB
Markdown
# Create a VM template from the latest Debian release with settings appropriate for the CCCHH Proxmox clusters
|
|
|
|
## Prerequisites
|
|
|
|
The script uses the package [`libguestfs-tools`](https://libguestfs.org)' `virt-builder` to download and customize a Debian image, and then add it as a template to Proxmox.
|
|
|
|
## Building the Template
|
|
|
|
### Configuration Options
|
|
Verify that the settings at the beginning of the script are suitable to the cluster you want to create the template from.
|
|
|
|
| Variable | Default | Description |
|
|
| --------- | ------------------ | ---------------------------------------------------------------------- |
|
|
| `VMID` | 9023 | ID the template should have in Proxmox |
|
|
| `STORAGE` | `local-zfs` | Pool the disks should be created in |
|
|
| `OS` | `debian-12` | `virt-builder` name of the OS to install |
|
|
| `NAME` | `chaos-${OS}-tmpl` | name of the template |
|
|
| `BRIDGE` | `vmbr0,tag=208` | name of the bridge to use and any parameters needed, like the VLAN tag |
|
|
|
|
### User Account, sshd, and `authorized_keys`
|
|
|
|
`cloud-init` will create a user `chaos`, by default with a locked password, and authorized keys initialized. Password-less `sudo` is configured, so you can run commands as root.
|
|
|
|
The script expects `authorized_keys` to be in the current directory. Copy the correct contents from the [appropriate repository](https://gitlab.hamburg.ccc.de/ccchh/infrastructure-authorized-keys).
|
|
|
|
`sshd` has been configured to listen on port 42666 instead of 22.
|
|
|
|
### Run the Script
|
|
|
|
```shell
|
|
sudo ./build-proxmox-template
|
|
```
|
|
|
|
## Cloning the Template
|
|
|
|
Please use "Full Clone" when creating a VM based on this template. Using Linked Clone means that the template's disk cannot be recreated since the linked clones need it. This means that the script cannot update the template.
|
|
|
|
### Disk Size
|
|
|
|
The installed `cloud-guest-utils` will automatically increase the root filesystem when you increase the size of the root disk. You will need to reboot the VM for the resize to take place. You can increase the size of the disk right after cloning and before starting the VM for the first time.
|
|
|
|
### Root Password
|
|
|
|
The root account is disabled. Use the `chaos` account. |