In this blog post I will go over the steps I took in order to to be able to query my vCenter components from SaltStack using the SDDC SaltStack Modules. The SDDC SaltStack Modules were introduced in 2011. You can find the technical release blog here. The modules can be found on GitHub here. There is also a getting quick start guide that can be found here.

I am using the pre packaged ova for deployment which includes most of the components however it does have some outdated packages. The first step for was to upgrade pip:

python3 -m pip install --upgrade pip

The image shows a pip upgrade process, indicating existing pip version 22.0.3 is being replaced with version 22.3.1.

Install the saltext.vmware module by running

salt-call pip.install saltext.vmware

Output shows successful installation of saltext.vmware via pip install.

Next I had to create a pillar that includes the vCenter information for the connection details.

Configuring vSphere connection details in a SaltStack pillar.

Actual code:

{
    "vmware_config": {
        "host": "vcsa-01a.corp.local",
        "password": "vcenter password",
        "user": "administrator@corp.local"
    }
}

Next I had to attach the pillar to a target by clicking on update targets:

The image shows a form field labeled “vmware_config” with an error message “This field is required.” Buttons for “UPDATE TARGETS” and “DELETE” are below.

In my case I created a specific target that contained the minion where I want to run it from

Select targets for VMware config in SDDC SaltStack wizard.

Going to the minion I was able to verify that the pillar has been attached by running

salt-call pillar.items

The output shows exactly the data that I had in my pillar

The image shows a configuration snippet for a vSphere module in SaltStack.

Next I wanted to get the configuration for the MOTD. I was able to simply run the bellow command to get an output

salt-call vmware_esxi.get_advanced_config config_name=Config.Etc.motd

As we can see in the screenshot below all hosts in my vCenter that had Config.Etc.motd as an configuration item reported their configuration

Hosts with Config.Etc.motd reported their configurations.

Additionally I was also able to check that the configuration exists in vCenter under the Advanced host configuration example:

Editing advanced system settings in vSphere with a warning about unsupported modifications.

Next I wanted to see if I can push a specific configuration change.

salt-call vmware_esxi.set_advanced_config config_name=Config.Etc.motd host_name=esx-01a.corp.local  config_value=Hello

The return was

The image shows a nested configuration structure for a vSphere environment, with labels and values related to SaltStack modules.

Checking the vSphere UI I was able to verify that the change was actually pushed through

vSphere UI shows advanced settings for system configuration.

Next I wanted to add it to the SaltStack UI in order for other team members to be able to use this functionality

First I navigated to SaltStack Config -> Config -> File Server. I also created another environment called vmware and inside it I created my motd.sls

Navigating through SaltStack Config, creating a new environment, and editing a module file.

The sls file had the following:

Config.Etc.motd:
  module.run:
    - name: vmware_esxi.set_advanced_config
    - config_name: Config.Etc.motd
    - config_value: Test text

If you are not familiar with the sls construct here is an explanation on where the values came from:

Config.Etc.motd: - Just a title
  module.run: - this tells salt to run the module
    - name: vmware_esxi.set_advanced_config - the name of the module that needs to be ran
    - config_name: Config.Etc.motd - The config name from vCenter
    - config_value: Test text - The Actual value to write

Next I wanted to create a job so it can be around for future use. In the SaltStack Config UI I navigated to Config -> Jobs -> Create job

Configuring SaltStack job for SDDC module with ‘state.apply’ function in VMware environment.

Once I saved the job I was able to go ahead and apply it by running it

UI shows “Run apply motd now?” with options for states, run as test, environments, and notification options.

Post completion I was able to verify that my state apply applied the desired configuration across all of my hosts in vCenter

Screenshot shows successful state.apply output for vSphere SDDC configuration.

From a vCenter perspective I was also able to double check that the config has actually changed

Advanced System Settings in vSphere UI shows Config.Etc.motd set to “Test text”.

The additional modules can be found here

The other vSphere modules can be found here

The image shows “The End” text on a black background with red curtains, likely a closing screen for a presentation or video.