Working with vSphere Configuration Profiles / Desired State
search cancel

Working with vSphere Configuration Profiles / Desired State

book

Article ID: 322327

calendar_today

Updated On:

Products

VMware vSphere ESXi

Issue/Introduction

The purpose of this document is to go over the following information in relation to vSphere configuration profiles (also known as Desired State).

  • Overview of vSphere configuration profiles
  • Removing host profiles before implementing vSphere configuration profiles
  • Editing the JSON file / finding the BIOS UUID to add a new host to an existing cluster

This feature can be found in:

Cluster > Configure > Desired State > Configuration

 

 

 


Symptoms:

Adding a new host to an existing cluster with configuration profiles / desired state enabled and the following errors are present after adding the host:

  • ipv4_address
  • ipv4_default_gateway

 

 

Environment

VMware vSphere ESXi 8.0

Cause

vSphere configuration profiles were created to continue the work that vLCM started by trying to make clusters as homogenous as possible. A general overview of the feature and walkthrough of implementation can be found here:

https://core.vmware.com/resource/configuration-management-using-vsphere-configuration-profiles
 

 

Note: Before implementing vSphere configuration profiles, existing host profiles will need to be removed. Failure to remove host profiles will result in a host failing to re-connect in a cluster after a reboot, when vSphere configuration profiles are enabled. The error message will state that there is a conflict between the vSphere configuration profile, and the host profile attached to the host.

If host profiles were not removed:

  • Navigate to Top left menu (the 3 vertically stacked lines) > Policies and Profiles > Host Profiles
  • Detach or delete the profile attached to the host in question.

Resolution

How to add a new host to an existing cluster with vSphere configuration profiles already enabled

 

Step 1: Locate the BIOS UUID

This step is needed as the BIOS UUID is how each host in a cluster is identified by this value. The location for this in the vCenter GUI is at the following location:

Host > Configure > Hardware > Overview

The value can also be retrieved from the HOST CLI by running the following command:

smbiosDump | grep UUID

 

Step 2: Download the existing JSON file

This can be done by going to: Cluster > Configure > Desired State > Configuration


Once there, select the 'EXPORT' button

A pop up will then happen, select 'DOWNLOAD"

 

Step 3: Edit the existing JSON file for "Host-Specfic" section

  • Now that the JSON file has been downloaded, open it with a text editor. Once the file is open, go down to the "host-specific section" (toward the bottom of the file)
    • Copy from the existing host UUID value to the closing bracket before "metadata".
  • With that information in clipboard, put a comma after the last bracket that was copied, then hit enter for a new line, and then paste what was copied.
  • Now use the BIOS UUID that was identified in Step 1 to make the additional customizations to the file for the new host.
    • Example:
  • The highlighted sections above are to show the differences between the first host specific section and the second. For example, note the ipv4_address key's value in each host differs.
  • Finally, notice there is no difference in the scratch location in the above example. This is specific to the environment and if the value is not set, it will not be present in the JSON file exports. If there should be a scratch location defined, adjust accordingly.
  • At this point save the JSON file and close the text editor.

 

Step 4: Re-import and apply the configuration

Go to Cluster > Configure > Desired State > Configuration in the vSphere Client, and hit the 'Import' button


Browse to the file and select import from the menu that appears

If any error pops up at this point, there probably is a syntax error in the JSON file. Please read the error message and adjust the file accordingly and try to re-import (i.e. check that the BIOS UUID is unique, that the comma is in the correct spot to not close out the 'host-specific' section, and that all the brackets are closed correctly).

Once the file is imported, go to the 'Compliance' tab:

  • Check compliance
  • Run pre-check
  • Remediate

If the host was added to the cluster before editing the JSON file, a message is thrown saying that the host is out of compliance, and that the management IP and other configurations are not valid. In order to remediate, the host may need to reboot.

 

Once the remediation has been applied, all the host should have green checkmarks and it should show that "0 host are out of compliance."

Additional Information

The VCSA has a tool that can be used to validate the JSON file. Upload the JSON file to the VCSA and run:

cat file_name.json | json_pp