salt-windows-msi icon indicating copy to clipboard operation
salt-windows-msi copied to clipboard

Flags for traditional install

Open gee456 opened this issue 3 years ago • 4 comments

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 

gee456 avatar Nov 08 '21 19:11 gee456

I was able to use the flags ROOTDIR and CONFDIR to keep the install in c:\salt but the ID and Master are not populating correctly. I found them by looking in the MSI debug log

working example script , master and minion id don't get set

$HOSTNAME=[Environment]::MachineName $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 " [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12 if ( -Not ( Test-Path -Path c:\windows\temp$msi -PathType Leaf) ) { curl https://repo.saltproject.io/windows/$msi -o c:\windows\temp$msi } if ( -Not ( Test-Path -Path c:\windows\temp$msi -PathType Leaf) ) { Write-Host "Failed, did not find MSI $msi" } else{ $MSIArguments = @( "/i" "c:\windows\temp$msi" "/qb" "/norestart" "/L*v" $logFile "ENABLEPATH=1" "INSTALLDIR=c:\salt" "ROOTDIR=c:\salt" "CONFDIR=c:\salt\conf" "MINION_ID=$HOSTNAME" "MASTER=salt1.mydomain.tech"

 )
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow 
$MyApp = Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -like "Zabbix*"}

}

gee456 avatar Nov 08 '21 20:11 gee456

@gee456, to install the Salt Minion into C:\salt you only need to specify two properties:

INSTALLDIR=c:\salt ROOTDIR=c:\salt

You can of course combine with more properties like MINION_ID and MASTER

I am sorry that you had to read the MSI install log to figure that out, I just opened a PR that adds the above to the documentation.

When I install a test Minion using

$MSIArguments = @(
"/i"
"Salt-Minion-test.msi"
"/qb"
"/norestart"
"/L*v"
"old_layout.log"
"INSTALLDIR=c:\salt"
"ROOTDIR=c:\salt"
"MINION_ID=kingbob12"
"MASTER=salt1.mydomain.tech"
)
Start-Process "msiexec.exe" -ArgumentList $MSIArguments -Wait -NoNewWindow

the result is as expected

type C:\salt\conf\minion
master: salt1.mydomain.tech
id: kingbob12

Could you please repeat your test and, if your C:\salt\conf\minion is unexpected, paste the location of the config, and the values for master and id?

@twangboy before we can automatically test INSTALLDIR and ROOTDIR, we need to branch for paths in test.ps1

marbx avatar Dec 03 '21 22:12 marbx

You may need to update the Service Definition as well to make sure it is pointing to the config in the correct location.

twangboy avatar Dec 08 '21 15:12 twangboy

You may need to update the Service Definition as well to make sure it is pointing to the config in the correct location.

@twangboy , the service definition is using INSTALLDIR and ROOTDIR ...

https://github.com/saltstack/salt-windows-msi/blob/838a35427ee71494cbdaecd92b6047e9360262d3/Product.wxs#L442

...or do I miss your point?

marbx avatar Dec 09 '21 15:12 marbx