For several years, VMware has been adding new integration capabilities into new releases of VMware Tools. These capabilities often supported VMware products, including vRealize Operations, NSX, AppDefence, and Carbon Black. The latest product to be integrated into VMware Tools 12.0.0 is VMware vRealize SaltStack Config. VMware 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.
This walkthrough assumes the following:
The following prerequisites apply to this process:
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.
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:
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
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.
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:
(My thanks to Priyadarshi Khare for sharing these return codes!)
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.
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.
Get Notified of Future Posts