For those trying to create an Ubuntu 18.04 cloud-init template and are stuck wondering why SSH does not work or why the vm disk size is not matching up to what was configured in XOA, please follow the below extra steps.
Note: If using the Ubuntu 18.04 in XCP-NG Center (not XOA), the mininum disk size is 10GB (it is not configurable to 4GB as described in the original Debian article.)
The following commands need to be run after you have installed Ubuntu 18.04 (but before you have converted the vm to a template)
# install cloud-init and deps sudo apt install cloud-init cloud-initramfs-growroot # !!! This part is important, make sure to keep ConfigDrive checked !!! # remove all datasources except `ConfigDrive: Reads data from Openstack Config Drive` sudo dpkg-reconfigure cloud-init # enable cloud-init systemd unit sudo systemctl enable cloud-init # disables bug message from https://bugs.launchpad.net/bugs/1669675 touch /home/ubuntu/.cloud-warnings.skip # disable root password passwd -l root
and finally, power off the vm and convert to a template.
- You shouldn't have to configure the default
/etc/cloud/cloud.cfgfile as it comes configured by Ubuntu out of the box
- The key is to enable the
cloud-initsystemd unit before powering off the vm.
- Before enabling
cloud-init, when a vm launched from the original template, it did not have SSH installed or the correct disk size.