Combining custom cloud init with auto-generated

The patch will be shipped with qemu-server_7.0-18.

I use it with ansible and terraform for IaC.

For reference:
Code:
##Bootstrap Cloud-Init Image##

A vendor config can be used to bootstrap cloud-init images.

For example to install qemu-guest-agent on debian/ubuntu distros after the vm has been deployed create the following snippet.

Note that the vendor config is executed on first boot only !


qm set 9000 --cicustom "vendor=local:snippets/vendor.yaml"

/var/lib/vz/snippets/vendor.yaml:
#cloud-config
runcmd:
    - apt update
    - apt install -y qemu-guest-agent
    - systemctl start qemu-guest-agent
 
Hi folks! My vendor cloud-init config is ignored. Relevant configuration of the VM (using Ubuntu 22.04 Cloud Image):
Code:
agent: enabled=1,freeze-fs-on-backup=1,fstrim_cloned_disks=1
boot: c
bootdisk: scsi0
cicustom: vendor=local:snippets/901-cloud-init.yaml

901-cloud-init.yaml:
Code:
# Update timezone
timezone: "America/Los_Angeles"

# These might not be needed as cloud-init updates the packages
package_update: true
package_upgrade: true
package_reboot_if_required: true

# Install packages
packages:
    - qemu-guest-agent
    - git

# Make sure qemu-guest-agent is running
runcmd:
    - systemctl start qemu-guest-agent

When I boot it everything works fine, but only items from cloud-init drive (DHCP, user, password) are applied. What could be the issue? I checked the /var/log/syslog and see changes from cloud-init drive being applied. How to troubleshoot this further?

Thanks!
 
<facepalm> my config was missing #cloud-config at the top of the file. I should have probably read the documentation more carefully, before using cloud-init.