Ubuntu autoinstall cloud-init

Rufus Ebonhawk

Well-Known Member
Aug 7, 2017
45
3
48
55
We provision our CentOS 8 kvm template with kickstart which works fine. We clone with cloud-init of Proxmox.

Now we want to add an Ubuntu template. Ubuntu uses now and in future "cloud-init" autoinstall (https://ubuntu.com/server/docs/install/autoinstall)

Ubuntus new autoinstall works quite well. But if we clone from the template the cloud-init setup from ubuntu autoinstall installer is still in the template and prevents Proxmox from its cloud-init provisioning.

So we tried to remove installers cloud-init package (and snapd :-/) from the autoinstall cloud-init:


YAML:
  late-commands:
    - [ sh, -c, echo "=========Purge cloud-init I=========" ]
    - [ sh, -c, apt-get purge cloud-init --autoremove --yes; rm -rf /etc/cloud /var/lib/cloud /run/cloud-init ]
    - [ sh, -c, echo "=========(Re)install cloud-init II=========" ]
    - [ sh, -c, apt-get install cloud-init --yes ]
    - [ sh, -c, echo "=========Remove snap I=========" ]
    - [ sh, -c, snap remove subiquity; snap remove lxd; snap remove core18; snap remove snapd ]
    - [ sh, -c, echo "=========Remove snap II=========" ]
    - [ sh, -c, apt-get purge snapd --autoremove --yes; rm -rf /root/snap /snap /var/snap /var/lib/snapd ]
    - [ sh, -c, echo "=========Poweroff=========" ]
    - poweroff

This does not work. Also not with "curtin" (part of the Ubuntu installer process) which is described here https://ubuntu.com/server/docs/install/autoinstall-reference#late-commands:

Example:
YAML:
   - [ sh, -c, echo "=========Remove snap I=========" ]
   - [ sh, -c, curtin in-target --target=/target -- snap remove subiquity; snap remove lxd; snap remove core18; snap remove snapd ]

The command is executed but when we start the generated vm snap is still here just like cloud-init.

Does anyone has experience with Ubuntu cloud-init autoinstall especially in connection with Proxmox cloud-init.

We would like to avoid to manually remove installers cloud-init (and snapd) from the generated vm.