Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flags for traditional install #125

Open
gee456 opened this issue Nov 8, 2021 · 4 comments
Open

Flags for traditional install #125

gee456 opened this issue Nov 8, 2021 · 4 comments

Comments

@gee456
Copy link

gee456 commented Nov 8, 2021

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
Copy link
Author

gee456 commented Nov 8, 2021

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*"}

}

@marbx
Copy link
Contributor

marbx commented Dec 3, 2021

@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

@twangboy
Copy link
Contributor

twangboy commented Dec 8, 2021

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

@marbx
Copy link
Contributor

marbx commented Dec 9, 2021

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 ...

<RegistryValue Type="expandable" Name="AppParameters" Value='-E -s "[INSTALLDIR]bin\Scripts\salt-minion" -c "[ROOTDIR]conf" -l quiet' />

...or do I miss your point?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants