Using cloud-init for vCloud Director Guest Customization

While troubleshooting a Rocky Linux VM that wouldn’t customize itself correctly, I discovered something interesting. Normal guest customization on linux uses perl scripts to change the IP, hostname, password, etc as requested by vCloud Director. However, I noticed in the logs that it checks if cloud-init is installed first, before it performs the perl actions.

So I went ahead and installed cloud-init on the Rocky VM using yum install cloud-init, then powered off the VM, changed the hostname in vCD, and Powered On and Force Customization. Sure enough, cloud-init changed the hostname instead of using perl scripts.

This was quite a surprising discovery to me, and I haven’t really found much in the way of documentation around it. It seems to be tied into vCenter guest customization directly. This could lead to a lot of uses.

One problem I ran into immediately, though, is that cloud-init disables password SSH authentication and root SSH access. Here is the quick fix:

Edit the file /etc/cloud/cloud.cfg
Set disable_root: to 0
Set ssh_pwauth: to 1

I’m pretty excited to play with this and see what it can do beyond the normal guest customization.

Written on August 13, 2021