WilliamLam.com

  • About
    • About
    • Privacy
  • VMware Cloud Foundation
  • VKS
  • Homelab
    • Hardware Options
    • Hardware Reviews
    • Lab Deployment Scripts
    • Nested Virtualization
    • Homelab Podcasts
  • VMware Nostalgia
  • Apple
You are here: Home / Automation / Quick Tip - Prepare VMware Photon OS for use with vSphere Guest OS Customization and cloud-init

Quick Tip - Prepare VMware Photon OS for use with vSphere Guest OS Customization and cloud-init

06.29.2022 by William Lam // 1 Comment

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.


Below are the instructions in preparing VMware Photon OS so that it can leverage the new vSphere GOSC with cloud-init feature.

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:

disable_vmware_customization: false

Step 3 - Update the following to entry to the bottom of /etc/cloud/cloud.cfg configuration file with the value of true:

allow_raw_data: 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. 

More from my site

  • Using the new vSphere Guest OS Customization with cloud-init in vSphere 7.0 Update 3
  • Demo of VMware Cloud Consumption Interface (CCI)
  • Beta for VMware Cloud Consumption Interface (CCI) formally Project Cascade
  • Infinite possibilities with new VM Service CloudInit transport for vSphere with Tanzu in vSphere 8
  • Exploring the Cloud-init Datasource for VMware GuestInfo using vSphere

Categories // Automation, vSphere 7.0 Tags // cloud-init, Photon OS, vSphere 7.0 Update 3

Comments

  1. *protectedRicardo Marinho says

    08/20/2024 at 8:13 am

    Great Catch! You save me!

    Reply

Leave a Reply to Ricardo MarinhoCancel reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Search

Thank Author

Author

William is Distinguished Platform Engineering Architect in the VMware Cloud Foundation (VCF) Division at Broadcom. His primary focus is helping customers and partners build, run and operate a modern Private Cloud using the VMware Cloud Foundation (VCF) platform.

Connect

  • Bluesky
  • Email
  • GitHub
  • LinkedIn
  • Mastodon
  • Reddit
  • RSS
  • Twitter
  • Vimeo

Recent

  • Ultimate Lab Resource for VCF 9.0 06/25/2025
  • VMware Cloud Foundation (VCF) on ASUS NUC 15 Pro (Cyber Canyon) 06/25/2025
  • VMware Cloud Foundation (VCF) on Minisforum MS-A2 06/25/2025
  • VCF 9.0 Offline Depot using Synology 06/25/2025
  • Deploying VCF 9.0 on a single ESXi host? 06/24/2025

Advertisment

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy

Copyright WilliamLam.com © 2025

 

Loading Comments...