Yeah, I’ve read this answer everywhere, and I’m not really sure why this is consistently given as a valid answer. This doesn’t work for me and I’ve seen many people complain about not being able to reset cloud-init. Probably because the scenario doesn’t occur that often.
What worked me, apart from cloud-init clean, was:
rm -f /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg
cat << EOF > /etc/cloud/cloud.cfg.d/99-pve.cfg
datasource_list: [ConfigDrive, NoCloud]
EOF
Someone also suggested running this, but it worked for me without having to remove them:
rm -f /etc/netplan/00-installer-config.yaml
rm -f /etc/netplan/50-cloud-init.yaml
https://www.burgundywall.com/post/using-cloud-init-to-set-static-ips-in-ubuntu-20-04
Moreover, the autoinstaller works differently than I originally thought:
"ip={{ user `vm_ip` }}::{{ user `vm_gateway` }}:{{ user `vm_netmask` }}::::{{ user `vm_dns` }} ",
"autoinstall ds=nocloud-net;s=http://{{ .HTTPIP }}:{{ .HTTPPort }}/ ",
This is what I’m doing with packer (where you can replace your variables with the corresponding values, of course).
This is based on:
https://git.kernel.org/pub/scm/libs/klibc/klibc.git/tree/usr/kinit/ipconfig/README.ipconfig