Enable Salt Minion Using VMware
Tools
Salt Project is a Python based open-source software for event driven IT automation,
remote task execution and configuration management.
- Supports only 64 bit OSes.
- For Windows, Windows 8 and later versions are supported.Windows 2008R2 is not supported.
- VMware Tools must be installed with Salt Minion feature. By default, this feature is enabled.
- There are dependencies on installed packages in Linux (like curl and wget)
For more information on Salt, see Salt User
Guide.
Salt requires a salt-minion to be
deployed in the guest. Salt specific guest variables are set on the host side per VM
basis and subsequently read by VMware Tools inside guest. VMware Tools then
downloads the salt bundle and spins up a salt-minion instance inside the guest.
- Host side configuration per VM using guest variablesHost admin manages all the guest variable settings on the host side for a particular VM using VIM API or vSphere/VC UI.
- Windows:VMware Tools Salt Minion feature is installed by default and can be modified in custom installation.For VMware Tools to create a salt-minion instance on a particular VM and connect the salt-minion with the salt-master, host admin must configure and set the guest variable for that VM.In vSphere host UI, select a particular VM, right click and edit settings. In the VM Options tab, selectand set
- guestinfo./vmware.components.salt_minion.desiredstateto present
- guestinfo./vmware.components.salt_minion.argsto<custom arguments to VMware Tools salt-minion setup script>
For example:guestinfo./vmware.components.salt_minion.desiredstate→ presentguestinfo./vmware.components.salt_minion.args→ master=1.2.3.4 - Linux:Host admin must install open-vm-tools and open-vm-tools-salt-minion and then set the guest variable for a particular VM as:
- guestinfo./vmware.components.salt_minion.desiredstateto present
- guestinfo./vmware.components.salt_minion.argsto<custom arguments to VMware Tools salt-minion setup script>
For example:guestinfo./vmware.components.salt_minion.desiredstate→ presentguestinfo./vmware.components.salt_minion.args→ master=1.2.3.4 id=12345
- Removing salt-minionIn Windows or Linux, if the host admin sets the guest variableguestinfo./vmware.components.salt_minion.desiredstateto absent, then VMware Tools removes the salt-minion instance in the guest VM.For example:guestinfo./vmware.components.salt_minion.desiredstate→ absent
- Checking the latest status of salt-minion inside the guestTo check the latest status of the salt-minion inside the guest in the vSphere UI, use the guest variable:guestinfo.vmware.components.salt_minion.laststatus
- Guest side configuration using tools.confThetools.conffile contains the configurations for VMware Tools in an.iniformat. This tool looks for thesalt_minionsection and uses the configurations defined under that section. This file is stored at:Windows -C:\ProgramData\VMware\VMware Tools\tools.confLinux -/etc/vmware-tools/tools.confHere is an example of thesalt_minionsection as defined intools.conf:[salt_minion] master=1.2.3.4 conf_file=/etc/salt/minion id=dev_minionOnly minion config options are available intools.conf. The desired script action cannot be obtained fromtools.conf.
- Configuring the interval to monitor state change in the guest variables:VMware Tools periodically polls guest variables for the state changes. Default poll-inteval is 180s and can be configured in thetools.confsettings.[componentmgr]poll-interval=180(Default value: 180s)
- Enabling and disabling component (salt_minion):
- Guest admin can enable salt_minion by configuring thetools.confsettings.[componentmgr]included=salt_minion
- Guest admin can enable all the components by configuring thetools.confsettings.[componentmgr]included=all(Default configuration)
- Guest admin can disable all components by configuring thetools.confsettings.[componentmgr]included=none
- Installing salt-minion using an install script
- Linux environmentOn Linux systems, the install scriptsvtminion.shis a bash script with the following pre-requisites:
- - systemctl
- - curl
- - sha512sum
- - vmtoolsd
- - grep
- - awk
- - sed
- - cut
- - wget
svtminion.sh --helpshows the command line options.Usage:./svtminion.sh [-c|--clear] [-d|--depend] [-h|--help] [-i|--install] [-j|--source] [-l|--loglevel] [-m|--minionversion] [-r|--remove] [-s|--status] [-v|--version]For example: URL locationwhere./svtminion.sh [-j|--source], specifies the location to install Salt Minion from. The default isrepo.saltproject.iolocation.http://my_web_server.com/my_salt_onedirhttps://my_web_server.com/my_salt_onedirfile:////my_path/my_salt_onedir//my_path/my_salt_onedirIf specific version of Salt Minion is specified, [-m|--minionversion], then its appended to source. The default is latest.Here is an example of the installingsalt_minionas defined intools.conf:[salt_minion] master=1.2.3.4 conf_file=/etc/salt/minion id=dev_minion source=https://my_web_server.com/my_salt_onedirIf installing from your private replica of the standard repository location for salt, use - Windows environmentOn Windows systems, the install scriptsvtminion.ps1is a powershell script. The only prerequisite for Windows is the 'vmtoolsd.exe' binary, which is used to query the guest variables data.To get help for this script, run the commandsvtminion.ps1 -horGet-Help svtminion.ps1.VMware Tools script for managing the Salt minion on a Windows guest is:.\svtminion.ps1 [-Install] [-MinionVersion <String>] [-Source <String>] [[-ConfigOptions] <String[]>] [-LogLevel <String>] [-Help] [-Version] [<CommonParameters>]where-Source <String>is the URL or path to the repo containing the installers.This would contain a directory structure similar to that found at the default location: https://repo.saltproject.io/salt/vmware-tools-onedir/. This can handle most common protocols like http, https, ftp, unc, localFor example:PS>svtminion.ps1 -Install PS>svtminion.ps1 -Install -MinionVersion 3004-1 master=192.168.10.10 id=dev_box PS>svtminion.ps1 -Install -Source https://my.domain.com/vmtools/saltTo see the examples, typeget-help .\svtminion.ps1 -examplesFor more information, typeget-help .\svtminion.ps1 -detailedFor technical information, typeget-help .\svtminion.ps1 -full
- Fetching log informationGuest admin can fetch log information related to salt-minion from the following path:WindowsLog FileLocationLog file for checking salt-minion statusC:\Windows\Temp\vmware-svtminion-status-{Timestamp}.logLog file for installing a salt-minion instance inside the guestC:\Windows\Temp\vmware-svtminion-install-{TimeStamp}.logLog file for removing a salt-minion instance inside the guest:C:\Windows\Temp\vmware-svtminion-remove-{TimeStamp}.logLog file for checking runtime information after installing or removing a salt-minion instance inside the guestC:\salt\var\log\minion log filesLinuxLog FileLocationLog file for checking salt-minion status/var/log/vmware-svtminion.sh-status-{Timestamp}.logLog file for installing a salt-minion instance inside the guest/var/log/vmware-svtminion.sh-install-{TimeStamp}.logLog file for removing a salt-minion instance inside the guest:/var/log/vmware-svtminion.sh-remove-{TimeStamp}.logLog file for checking runtime information after installing or removing a salt-minion instance inside the guest/var/log/salt/minion