- Notifications
You must be signed in to change notification settings - Fork5
License
saltstack/salt-vmtools
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
The VMTools salt integration script installs, removes, or checks the status ofa Salt minion (salt-minion) in a VMware controlled Virtual Machine environment.
This script operates as a BASH script in Linux environments and a PowerShellscript in Windows environments.
The Salt minion is a Onedir architecture based Python 3 Salt minion leveragingrelenv (https://github.com/saltstack/relenv) onedir option internally.The Salt minion is fully self-contained and requires no additional dependencies.
The script can install, remove, and check the status of an installed Salt minioneither using a direct command line option or via VMware's use of Guest Variables,commonly referred to as guestVars.
In every two-step installation example, you would be well-served toverify against the SHA256sum of the downloadedsvtminion.sh file.
The SHA256 sum of thesvtminion.sh file, per release, is:
- 2025.12.12:
ec17529cb407d7797a8810edaf4aed74005d8c1961da90a2728099b4657cd645 - 2025.12.10:
964e2bf9b810c613a7aacd4052ad12d3c20f1d3504df70d85c4e278429cbe4a9 - 2025.12.09:
7d8ac0ef090e8e90f4f4d0071a6cd6ec44dd258a835d3946125c9f400b059940 - 2025.12.08:
03ea7103a0021f8b8508be315ad10492cbceab353823567bd41b3a3609b21e04 - 2024.12.05:
dc6c2438d94a535067c871f8d84960ddbf4b77f204f6d9e91fd3baa021b93270 - 2024.12.04:
e7f4d7b242bd495c63e7b3240631411fbe65ac966ff2c1ef93399ceda9b5719f
If you're looking for aone-liner to install Salt Minion, please read below.
The latest versions of the svtminion scripts for Linux and Windows from the followinghttps://github.com/saltstack/salt-vmtools/releases/latest/download/svtminion.sh andhttps://github.com/saltstack/salt-vmtools/releases/latest/download/svtminion.ps1
There are also .sha256 files for verifying against in the repo for the main branch.You can also get the correct sha256 sum for the tagged release fromhttps://github.com/saltstack/salt-vmtools/releases/latest/download/svtminion.sh.sha256 andhttps://github.com/saltstack/salt-vmtools/releases/latest/download/svtminion.ps1.sha256
You can pass configuration to this script in 3 ways: guestVars, tools.conf andthe command line. Each option has an order of precedence. The lowest beingguestVars, followed by tools.conf, with the highest precedence being the commandline. Each option is explained in the following sections.
VMware guestVars can contain the action this script performs as well as theminion config options to be set by this script. The config values here willoverride any config options defined intools.conf with the same name.
The guestVars paths are as follows:
| Option | guestVars Location |
|---|---|
| Action | vmware.components.salt_minion |
| Config | vmware.components.salt_minion.args |
If set, theAction option will return a single word that is the action thisscript will perform. If set, theConfig option will return a space delimitedlist of minion config options. For example:master=198.51.100.1 id=my_minion multiprocessing=false
These values are set on the host OS using thevmrun binary. For example:
# To set the Action to install the salt-minionvmrun writeVariable "<path/to/vmx/file>" guestVar vmware.components.salt_minion "present"# To set the Action to remove the salt-minionvmrun writeVariable "<path/to/vmx/file>" guestVar vmware.components.salt_minion "absent"# To set the Config Optionsvmrun writeVariable "<path/to/vmx/file>" guestVar vmware.components.salt_minion.args "master=203.0.113.1"They can be read on the guest OS using thevmtoolsd binary. For example:
# To read the Config Options[root@fedora]# vmtoolsd --cmd "info-get guestinfo.vmware.components.salt_minion.args"master=203.0.113.1Thetools.conf file contains the configurations for vmtools in an.ini format.This tool looks for thesalt_minion section and uses the configurations definedunder that section. This file is stored at:
| OS | Location |
|---|---|
| Linux | /etc/vmware-tools/tools.conf |
| Windows | C:\ProgramData\VMware\VMware Tools\tools.conf |
Below is an example of thesalt_minion section as it may be defined intools.conf:
[salt_minion]master=203.0.113.1conf_file=/etc/salt/minionid=dev_minionNote: Only minion config options are available intools.conf. The desiredscript action cannot be obtained fromtools.conf.
Any input passed to the script on the command line will take precedence over:
- The action and config options set in guestVars
- Anything configured in
tools.confwith the same name.
Linux example:
[root@fedora]# svtminion.sh --install master=198.51.100.1Windows example (note the single dash):
# PowershellPS> svtminion.ps1 -install master=198.51.100.1# cmdC:\>powershell -file svtminion.ps1 -install master=198.51.100.1Note: Higher preference configuration options will supersede lowerpreference values. For example, in the configuration preference examplesoutlined above, the final value for master is198.51.100.1. Command lineoption for master overrides thetools.conf value of203.0.113.1 and theguestVars value of203.0.113.1 because the command line arguments have thehighest precedence.
Note:* On Windows, if the minion ID is not passed, the guest host name willbe used. However, on Linux there is no guarantee that a host name will be set.Therefore, a minion ID is automatically generated for the Salt minion. In eithercase, the minion ID can be specified in any of the 3 config options. For example:
id=myminionNote: At all times preference is given to actions presented on the commandline over those available from guestVars.
For example, if the following is passed on the command line:
[root@fedora]# svtminion.sh --installAnd the following is defined in guestVars:
[root@fedora]# vmtoolsd --cmd "info-get guestinfo.vmware.components.salt_minion"removePreference is given to the command line argument and the Salt minion package willbe installed.
This script creates a log file at the following location:
| OS | Location |
|---|---|
| Linux | /var/log |
| Windows | C:\Windows\temp |
The content of the log file depends on theLogLevel passed on the commandline. The default value iswarning. Valid options are:
| Log Level | Description |
|---|---|
silent | Suppresses displayed output but logs errors and warnings |
error | Displays and logs only errors |
warning | Displays and logs errors and warnings |
info | Displays and logs errors, warnings, and info messages |
debug | Displays and logs all messages |
The names of Log files are based on the action that the script is performing. Theaction can be defined on the command line or by setting a value in guestVars.Any logging that is unrelated to an action uses the keyworddefault. Validactions are as follows:
cleardependinstallreconfigremovestartstatusstop
For example, running the script without a defined action results in a logfile with the following name:
# Linuxbash>svtminion.sh --version --loglevel debug/etc/log/vmware-svtminion.sh-default-YYYYMMDDhhmmss.log# WindowsPS>.\svtminion.ps1 -LogLevel debugorcmd>powershell -file .\svtminion.ps1 -LogLevel debugC:\Windows\temp\vmware-svtminion-default-YYYYMMDDhhmmss.logOnly the 10 most recent log files for each action are maintained. Excess logfiles are removed. Log files are not removed when the salt-minion service is uninstalled.
On Linux systems, the install script is a bash script with the followingpre-requisites:
- systemctl
- curl
- sha512sum
- vmtoolsd
- grep
- awk
- sed
- cut
- wget
- find
svtminion.sh --help shows the command line options
Usage for the script svtminion.sh usage: ./svtminion.sh [-c|--clear] [-d|--depend] [-h|--help] [-i|--install] [-j|--source] [-l|--loglevel] [-m|--minionversion] [-n|--reconfig] [-q|--stop] [-p|--start] [-r|--remove] [-s|--status] [-u|--upgrade] [-v|--version] -c, --clear clear previous minion identifer and keys, and set specified identifer if present -d, --depend check dependencies required to run this script exist -h, --help this message -i, --install install and activate the salt-minion parameters key=value can also be passed on the CLI -j, --source specify location to install Salt Minion from default is repo.saltproject.io location for example: url location http://my_web_server.com/my_salt_onedir https://my_web_server.com/my_salt_onedir file://my_path/my_salt_onedir //my_path/my_salt_onedir if specific version of Salt Minion specified, -m then its appended to source, default[latest] -l, --loglevel set log level for logging, silent error warning debug info default loglevel is warning -m, --minionversion salt-minion version to install, default[latest] -n, --reconfig salt-minion restarts after re-reading updated configuration -q, --stop stop salt-minion -p, --start start salt-minion (effectively restart salt-minion) -r, --remove deactivate and remove the salt-minion -s, --status return status for this script -u, --upgrade upgrade when installing, used with --install -v, --version version of this script salt-minion vmtools integration script example: ./svtminion.sh --statusNote: on Linux, the script does not support use of hostname as in file:///path1/path2
On Windows systems, the install script is a powershell script. The onlyprerequisite for Windows is thevmtoolsd.exe binary, which is used to queryguestVars data. You can get help for this script by runningsvtminion.ps1 -horGet-Help svtminion.ps1:
NAME .\svtminion.ps1SYNOPSIS VMware Tools script for managing the Salt minion on a Windows guest.SYNTAX .\svtminion.ps1 [-Install] [-Upgrade] [-MinionVersion <String>] [-Source <String>] [[-ConfigOptions] <String[]>] [-LogLevel <String>] [-Stop] [-Start] [-Help] [-Version] [<CommonParameters>] .\svtminion.ps1 [-Reconfig] [[-ConfigOptions] <String[]>] [-LogLevel <String>] [-Stop] [-Start] [-Help] [-Version] [<CommonParameters>] .\svtminion.ps1 [-Remove] [-LogLevel <String>] [-Stop] [-Start] [-Help] [-Version] [<CommonParameters>] .\svtminion.ps1 [-Clear] [-LogLevel <String>] [-Stop] [-Start] [-Help] [-Version] [<CommonParameters>] .\svtminion.ps1 [-Status] [-LogLevel <String>] [-Stop] [-Start] [-Help] [-Version] [<CommonParameters>] .\svtminion.ps1 [-Depend] [-LogLevel <String>] [-Stop] [-Start] [-Help] [-Version] [<CommonParameters>]DESCRIPTION This script provides comprehensive management of the Salt minion on a Windows guest. The minion is a OneDir build available at: https://packages.broadcom.com/artifactory/saltproject-generic/onedir With this script, you can install, remove, check dependencies, retrieve installation status, and reset the Salt minion configuration. When run without parameters, the script checks for an action in `guestVars`. If no action is found, it exits with a `scriptFailed` (126) code. If an action is passed via the CLI or found in `guestVars`, the script gathers minion configuration options (e.g., `master=198.51.100.1`) from `guestVars`. Additional configuration options are obtained from `tools.conf`, which overrides any conflicting options from `guestVars`. CLI options take the highest precedence, followed by `tools.conf`, and finally `guestVars`. The script returns the following exit codes to indicate its status: - 0 - `scriptSuccess` - 126 - `scriptFailed` - 130 - `scriptTerminated` If the `-Status` option is passed, the exit code signals the Salt minion’s installation status as follows: - 100 - Installed (and running) - 101 - Installing - 102 - Not installed - 103 - Installation failed - 104 - Removing - 105 - Removal failed - 106 - External installation detected - 107 - Installed but stopped NOTE: This script must be executed with Administrator privileges.PARAMETERS -Install [<SwitchParameter>] The Install action downloads, installs, and starts the salt-minion service. It exits with the `scriptFailed` exit code (126) under any of the following conditions: - Existing Standard Salt Installation detected - Unknown status found - Installation in progress - Removal in progress - Installation failed - Missing script dependencies It exits with the `scriptSuccess` exit code (0) under the following conditions: - Installed successfully - Already installed -Upgrade [<SwitchParameter>] The Upgrade parameter upgrades an existing Salt installation in place, leaving the minion configuration unchanged. guestVars and CLI values are ignored during the upgrade. Use this option to switch between different Salt versions. Pass the Upgrade parameter with the Install action to upgrade to the specified version. If Upgrade is not passed and Salt is already installed, the script will exit with a `scriptSuccess` code (0) and a message indicating that the minion is already installed. -MinionVersion <String> The MinionVersion parameter specifies the version of the Salt minion to install. Use "latest" to install the most recent version available (default is "latest"). Alternatively, you can specify a major version number to install the latest release within that version series. For example, to install the latest release in the 3006 series, pass "3006". -Source <String> The Source parameter specifies the URL or path to a repository containing directories named after different Salt versions. Each directory should include a zip file corresponding to the version indicated by the directory name. The directory structure should follow a layout similar to the default repository: https://packages.broadcom.com/artifactory/saltproject-generic/onedir The Source parameter supports common protocols such as HTTP, HTTPS, FTP, UNC paths, and local file paths. -Reconfig [<SwitchParameter>] The Reconfig action updates the Salt minion configuration using settings provided via the command-line, `guestVars`, or `tools.conf`. After updating, the minion will be restarted to apply the new configuration. The following exit codes may occur: - 102 - Salt minion not installed - 106 - External installation of the Salt minion detected -ConfigOptions <String[]> This parameter accepts any number of minion configuration options, specified as key/value pairs in the format `key=value`, as documented in the Salt documentation. For example: master=localhost. All keys will be automatically converted to lowercase and written to the minion configuration. -Remove [<SwitchParameter>] The Remove action stops and uninstalls the salt-minion service. It exits with the `scriptFailed` exit code (126) under the following conditions: - Unknown status found - Installation in progress - Removal in progress - Installation failed - Missing script dependencies It exits with the `scriptSuccess` exit code (0) under the following conditions: - Successfully removed - Already removed -Clear [<SwitchParameter>] The Clear action resets the salt-minion by randomizing its minion ID and removing the minion keys. The new minion ID will be the old minion ID followed by an underscore and five random digits. Exits with the `scriptFailed` exit code (126) under the following conditions: - Unknown status found - Missing script dependencies Exits with the `scriptSuccess` exit code (0) under the following conditions: - Successfully cleared - Minion was not installed -Status [<SwitchParameter>] The Status action retrieves the current status of the Salt minion installation. The exit code will correspond to one of the following status codes: 100 - Installed (and running) 101 - Installing 102 - Not installed 103 - Installation failed 104 - Removing 105 - Removal failed 106 - External installation detected 107 - Installed but stopped Exits with the `scriptFailed` exit code (126) under the following conditions: - Unknown status found - Missing script dependencies -Depend [<SwitchParameter>] The Depend action checks that all required dependencies are available. It exits with the `scriptFailed` exit code (126) if any dependencies are missing. It exits with the `scriptSuccess` exit code (0) if all dependencies are present. -LogLevel <String> Sets the log level for display and logging. The default is "warning". The "silent" level suppresses all logging output. Available options are: - silent - error - warning - info - debug Logs are stored in `C:\Windows\temp` and named according to the action the script is performing, along with a timestamp. For example: `vmware-svtminion-<action>-<timestamp>.log` -Stop [<SwitchParameter>] Stops the salt-minion service. The following exit codes may occur: 102 - Salt minion not installed 106 - External installation of the Salt minion detected -Start [<SwitchParameter>] Starts or restarts the salt-minion service. The following exit codes may occur: 102 - Salt minion not installed 106 - External install of the Salt minion found -Help [<SwitchParameter>] Displays help information for this script. -Version [<SwitchParameter>] Displays the current version of this script. <CommonParameters> This cmdlet supports the common parameters: Verbose, Debug, ErrorAction, ErrorVariable, WarningAction, WarningVariable, OutBuffer, PipelineVariable, and OutVariable. For more information, see about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216). -------------------------- EXAMPLE 1 -------------------------- PS>svtminion.ps1 -Install -------------------------- EXAMPLE 2 -------------------------- PS>svtminion.ps1 -Install -MinionVersion 3006.2 master=192.168.10.10 id=dev_box -------------------------- EXAMPLE 3 -------------------------- PS>svtminion.ps1 -Install -Source https://my.domain.com/vmtools/salt -------------------------- EXAMPLE 4 -------------------------- PS>svtminion.ps1 -Install -MinionVersion 3006.8 -Upgrade -------------------------- EXAMPLE 5 -------------------------- PS>svtminion.ps1 -Clear -------------------------- EXAMPLE 6 -------------------------- PS>svtminion.ps1 -Status -------------------------- EXAMPLE 7 -------------------------- PS>svtminion.ps1 -Depend -------------------------- EXAMPLE 8 -------------------------- PS>svtminion.ps1 -Remove -LogLevel debugREMARKS To see the examples, type: "get-help .\svtminion.ps1 -examples". For more information, type: "get-help .\svtminion.ps1 -detailed". For technical information, type: "get-help .\svtminion.ps1 -full".About
Resources
License
Code of conduct
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors5
Uh oh!
There was an error while loading.Please reload this page.