Is there a way to mimic RedHat's cloud-init ISO with agent:config?

Hi,

Setting up a Incus VM running RedHat 8 is possible by using a qcow2 that RedHat supplies. You then need to setup cloud-init to get a user, a password and a SSH key installed at startup.

The normal Incus way is to have a profile with agent:config and a config with cloud-init.user-data. Unfortunately that doesn’t work with with RedHat 8

What I have working right now is to create an ISO with meta-data and user-data, [1]. The ISO is attached to the VM. This works, but I wish to do it via a incus profile.

If I understand it correctly then I first need an (Incus) agent in the VM, right? But how do I do that? Or do I need to use distrobuilder? Again, how would I use that to get an Incus-friendly image?

[1] Chapter 10. Preparing and deploying a KVM Guest Image by using RHEL image builder | Red Hat Product Documentation

Ah, I found out what I did wrong. I need cloud-init (see [1])

I can now create a VM from the rhel8 qcow2 image and supply my own user and password.

[1] Type: disk - Incus documentation

Yep, cloud-init:config works just fine with the RHEL qcow2 images.

For RHEL9 I usually use:

#cloud-config
runcmd:
 - mount /dev/sr0 /mnt
 - "cd /mnt && ./install.sh"
 - umount /mnt
 - systemctl start incus-agent

Which then gets the incus-agent up and running in there so I can just incus exec into it.