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 variables
    Host 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, select
        Advanced
        Edit Configuration
        Add/Delete parameter
        and set
        • guestinfo./vmware.components.salt_minion.desiredstate
          to present
        • guestinfo./vmware.components.salt_minion.args
          to
          <custom arguments to VMware Tools salt-minion setup script>
        For example:
        guestinfo./vmware.components.salt_minion.desiredstate
        → present
        guestinfo./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.desiredstate
          to present
        • guestinfo./vmware.components.salt_minion.args
          to
          <custom arguments to VMware Tools salt-minion setup script>
        For example:
        guestinfo./vmware.components.salt_minion.desiredstate
        → present
        guestinfo./vmware.components.salt_minion.args
        → master=1.2.3.4 id=12345
    • Removing salt-minion
      In Windows or Linux, if the host admin sets the guest variable
      guestinfo./vmware.components.salt_minion.desiredstate
      to 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 guest
      To 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.conf
    The
    tools.conf
    file contains the configurations for VMware Tools in an
    .ini
    format. This tool looks for the
    salt_minion
    section and uses the configurations defined under that section. This file is stored at:
    Windows -
    C:\ProgramData\VMware\VMware Tools\tools.conf
    Linux -
    /etc/vmware-tools/tools.conf
    Here is an example of the
    salt_minion
    section as defined in
    tools.conf
    :
    [salt_minion] master=1.2.3.4 conf_file=/etc/salt/minion id=dev_minion
    Only minion config options are available in
    tools.conf
    . The desired script action cannot be obtained from
    tools.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 the
      tools.conf
      settings.
      [componentmgr]
      poll-interval=180
      (Default value: 180s)
    • Enabling and disabling component (salt_minion):
      • Guest admin can enable salt_minion by configuring the
        tools.conf
        settings.
        [componentmgr]
        included=salt_minion
      • Guest admin can enable all the components by configuring the
        tools.conf
        settings.
        [componentmgr]
        included=all
        (Default configuration)
      • Guest admin can disable all components by configuring the
        tools.conf
        settings.
        [componentmgr]
        included=none
  • Installing salt-minion using an install script
      • Linux environment
        On Linux systems, the install script
        svtminion.sh
        is a bash script with the following pre-requisites:
        • - systemctl
        • - curl
        • - sha512sum
        • - vmtoolsd
        • - grep
        • - awk
        • - sed
        • - cut
        • - wget
        svtminion.sh --help
        shows 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]
        where
        ./svtminion.sh [-j|--source]
        , specifies the location to install Salt Minion from. The 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 is specified, [-m|--minionversion], then its appended to source. The default is latest.
        Here is an example of the installing
        salt_minion
        as defined in
        tools.conf
        :
        [salt_minion] master=1.2.3.4 conf_file=/etc/salt/minion id=dev_minion source=https://my_web_server.com/my_salt_onedir
        If installing from your private replica of the standard repository location for salt, use
      • Windows environment
        On Windows systems, the install script
        svtminion.ps1
        is 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 command
        svtminion.ps1 -h
        or
        Get-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, local
        For 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/salt
        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
  • Fetching log information
    Guest admin can fetch log information related to salt-minion from the following path:
    Windows
    Log File
    Location
    Log file for checking salt-minion status
    C:\Windows\Temp\vmware-svtminion-status-{Timestamp}.log
    Log file for installing a salt-minion instance inside the guest
    C:\Windows\Temp\vmware-svtminion-install-{TimeStamp}.log
    Log file for removing a salt-minion instance inside the guest:
    C:\Windows\Temp\vmware-svtminion-remove-{TimeStamp}.log
    Log file for checking runtime information after installing or removing a salt-minion instance inside the guest
    C:\salt\var\log\minion log files
    Linux
    Log File
    Location
    Log file for checking salt-minion status
    /var/log/vmware-svtminion.sh-status-{Timestamp}.log
    Log file for installing a salt-minion instance inside the guest
    /var/log/vmware-svtminion.sh-install-{TimeStamp}.log
    Log file for removing a salt-minion instance inside the guest:
    /var/log/vmware-svtminion.sh-remove-{TimeStamp}.log
    Log file for checking runtime information after installing or removing a salt-minion instance inside the guest
    /var/log/salt/minion