add option for debian

This commit is contained in:
2026-11-02 23:45:31 +01:00
parent 86cabea76f
commit dda3541f97
2 changed files with 56 additions and 26 deletions
+13 -4
View File
@@ -1,11 +1,13 @@
# Proxmox Create Template
Script to create a Proxmox template VM using the newest Ubuntu Cloud Image, with a cloud-init drive.
Script to create a Proxmox template VM using the newest Ubuntu or Debian Cloud Image, with a cloud-init drive.
## What it does
1. Looks up the newest Ubuntu release on `cloud-images.ubuntu.com` (newest LTS by default).
2. Downloads the cloud image and verifies its SHA256 checksum.
1. Looks up the newest release:
- **Ubuntu**: from `cloud-images.ubuntu.com` (newest LTS by default)
- **Debian**: current stable (from `deb.debian.org`), `genericcloud` image from `cloud.debian.org`
2. Downloads the cloud image and verifies its checksum (SHA256 for Ubuntu, SHA512 for Debian).
3. Optionally bakes `qemu-guest-agent` into the image with `virt-customize` (installs `libguestfs-tools` if missing).
4. Creates the VM (virtio NIC, virtio-scsi-single, `cpu host`, guest agent enabled, serial console).
5. Imports the image as `scsi0` (discard, ssd, iothread) and resizes it to `DISK_SIZE`.
@@ -30,6 +32,12 @@ Override any setting via environment variables:
VMID=9001 STORAGE=local-zfs CHANNEL=latest ./create-template.sh
```
Debian template:
```bash
DISTRO=debian VMID=9002 ./create-template.sh
```
Then clone the template:
```bash
@@ -40,6 +48,7 @@ qm clone 9000 <newid> --name <name> --full && qm start <newid>
| Variable | Default | Description |
|-------------------|-----------------------------|-------------|
| `DISTRO` | `ubuntu` | `ubuntu` or `debian` |
| `VMID` | `9000` | ID of the template VM (must not exist yet) |
| `STORAGE` | `local-lvm` | Storage for the disk and cloud-init drive |
| `BRIDGE` | `vmbr0` | Network bridge |
@@ -47,7 +56,7 @@ qm clone 9000 <newid> --name <name> --full && qm start <newid>
| `MEMORY` | `2048` | Memory in MiB |
| `DISK_SIZE` | `20G` | Final root disk size (must be larger than the image, ~3.5G) |
| `ARCH` | `amd64` | `amd64` or `arm64` |
| `CHANNEL` | `lts` | `lts` = newest LTS, `latest` = newest release incl. interim |
| `CHANNEL` | `lts` | Ubuntu only: `lts` = newest LTS, `latest` = newest release incl. interim. Debian always uses stable |
| `CI_USER` | `niklas` | Cloud-init default user |
| `CI_PASSWORD` | *(empty)* | Optional password; leave empty to rely on SSH keys only |
| `SSH_KEY_FILE` | `$HOME/.ssh/authorized_keys`| Public keys injected via cloud-init |