After publishing my latest article on using the new vSphere 7.0 Update 3 feature vSphere Guest OS Customization (GOSC) with cloud-init, I came to learn that my blog post was also shared with our Guest OS Customization Engineering team. They reached out sharing their excitement about the blog post and shared one additional nugget when working with VMware Photon OS.
It turns out that VMware Photon OS can also leverage the new vSphere GOSC with cloud-init feature, but a couple of settings must be updated for this to work.
Step 1 - Install the desired version of VMware Photon OS using the ISO method. In the example below, I am using the latest Photon OS 4.0 release with all default options selected.
Step 2 - Update the following to entry to the bottom of /etc/cloud/cloud.cfg configuration file with the value of false:
Step 3 - Update the following to entry to the bottom of /etc/cloud/cloud.cfg configuration file with the value of true:
Step 4 - Run the cloud-init clean operation:
/usr/bin/cloud-init clean --logs
Step 5 - Shutdown the Guest OS
To help simplify the GuestOS preparation steps, I have created the a quick shell script that you can use that will automatically apply all the required changes listed above and then shutdown the GuestOS.
#!/bin/bash sed -i 's/disable_vmware_customization.*/disable_vmware_customization: false/g' /etc/cloud/cloud.cfg sed -i 's/allow_raw_data.*/allow_raw_data: true/g' /etc/cloud/cloud.cfg /usr/bin/cloud-init clean --logs shutdown -h now
At this point, you can either apply the vSphere GuestOS Customization directly onto this VM or simply turn this VM into a vSphere Template or Content Library Image to become the base image for deploying new VMs that can then be customized using cloud-init. Please refer to the "Apply GuestOS Customization" section of this blog post for more details.