Clone / migration of cicustom yaml with cloud init seems not supported?

Rxunique

New Member
Feb 5, 2024
26
0
1
Recently I tried to get my head around cloud init, did get it to work but found a bigger question.

In my use case, I'm using jammy-server-cloudimg-amd64.img as base image due to kernel compatibility, and found I need to apply 2 custom yaml. One is setting different metric to multiple NICs, and install qemu-guest-agent so PVE can property shut it down.

They are relatively straight forward with cicustom: network= & vendor= custom yaml, well documented here https://pve.proxmox.com/wiki/Cloud-Init_Support

My challenge comes cloning or migrating the custom yaml files.

I found when I full clone a template, the new VM still reference original yaml rather than new copy.
I also found when migration between PVE nodes, the yaml stays on original node rather than being copied along.

While both can be easily managed via SSH commands, but that kinda defeats the purpose of using cloud-init to simplify/automate VM creation.

So is this just how it is with PVE, or am I missing something?
 
I also found when migration between PVE nodes, the yaml stays on original node rather than being copied along.
It is easiest to use a shared storage which supports the snippets.

I found when I full clone a template, the new VM still reference original yaml rather than new copy.
Then PVE would need to know a naming scheme and would need write access to the location of the files.
Imho it is better to take care of this separately, like with a shell script. It could trigger cloning the template and then just change the assignment of the yaml-files.
In other words, customize the yaml files, e. g. by script, create a clone of your template, assign the customized yaml-files, start the new vm.
qm clone $templateid $cloneid --name $clone_name --full true
qm set $cloneid --cicustom "user=storage:snippets/${cloneid}_user.yaml,network=storage:snippets/${cloneid}_network.yaml"
qm start $cloneid
Name of storage and path are just examples, of course.

So is this just how it is with PVE
Yes. :)