2019-11-19 16:06:10 +00:00
|
|
|
Set-StrictMode -Version latest
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
|
|
|
|
# Force TLS1.2
|
|
|
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
|
|
|
|
|
|
Set-Location C:\opt
|
|
|
|
|
|
|
|
Try {
|
|
|
|
$releases = "https://releases.hashicorp.com"
|
|
|
|
$version = "1.2.3"
|
|
|
|
$url = "${releases}/vault/${version}/vault_${version}_windows_amd64.zip"
|
|
|
|
|
2020-09-04 12:51:22 +00:00
|
|
|
New-Item -ItemType Directory -Force -Path C:\opt\vault
|
|
|
|
New-Item -ItemType Directory -Force -Path C:\opt\vault.d
|
2019-11-19 16:06:10 +00:00
|
|
|
|
|
|
|
# TODO: check sha!
|
|
|
|
Write-Output "Downloading Vault from: $url"
|
|
|
|
Invoke-WebRequest -Uri $url -Outfile vault.zip
|
|
|
|
Expand-Archive .\vault.zip .\
|
|
|
|
mv vault.exe C:\opt\vault.exe
|
|
|
|
C:\opt\vault.exe version
|
|
|
|
rm vault.zip
|
|
|
|
|
|
|
|
} Catch {
|
|
|
|
Write-Error "Failed to install Vault."
|
|
|
|
$host.SetShouldExit(-1)
|
|
|
|
throw
|
|
|
|
}
|
|
|
|
|
|
|
|
Write-Output "Installed Vault."
|