Coder Social home page Coder Social logo

salt-windows-msi's Introduction

Salt Minion msi installer

The installer offers properties for unattended/silent installations.

Example: install silently, set the master, don't start the service:

msiexec /i *.msi MASTER=salt2 START_MINION=""

Example: uninstall and remove configuration

MsiExec.exe /X *.msi REMOVE_CONFIG=1

Notes

  • The installer requires a privileged user
  • Properties must be upper case
  • Values of properties are case sensitve
  • Values must be quoted when they contain whitespace, or to unset a property, as in START_MINION=""
  • Creates a verbose log file, by default %TEMP%\MSIxxxxx.LOG, where xxxxx is random. The name of the log can be specified with msiexec /log example.log
  • extends the system PATH environment variable

Properties

Property Default value Comment
MASTER salt The master (name or IP). Separate multiple masters by comma.
MASTER_KEY The master public key. See below.
MINION_ID Hostname The minion id.
MINION_CONFIG Content to be written to the minion config file. See below.
START_MINION 1 Set to "" to prevent the start of the salt-minion service.
MOVE_CONF Set to 1 to move configuration from C:\salt to %ProgramData%.
REMOVE_CONFIG Set to 1 to remove configuration on uninstall. Implied by MINION_CONFIG.
CLEAN_INSTALL Set to 1 to remove configuration and cache before install or upgrade.
CONFIG_TYPE Existing Set to Custom or Default for scenarios below.
CUSTOM_CONFIG Name of a custom config file in the same path as the installer or full path. Requires CONFIG_TYPE=Custom. ONLY FROM COMMANDLINE
INSTALLDIR Windows default Where to install binaries.
ROOTDIR C:\ProgramData\Salt Project\Salt Where to install configuration.
ARPSYSTEMCOMPONENT Set to 1 to hide "Salt Minion" in "Programs and Features".

Master and id are read from file conf\minion

You can set a master with MASTER.

You can set a master public key with MASTER_KEY, after you converted it into one line like so:

  • Remove the first and the last line (-----BEGIN PUBLIC KEY----- and -----END PUBLIC KEY-----).
  • Remove linebreaks.

Property MINION_CONFIG

If MINION_CONFIG is set:

  • Its content is written to configuraton file conf\minion, with ^ replaced by line breaks
  • All prior configuration is deleted:
    • all minion.d\*.conf files
    • the minion_id file
  • Implies REMOVE_CONFIG=1: uninstall will remove all configuration.

Example MINION_CONFIG="master: Anna^id: Bob" results in:

master: Anna
id: Bob

Property CONFIG_TYPE

There are 3 scenarios the installer tries to account for:

  1. existing-config
  2. custom-config
  3. default-config

Existing

This setting makes no changes to the existing config and just upgrades/downgrades salt. Makes for easy upgrades. Just run the installer with a silent option. If there is no existing config, then the default is used and master and minion id are applied if passed.

Custom

This setting will lay down a custom config passed via the command line. Since we want to make sure the custom config is applied correctly, we'll need to back up any existing config.

  1. minion config renamed to minion-<timestamp>.bak
  2. minion_id file renamed to minion_id-<timestamp>.bak
  3. minion.d directory renamed to minion.d-<timestamp>.bak Then the custom config is laid down by the installer... and master and minion id should be applied to the custom config if passed.

Default

This setting will reset config to be the default config contained in the pkg. Therefore, all existing config files should be backed up

  1. minion config renamed to minion-<timestamp>.bak
  2. minion_id file renamed to minion_id-<timestamp>.bak
  3. minion.d directory renamed to minion.d-<timestamp>.bak Then the default config file is laid down by the installer... settings for master and minion id should be applied to the default config if passed

Previous installation in C:\salt and how to install into C:\salt

A previous installation or configuration in C:\salt causes an upgrade into C:\salt, unless you set MOVE_CONF=1. Set the two properties INSTALLDIR=c:\salt ROOTDIR=c:\salt to install binaries and configuration into C:\salt.

Client requirements

  • Windows 7 (for workstations), Server 2012 (for domain controllers), or higher.

salt-windows-msi's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

salt-windows-msi's Issues

Cannot create msi package, Product/@Version attribute's value, '.0', is not a valid version

When trying to build the msi package using the instructions here I get an error about wrong version. Do I have to set it somewhere explicitly?

Compile:
  C:\Program Files (x86)\WiX Toolset v3.9\bin\candle.exe -dbuildenv=C:\dev\gith
  ub\salt-windows-msi\common\buildenv -ddist=C:\dev\github\salt-windows-msi\dis
  t.amd64 -dTargetPlatform=amd64 -dDisplayVersion=2015.2.0 -dInternalVersion=.0
   -d"DevEnvDir=*Undefined if not building from within Visual Studio*" -dSoluti
  onDir=C:\dev\github\salt-windows-msi\ -dSolutionExt=.sln -dSolutionFileName=w
  ix.sln -dSolutionName=wix -dSolutionPath=C:\dev\github\salt-windows-msi\wix.s
  ln -dConfiguration=Release -dOutDir=bin\Release\ -dPlatform=x64 -dProjectDir=
  C:\dev\github\salt-windows-msi\wix\MinionMSI\ -dProjectExt=.wixproj -dProject
  FileName=MinionMSI.wixproj -dProjectName=MinionMSI -dProjectPath=C:\dev\githu
  b\salt-windows-msi\wix\MinionMSI\MinionMSI.wixproj -dTargetDir=C:\dev\github\
  salt-windows-msi\wix\MinionMSI\bin\Release\ -dTargetExt=.msi -dTargetFileName
  =Salt-Minion-Setup.msi -dTargetName=Salt-Minion-Setup -dTargetPath=C:\dev\git
  hub\salt-windows-msi\wix\MinionMSI\bin\Release\Salt-Minion-Setup.msi -dMinion
  ConfigurationExtension.Configuration=Release -d"MinionConfigurationExtension.
  FullConfiguration=Release|x86" -dMinionConfigurationExtension.Platform=x86 -d
  MinionConfigurationExtension.ProjectDir=C:\dev\github\salt-windows-msi\wix\Mi
  nionConfigurationExtension\ -dMinionConfigurationExtension.ProjectExt=.csproj
   -dMinionConfigurationExtension.ProjectFileName=MinionConfigurationExtension.
  csproj -dMinionConfigurationExtension.ProjectName=MinionConfigurationExtensio
  n -dMinionConfigurationExtension.ProjectPath=C:\dev\github\salt-windows-msi\w
  ix\MinionConfigurationExtension\MinionConfigurationExtension.csproj -dMinionC
  onfigurationExtension.TargetDir=C:\dev\github\salt-windows-msi\wix\MinionConf
  igurationExtension\bin\Release\ -dMinionConfigurationExtension.TargetExt=.dll
   -dMinionConfigurationExtension.TargetFileName=MinionConfigurationExtension.d
  ll -dMinionConfigurationExtension.TargetName=MinionConfigurationExtension -dM
  inionConfigurationExtension.TargetPath=C:\dev\github\salt-windows-msi\wix\Min
  ionConfigurationExtension\bin\Release\MinionConfigurationExtension.dll -out o
  bj\Release\ -arch x64 -ext "C:\Program Files (x86)\WiX Toolset v3.9\bin\\WixU
  tilExtension.dll" -ext "C:\Program Files (x86)\WiX Toolset v3.9\bin\\WixUIExt
  ension.dll" buildenv.wxs service.wxs SettingsCustomizationDlg.wxs MinionConfi
  gurationExtensionCA.wxs Product.wxs WixUI_Minion.wxs dist-amd64.wxs
  Windows Installer XML Toolset Compiler version 3.9.1006.0
  Copyright (c) Outercurve Foundation. All rights reserved.

  buildenv.wxs
  service.wxs
  SettingsCustomizationDlg.wxs
  MinionConfigurationExtensionCA.wxs
  Product.wxs
C:\dev\github\salt-windows-msi\wix\MinionMSI\Product.wxs(3): error CNDL0108: Th
e Product/@Version attribute's value, '.0', is not a valid version.  Legal vers
ion values should look like 'x.x.x.x' where x is an integer from 0 to 65534. [C
:\dev\github\salt-windows-msi\wix\MinionMSI\MinionMSI.wixproj]
C:\dev\github\salt-windows-msi\wix\MinionMSI\Product.wxs(3): error CNDL0010: Th
e Product/@Version attribute was not found; it is required. [C:\dev\github\salt
-windows-msi\wix\MinionMSI\MinionMSI.wixproj]
  WixUI_Minion.wxs
  dist-amd64.wxs
Done Building Project "C:\dev\github\salt-windows-msi\wix\MinionMSI\MinionMSI.w
ixproj" (default targets) -- FAILED.

MSI does not create all required directories in the root_dir

The MSI is not creating all the required directories in the root dir (C:\ProgramData\Salt Project\Salt).

Specifically, it's missing the var/log/salt directory, causing the salt-minion to display the following in its logs.

[WARNING ] Failed to open log file, do you have permission to write to C:\ProgramData\Salt Project\Salt\var\log\salt\minion?

[BUG] Custom Config doesn't seem to be honored

When installing a Salt 3004 minion on Windows Server 2016, I am trying to use the following command:

C:\> msiexec /i Salt-Minion-3004-Py3-AMD64.msi CUSTOM_CONFIG=C:\temp\minion_setup.conf /log minion_install.log /quiet

minion_install.log

For my testing I was:

  • Running the above command to attempt the installation
  • Monitor CPU for heavy activity ( single CPU allocated to VM, so should spike high)
  • Verify that the minion was not installed
  • Re-run installer

The MSI would install, but the minion would have no configuration applied to it. So then I would have to go back and manually update the minion configuration to get it to connect to my master.

Update NSSM to support Win10 Creators update

The NSSM 2.24 version is not working with the last "windows 10 creators" update version.
A prebuild version is available, and I have been testing by manually replacing the binary in the salt directory, the result is a success.

The prebuild is available here : http://nssm.cc/ci/nssm-2.24-101-g897c7ad.zip

From the NSSM website : "Windows 10 Creators Update

2017-04-26: Users of Windows 10 Creators Update should use prelease build 2.2.4-101 to avoid an issue with services failing to start. If for some reason you cannot use that build you can also set AppNoConsole=1 in the registry, noting that applications which expect a console window may behave unexpectedly.

Thanks to Sebasian Krause for the initial diagnosis."

Source : http://nssm.cc/download

Dropping MFC dlls

Just a heads-up:

You should be able to drop the MFC dlls if you change:

  1. win32gui.SendMessageTimeout -> win32api.SendMessageTimeout
  2. pypiwin32 dependency to win32core and win32compat dependency

I have no idea if this will actually work but it does have a reasonable chance if someone wants to try it. I am a maintainer for pypiwin32 so I could change this myself, but I'm not going to push this out for fear of breaking functionality before I get a lot of verification that this works.

Build of 2015.2 is not working, No module named BaseHTTPServer

I don't know if these issues are watched since this is a bit outside the normal salt world but I'll try.
First of, hats of to the work with these installers! It's really appreciated!

I've tried to setup our ci server to build salt minions using these and I've succedded in building a 2015.2-rc1 nsis installer. You can download the file Salt-Minion-2015.2.0rc1-111-g0e8a47f-amd64-Setup.exe.

Unfortunately I must be missing something since I cannot start this minion, I just get the following error:

2015-03-06 09:38:41,802 [salt.scripts     ][INFO    ][3016] Sleeping random_reauth_delay of 28 seconds
2015-03-06 09:39:10,262 [salt.cli.daemons ][INFO    ][2792] Setting up the Salt Minion "dev-eu-stbu-00"
2015-03-06 09:39:10,434 [salt.cli.daemons ][INFO    ][2792] The salt minion is shut down
2015-03-06 09:39:10,434 [salt.scripts     ][ERROR   ][2792] No module named BaseHTTPServer
2015-03-06 09:39:10,434 [salt.scripts     ][WARNING ][2792] ** Restarting minion **

From what I can see the BaseHTTPServer hase moved between python 2 and 3. But I think it's something else I've done wrong when producing my package.

The full build log is here.

I get no errors but I' insure of how to pursue this, it seems like wrong packages are being added.

Include *.msu packages in the assembly

Hi, I have a question about installing packages *.msu that come in a package *.exe for SaltStack. These updates (KB) are required for the application to work correctly. They are not included in the *.msi package.
I found that the WiX supports the ability to inlcude *.msu in the assembly https://wixtoolset.org/documentation/manual/v3/xsd/wix/msupackage.html.
But I can not do this, because I do not have enough knowledge for this.
Does anyone have an idea how to do this?

[BUG] Upgrade does not retain previous grains and modules

Should be

grains and modules persist an upgrade.

As of now

grains and modules do not persist an upgrade.

Technical details

  • Grains and modules are "lifetime data", meaning not created by the msi, but during the operation of the minion.
  • An msi generally does not delete "lifetime data"
  • grains and modules are stored under the path c:\salt\var\cache\salt\minion\extmods
    • and also cached under c:\salt\var\cache\salt\minion\files\base\...

Add the ability to set multi-master

The Nullsoft installer has the ability to specify a multimaster config by passing a comma-delimited list of masters either on the CLI or in the GUI.

/master=master1.com,master2.com

We need to support this with the MSI installer.

Minion-specific msi-properties do not have any effect

When Installing the MSI file with an elevated powershell prompt and executing the following command:

PS C:\git\salt-windows-msi\wix.d\MinionMSI\bin\Release> msiexec /qb /i Salt-Minion-2017.7.0-24-ga71938c-64bit.msi START_MINION_SERVICE="1" MINION_HOSTNAME="minion123"

It does not have any effect on the config file or the settings, the hostname stays the same and the service is not started.

The same with: msiexec /x Salt-Minion-2016.11.6-64bit.msi KEEP_CONFIG="0" It does not remove the config files.

How am I supposed to get the minion-specific msi-properties working? Am I doing something wrong or is the entire function broken?

python27.dll missing

When building the MSI with the following commands:

cd c:\git\salt
git clone -b 2017.7 https://github.com/saltstack/salt.git
cd c:\git\salt\pkg\windows
build.bat
cd c:\git\salt-windows-msi
yclean.cmd
ybuild.cmd

The service fails to start after installing the msi file. This is becuase python27.dll in C:\salt\bin is missing.

How can I make sure the python27.dll is installed when installing the msi file?

CONFIG_TYPE=Existing Not Working As Expected

From the documentation:

This setting makes no changes to the existing config and just upgrades/downgrades salt. Makes for easy upgrades. Just run the installer with a silent option. If there is no existing config, then the default is used and master and minion id are applied if passed.

Except it does make changes to the existing config.

Running msiexec with the next update (3003.3 in this case) with options: /qn CONFIG_TYPE=Existing

Even if the Minion ID is defined in the minion_id file in the existing config, the installer will automatically dump the hostname as the Minion ID into the minion file which which will (1) override the minion_id file and (2) cause issues if the Minion ID is not the hostname (which is my case because Windows).

Salt Version:
          Salt: 3003.2
 
Dependency Versions:
          cffi: 1.14.5
      cherrypy: 18.6.0
      dateutil: 2.8.1
     docker-py: Not Installed
         gitdb: 4.0.5
     gitpython: 3.1.13
        Jinja2: 2.11.3
       libgit2: Not Installed
      M2Crypto: Not Installed
          Mako: 1.1.4
       msgpack: 1.0.2
  msgpack-pure: Not Installed
  mysql-python: Not Installed
     pycparser: 2.20
      pycrypto: Not Installed
  pycryptodome: 3.9.8
        pygit2: Not Installed
        Python: 3.7.4 (tags/v3.7.4:e09359112e, Jul  8 2019, 20:34:20) [MSC v.1916 64 bit (AMD64)]
  python-gnupg: 0.4.6
        PyYAML: 5.4.1
         PyZMQ: 18.0.1
         smmap: 3.0.4
       timelib: 0.2.4
       Tornado: 4.5.3
           ZMQ: 4.3.1
 
System Versions:
          dist:   
        locale: cp1252
       machine: AMD64
       release: 7
        system: Windows
       version: 7 6.1.7601 SP1

Optionally flag the installation as a SystemComponent

It would be good if the Minion installers had a switch or MSI property to set the SystemComponent flag in their uninstall Registry key. This stops the installation being listed in Programs and Features.

Unfortunately I've had some installations removed because someone has seen it listed, decided that "Salt Minion" must be malware (because they didn't know what it was), and promptly uninstalled it. :-(

Prebuilt MSI Files

Are there anywhere msi files prebuilt available?

In specifically I'm looking for 2017.7.8

Flags for traditional install

I am using the following flags and the configuration is being placed in

C:\ProgramData\Salt Project\Salt

I want the flags to install just like the previous client all in c:\salt

$DataStamp = get-date -Format yyyyMMddTHHmmss
$logFile = 'c:\windows\temp\salt-minion-3004-install-{0}-{1}.log' -f $file.fullname,$DataStamp
$msi="Salt-Minion-3004-Py3-AMD64.msi "

$MSIArguments = @(
	"/i"
	"c:\windows\temp\$msi"
	"/qb"
	"/norestart"
	"/L*v"
	$logFile
	"ENABLEPATH=1"
	"INSTALLDIR=c:\salt"
	"MINION_ID=$HOSTNAME"
	"MASTER=salt1.mydomain.tech"
	
 )
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.