Merge pull request #5892 from PatOShea/master
provisioner/salt: Updated version for windows and added passing in version via vagrantfile
This commit is contained in:
commit
cc2d393611
|
@ -1,5 +1,11 @@
|
||||||
# Salt version to install
|
Param(
|
||||||
$version = '2014.7.1'
|
[string]$version
|
||||||
|
)
|
||||||
|
|
||||||
|
# Salt version to install - default to latest if there is an issue
|
||||||
|
if ($version -notmatch "201[0-9]\.[0-9]\.[0-9](\-\d{1})?"){
|
||||||
|
$version = '2015.5.2'
|
||||||
|
}
|
||||||
|
|
||||||
# Create C:\tmp\ - if Vagrant doesn't upload keys and/or config it might not exist
|
# Create C:\tmp\ - if Vagrant doesn't upload keys and/or config it might not exist
|
||||||
New-Item C:\tmp\ -ItemType directory -force | out-null
|
New-Item C:\tmp\ -ItemType directory -force | out-null
|
||||||
|
@ -21,7 +27,7 @@ if ([IntPtr]::Size -eq 4) {
|
||||||
}
|
}
|
||||||
|
|
||||||
# Download minion setup file
|
# Download minion setup file
|
||||||
Write-Host "Downloading Salt minion installer ($arch)..."
|
Write-Host "Downloading Salt minion installer $version-$arch..."
|
||||||
$webclient = New-Object System.Net.WebClient
|
$webclient = New-Object System.Net.WebClient
|
||||||
$url = "https://docs.saltstack.com/downloads/Salt-Minion-$version-$arch-Setup.exe"
|
$url = "https://docs.saltstack.com/downloads/Salt-Minion-$version-$arch-Setup.exe"
|
||||||
$file = "C:\tmp\salt.exe"
|
$file = "C:\tmp\salt.exe"
|
||||||
|
@ -64,4 +70,4 @@ if ($service.Status -eq "Stopped") {
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
Write-Host "Salt minion successfully installed"
|
Write-Host "Salt minion successfully installed"
|
|
@ -35,6 +35,7 @@ module VagrantPlugins
|
||||||
attr_accessor :install_syndic
|
attr_accessor :install_syndic
|
||||||
attr_accessor :no_minion
|
attr_accessor :no_minion
|
||||||
attr_accessor :bootstrap_options
|
attr_accessor :bootstrap_options
|
||||||
|
attr_accessor :version
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@minion_config = UNSET_VALUE
|
@minion_config = UNSET_VALUE
|
||||||
|
@ -63,6 +64,7 @@ module VagrantPlugins
|
||||||
@config_dir = UNSET_VALUE
|
@config_dir = UNSET_VALUE
|
||||||
@masterless = UNSET_VALUE
|
@masterless = UNSET_VALUE
|
||||||
@minion_id = UNSET_VALUE
|
@minion_id = UNSET_VALUE
|
||||||
|
@version = UNSET_VALUE
|
||||||
end
|
end
|
||||||
|
|
||||||
def finalize!
|
def finalize!
|
||||||
|
@ -90,8 +92,9 @@ module VagrantPlugins
|
||||||
@no_minion = nil if @no_minion == UNSET_VALUE
|
@no_minion = nil if @no_minion == UNSET_VALUE
|
||||||
@bootstrap_options = nil if @bootstrap_options == UNSET_VALUE
|
@bootstrap_options = nil if @bootstrap_options == UNSET_VALUE
|
||||||
@config_dir = nil if @config_dir == UNSET_VALUE
|
@config_dir = nil if @config_dir == UNSET_VALUE
|
||||||
@masterless = false if @masterless == UNSET_VALUE
|
@masterless = false if @masterless == UNSET_VALUE
|
||||||
@minion_id = nil if @minion_id == UNSET_VALUE
|
@minion_id = nil if @minion_id == UNSET_VALUE
|
||||||
|
@version = nil if @version == UNSET_VALUE
|
||||||
end
|
end
|
||||||
|
|
||||||
def pillar(data)
|
def pillar(data)
|
||||||
|
|
|
@ -76,7 +76,7 @@ module VagrantPlugins
|
||||||
end
|
end
|
||||||
|
|
||||||
def need_configure
|
def need_configure
|
||||||
@config.minion_config or @config.minion_key or @config.master_config or @config.master_key or @config.grains_config
|
@config.minion_config or @config.minion_key or @config.master_config or @config.master_key or @config.grains_config or @config.version
|
||||||
end
|
end
|
||||||
|
|
||||||
def need_install
|
def need_install
|
||||||
|
@ -237,6 +237,9 @@ module VagrantPlugins
|
||||||
|
|
||||||
bootstrap_path = get_bootstrap
|
bootstrap_path = get_bootstrap
|
||||||
if @machine.config.vm.communicator == :winrm
|
if @machine.config.vm.communicator == :winrm
|
||||||
|
if @config.version
|
||||||
|
options = "-version %s" % @config.version
|
||||||
|
end
|
||||||
bootstrap_destination = File.join(config_dir, "bootstrap_salt.ps1")
|
bootstrap_destination = File.join(config_dir, "bootstrap_salt.ps1")
|
||||||
else
|
else
|
||||||
bootstrap_destination = File.join(config_dir, "bootstrap_salt.sh")
|
bootstrap_destination = File.join(config_dir, "bootstrap_salt.sh")
|
||||||
|
@ -248,7 +251,7 @@ module VagrantPlugins
|
||||||
@machine.communicate.upload(bootstrap_path.to_s, bootstrap_destination)
|
@machine.communicate.upload(bootstrap_path.to_s, bootstrap_destination)
|
||||||
@machine.communicate.sudo("chmod +x %s" % bootstrap_destination)
|
@machine.communicate.sudo("chmod +x %s" % bootstrap_destination)
|
||||||
if @machine.config.vm.communicator == :winrm
|
if @machine.config.vm.communicator == :winrm
|
||||||
bootstrap = @machine.communicate.sudo("powershell.exe -executionpolicy bypass -file %s" % [bootstrap_destination]) do |type, data|
|
bootstrap = @machine.communicate.sudo("powershell.exe -executionpolicy bypass -file %s %s" % [bootstrap_destination, options]) do |type, data|
|
||||||
if data[0] == "\n"
|
if data[0] == "\n"
|
||||||
# Remove any leading newline but not whitespace. If we wanted to
|
# Remove any leading newline but not whitespace. If we wanted to
|
||||||
# remove newlines and whitespace we would have used data.lstrip
|
# remove newlines and whitespace we would have used data.lstrip
|
||||||
|
|
Loading…
Reference in New Issue