Deploy Salt Minions Automatically Using VMware Tools


For several years, VMware has been adding new integration capabilities into new releases of VMware Tools. These capabilities often supported VMware products, including vRealize OperationsNSXAppDefence, and Carbon Black. The latest product to be integrated into VMware Tools 12.0.0 is VMware vRealize SaltStack ConfigVMware Tools 12.0.0 now includes the ability to automate the deployment of the Salt Minion software utilizing vSphere virtual machine guest variables. This new integration makes it easier than ever to deploy new Salt Minions to both new and existing virtual machines.

In this post, I walk through deploying the Salt Minion to an existing virtual machine utilizing this new automated method within VMware Tools 12.0.0. While not included in this walkthrough, this new capability also supports removing the Salt Minion from virtual machines.

Getting Started

This walkthrough assumes the following:

  • You have an existing VMware vRealize Automation SaltStack Config environment.
  • You have upgraded VMware Tools to version 12.0.0 on your virtual machine.
  • Your virtual machines can reach the Salt Master over the network.

The following prerequisites apply to this process:

  • Only 64-bit operating systems are supported.
  • For Windows, only Windows 8/Windows Server 2012 or later versions are supported.
  • VMware Tools must be installed with the Salt Minion feature enabled. By default, this feature is enabled in VMware Tools 12.0.0.

While not required to complete this walkthrough, I will utilize VMware PowerCLI to configure advanced attributes on the virtual machines. You can also add these advanced attributes using the vSphere Client as described in the vSphere 7.0 documentation: Set Advanced Virtual Machine Attributes.

Configuring the virtual machine to install the Salt Minion utilizing VMware Tools requires two pieces of information. You need the FQND or IP address of your Salt Master and the ID you wish to assign to the Salt Minion. In this walkthrough, the Salt Master has an FQDN of “saltstack.stevenbright.local”, and the Salt Minion ID will be the lower case version of the FQDN of the virtual machine.

Installing the Salt Minion

As I mentioned earlier, I will utilize VMware PowerCLI commands to add the advanced attributes to the virtual machine. The virtual machine that I will be targeting is a Microsoft Windows Server 2022 virtual machine labeled “MANAGEMENT” within the vCenter Server.

The first step using VMware PowerCLI is to connect to the vCenter Server using the following command:

Connect-VIServer vcenter.stevenbright.local

Next I will define variables that will store the virtual machine object, the FQDN of my Salt Master, and the ID that I wish to assign to the new Salt Minion:

$vm = Get-VM "MANAGEMENT"
$salt_master = "saltstack.stevenbright.local"
$salt_minion_id = $vm.Guest.HostName.ToLower()

Finally, I execute the commands to add the new advanced attributes to my virtual machine:

New-AdvancedSetting -Entity $vm -Name "guestinfo./vmware.components.salt_minion.args" -Value "master=$salt_master id=$salt_minion_id" -Confirm:$false
New-AdvancedSetting -Entity $vm -Name "guestinfo./vmware.components.salt_minion.desiredstate" -Value "present" -Confirm:$false
Screenshot of VMware PowerCLI Commands to Add Advanced Settings to the Virtual Machine

While the virtual machine is powered on, VMware Tools periodically polls guest variables for state changes. During the next polling cycle, VMware Tools will see the newly created guest variables that we defined and will start the installation process for the Salt Minion. 

Verifying Success

Unfortunately, this installation process does not generate log entries in the vCenter Server to notify us that it has started or finished. However, you can query the latest status of the Salt Minion by viewing the advanced attribute “guestinfo.vmware.components.salt_minion.laststatus”.

To accomplish this using VMware PowerCLI, I execute the following command:

Get-AdvancedSetting -Entity $vm -Name guestinfo.vmware.components.salt_minion.laststatus

The cmdlet should return the advanced setting with an expected value of “100”. The following are the possible return values:

  • 100 - Installed
  • 101 - Installing
  • 102 - Not Installed
  • 103 - Install Failed
  • 104 - Removing
  • 105 - Removing Failed
  • 126 - Script Failed
  • 130 - Script Terminated

(My thanks to Priyadarshi Khare for sharing these return codes!)

Screenshot Showing the Result from Querying the 'guestinfo.vmware.components.salt_minion.laststatus' Advanced Setting

Assuming everything has worked as expected, you should also now see a new Minion Key pending approval within the VMware vRealize Automation SaltStack Config web UI.

Screenshot of Pending Minion Keys in the VMware vRealize Automation SaltStack Config Web UI

As you can see, this new capability within VMware Tools 12.0.0 makes deployment of Salt Minions super easy and fast for all virtual machines within our vCenter Server. You could easily assign the advanced attributes to any number of virtual machines utilizing VMware PowerCLI.

Additional Information

VMware Tools 12.0.0 Release Notes
VMware Tools 12.0.0 Documentation - Enable Salt Minion Using VMware Tools

See Also


Search

Get Notified of Future Posts

Follow Me

LinkedIn Icon
Twitter/X Icon
Threads Icon
RSS Icon

Recent Posts