Guide
Proxmox VE cloud-init VM templates, kept up to date with oic-sync
Get one cloud-init VM template per image on your Proxmox VE node, ready for qm clone. Each new image version becomes a new template at the next run. Clones you already made are never touched.
What it does
oic-sync reads the catalog index, verifies the cosign signature of each image, and turns each new version into a VM template. The newest template is named after the image (debian-13); older ones are renamed, tagged as retired, then rotated out.
- Runs on the node, as root (like
pveam), through the local API withpvesh: no API token, nothing to configure. - No local state, idempotent: when everything is up to date, a run changes nothing. A daily timer is enough.
- Tested on Proxmox VE 9.2. VM templates only, no LXC.
Status: alpha. License: Apache-2.0. The same tool also keeps OpenStack Glance images up to date.
Install
On the node, as root, from PyPI. No extra is needed for Proxmox VE.
apt install pipx
pipx install oic-syncDownloads go to a file storage with the import content type. Enable it once, keeping the content types the storage already has:
# List the content types the storage already has, plus import
pvesm set local --content iso,vztmpl,backup,importBoth storages are checked before anything is created: a missing or inactive storage, or a missing content type, stops the run before any VM exists.
First run
Start read only with status and --dry-run, then sync.
# Compare the node templates with the index (read only)
oic-sync proxmox status
# Show what a sync would do (read only, signatures verified)
oic-sync proxmox sync --image debian-13 --image ubuntu-24.04 --dry-run
# Do it: templates from VMID 9000, disks on local-lvm
oic-sync proxmox sync --image debian-13 --image ubuntu-24.04 --vmid-base 9000 --disk-storage local-lvm
# Remove versions beyond --keep that no linked clone uses
oic-sync proxmox sync --image debian-13 --keep 2 --deleteoic-sync list shows the image IDs of the index. proxmox status --check exits with 1 when an image is not up to date, for monitoring, and --json gives machine-readable output.
Use a template
Cloud images are small: grow the disk before the first boot. A linked clone, made with --full 0, protects its template from deletion by the rotation.
qm clone 9000 120 --name web1 --full 0
qm set 120 --sshkeys ~/.ssh/id_ed25519.pub
qm resize 120 scsi0 +20G && qm start 120Options
Options of oic-sync proxmox sync. The full list is in oic-sync proxmox sync --help.
| Option | Meaning |
|---|---|
| --node NAME | Node to work on (default: the node named like this host). |
| --import-storage | File storage with the import content type, for downloads (default local). |
| --disk-storage | Storage of the template disks, EFI vars and cloud-init drive (default local-lvm). |
| --bridge | Bridge of net0 (default vmbr0). |
| --vmid-base N | First VMID for templates, for example 9000 (default: the next free VMID of the cluster). |
| --memory MIB | Template memory (default 2048 MiB). |
| --cores N | Template CPU cores (default 2). |
| --image ID | Image to handle, repeatable. Default: every image of the index except the service and test images. |
| --variant NAME | Only this variant of multi-variant images (--variant uefi for Alpine). |
| --keep N | Versions kept per image, the current one included (default 2). |
| --delete | Destroy versions beyond --keep, only when no linked clone uses them. |
| --dry-run | Read the node and verify signatures, change nothing. |
| --no-verify-signature | Skip the cosign check (not recommended). |
| --index-url URL | Another index ($OIC_INDEX_URL), for example a mirror made with oic-sync mirror. |
| --timeout | Seconds to wait for an import step to finish (default 3600). |
Skipped unless named with --image: the OpenStack service images octavia-amphora, manila-service-image and trove-guest-image, the test image cirros and the rescue image cloud-rescue.
What a template looks like
The same settings as the qm commands on each image page of this site:
virtio-scsi-singlecontroller,scsi0imported from the qcow2 withdiscard=on, virtio network on the bridge, serial console.- Cloud-init drive on
ide2,ciuserset to the image login user, DHCP onnet0. - QEMU guest agent enabled (except for images that do not ship it, such as CirrOS).
- UEFI images:
bios: ovmf,machine: q35and an EFI disk without pre-enrolled keys. - Tags
oicandoic-<image id>, and a machine-readable block in the description that oic-sync reads back.
Only VMs with these tags and this block are touched. Your own tags are kept. A clone copies the tags and the description, but its block names another VMID, so clones are never touched.
How it works
- Verify the cosign bundle against the sha256 of the index. A failed verification means no import.
- Create the VM shell with a free VMID.
- Download the qcow2 with Proxmox's own
download-url, given the signed sha256: Proxmox checks the digest itself. - Import the disk and add the cloud-init drive.
- Convert to a template, then delete the downloaded file.
On any failure, the VM and the downloaded file are removed. The current version is named after the image ID (debian-13), older versions <image id>-<version> with the tag oic-retired. The name moves to the newest template at each sync, so automation should look templates up by tag and name at clone time.
With --delete, a version beyond --keep is destroyed only when no VM of the cluster is a linked clone of it. An import that never became a template (crashed run) is removed after 6 hours, with its downloaded file.
Run it daily
The index is rebuilt once a day, so a daily run is enough. On the node, as root:
# /etc/systemd/system/oic-sync-proxmox.service
[Service]
Type=oneshot
ExecStart=/root/.local/bin/oic-sync proxmox sync --image debian-13 --vmid-base 9000 --keep 2# /etc/systemd/system/oic-sync-proxmox.timer
[Timer]
OnCalendar=daily
RandomizedDelaySec=1h
Persistent=true
[Install]
WantedBy=timers.targetsystemctl enable --now oic-sync-proxmox.timerRun it from one timer only (see below).
Limitations
- Alpha, and no release yet: install from GitHub as above.
- One node per run, through the local API as root. Run it on each node that needs templates on local storage, or once for a shared storage. No remote mode, no API token.
- VMs only (no LXC templates). qcow2 images only.
- Tested on Proxmox VE 9.2 with LVM-thin (the default local-lvm) and directory storages: BIOS and UEFI templates, linked clones, rotation, interrupted runs. ZFS and Ceph disk storages should work but have not been tried yet: start with
--dry-runand a single--image. - Two runs at the same time on one node may import the same version twice: run it from one timer only.
Full reference: the Proxmox VE section of the oic-sync README. Problems go to its issue tracker.