Manage vCenter, ESX, NSX etc. with SaltStack

By | 28. January 2022

VMware has aquired SaltStack a while ago and incorporated some of the products into the vRealize Automation product family. While most of the configuration management functionality focusses on guest operating systems there has been increasing demand to do the same for VMware SDDC components like vCenter, ESX, NSX etc. as well. 

As of this VMware has released SDDC modules for SaltStack where my colleague Vincent Riccio has already done a great job in his blog explaining more details on it.

In this blog I’d would like to give a quick guidance on how to make it work on a SaltStack Config appliance that has been deployed by Lifecycle Manager. It requires few additions to the blog from Vincent above. The blog is not intended to provide a comprehensive coverage of the full functionality. Additional use cases might be added in upcoming blogs.

Installation of SDDC modules

Here’s the installation steps on the SaltStack master (appliance):

Install SDDC modules

pip3 install saltext.vmware

Restart service on salt master

service salt-master restart

Verify that files have been installed under /usr/lib/python3.7/site-packages/saltext/vmware/modules

Create the file /etc/salt/minion.d/module_dirs.conf with following content

module_dirs:
- /usr/lib/python3.7/site-packages/saltext/vmware

Restart salt-minion service

service salt-minion restart


Base configuration

Create following top.sls file unter /srv/pillars where you replace the hostname by your salt master

base: 
  'salt02.space.local':
    - vmware_config

Create vmware_config.sls file in the same directory. This file contains the credentials for vCenter access if you want to leverage the vCenter module.

vmware_config: 
host: vc01.space.local
password: password
user: administrator@vsphere.local

 

Testing deployment

For a quick and dirty test you could run this command to list all vCenter datacenters:

salt-call vmware_datacenter.list

To test the functionality from the GUI interface you can create a job that is run on the SaltStack master.

Create a state file that is stored on the file server. In this case it simply creates a VM folder on vCenter.

Create a job based on the state file.

Run the job on the SaltStack master.

Follow job execution in activity log.

Have fun!

print
Christian Ferber
Latest posts by Christian Ferber (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *

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