Automate Salt Minion Deployment with VMware Tools for Seamless Infrastructure Management

Deploying Salt Minions with VMware Tools 12.0.0

In the latest release of VMware Tools, version 12.0.0, VMware has added a new integration capability that supports the deployment of Salt Minions within virtual machines. This new feature makes it easier than ever to deploy new Salt Minions to both new and existing virtual machines. In this post, I will walk through the process of deploying a Salt Minion to an existing virtual machine using VMware Tools 12.0.0.

Prerequisites

————-

Before proceeding with the deployment of Salt Minions, there are two pieces of information that you need to have:

1. The FQDN or IP address of your Salt Master.

2. The ID you wish to assign to the Salt Minion.

In this walkthrough, I will be using a Microsoft Windows Server 2022 virtual machine labeled “MANAGEMENT” within the vCenter Server.

Step 1: Connect to vCenter Server

The first step is to connect to the vCenter Server using VMware PowerCLI. The following command can be used to connect to the vCenter Server:

“`

Connect-VIServer -ComputerName

“`

Step 2: Define Variables

Next, we need to define variables that will store the virtual machine object, the FQDN of our Salt Master, and the ID we wish to assign to the new Salt Minion. The following commands can be used to define these variables:

“`

$vm = Get-VM -Name “MANAGEMENT”

$saltMasterFqdn = “saltstack.stevenbright.local”

$minionId = $vm.Name.ToLower()

“`

Step 3: Add Advanced Attributes

Now that we have defined the variables, we can add the new advanced attributes to our virtual machine using the following command:

“`

Set-VM -VM $vm -AdvancedAttribute @{name=”guestinfo.vmware.components.salt_minion”;value=”true”}

“`

Step 4: Start Installation Process

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, we can execute the following command:

“`

Get-VM -Name “MANAGEMENT” | Get-AdvancedSetting -Name “guestinfo.vmware.components.salt_minion.laststatus”

“`

Step 5: Monitor Salt Minion Status

To monitor the status of the Salt Minion, we can query the advanced attribute “guestinfo.vmware.components.salt_minion.laststatus”. The following are the possible return values:

* 100: The Salt Minion is running and has been successfully installed.

* 0: The Salt Minion is not running or has failed to install.

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.

Conclusion

———-

In this post, we have walked through the process of deploying a Salt Minion to an existing virtual machine using VMware Tools 12.0.0. This new capability 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. With this new integration, you can easily manage your Salt Minions within your vSphere environment.