Overview
I recently wanted to create a template in vSphere that I would use from VMware Aria Automation. I did not want to use vSphere customisation specifications, but rather cloud-init (and just cloud-init). There are many posts out there all differing from one another on how to prepare the template so that it will work properly. Some of these processes didn’t work for me, so I thought I better document what did work for me below.
Ubuntu VM Requirements
I created a brand-new Ubuntu VM using the following specification and setup.
Specification
Component | Value |
---|---|
CPU count | 1 |
RAM (GB) | 4 |
Disk Size | 40GB (thin provisioned) |
Nic count | 1 |
Setup
- Updated installation and upgraded (using apt)
- Installed any additional software (including git, curl etc)
Cloud-init Installation & Configuration
The first step is to install cloud-init. It should already be installed but let’s be safe and not sorry!
sudo apt-get install cloud-init -y
We need to clean up any existing cloud-init configurations (newer Ubuntu installers utilise cloud-init themselves)
sudo cloud-init clean
Lastly, as of Ubuntu versions 20.04.x live server, we need to remove 2 existing files otherwise cloud-init configuration will not execute later on.
sudo rm -rf /etc/cloud/cloud.cfg.d/subiquity-disable-cloudinit-networking.cfg
sudo rm -rf /etc/cloud/cloud.cfg.d/99-installer.cfg
Now shut down your vm with the following command
sudo shutdown -h now
Once the vm has shutdown, ensure that under the vm hardware settings, the CD-ROM drive device mode is set to Passthrough CD-ROM
Finally, shutdown your vm and convert it to a template. It is now ready to be used with VMware Aria Automation cloud templates.