e012c2b5bf
Includes: * baseline Windows AMI * initial pass at Terraform configurations * OpenSSH for Windows Using OpenSSH is a lot nicer for Nomad developers than winrm would be, plus it lets us avoid passing around the Windows password in the clear. Note that now we're copying up all the provisioning scripts and configs as a zipped bundle because TF's file provisioner dies in the middle of pushing up multiple files (whereas `scp -r` works fine). We're also running all the provisioning scripts inside the userdata by polling for the zip file to show up (gross!). This is because `remote-exec` provisioners are failing on Windows with the same symptoms as: https://github.com/hashicorp/terraform/issues/17728 If we can't fix this, it'll prevent us from having multiple Windows clients running until TF supports count interpolation in the `template_file`, which is planned for a later 0.12 release.
35 lines
899 B
PowerShell
Executable file
35 lines
899 B
PowerShell
Executable file
Set-StrictMode -Version latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
# Force TLS1.2
|
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
|
|
Set-Location C:\opt
|
|
|
|
Try {
|
|
# we install the most recent stable/GA release; this will be replaced
|
|
# with the current master when we run e2e tests
|
|
$releases = "https://releases.hashicorp.com"
|
|
$version = "0.9.6"
|
|
$url = "${releases}/nomad/${version}/nomad_${version}_windows_amd64.zip"
|
|
|
|
$configDir = "C:\opt\nomad.d"
|
|
md $configDir
|
|
md C:\opt\nomad
|
|
|
|
# TODO: check sha!
|
|
Write-Output "Downloading Nomad from: $url"
|
|
Invoke-WebRequest -Uri $url -Outfile nomad.zip
|
|
Expand-Archive .\nomad.zip .\
|
|
mv nomad.exe C:\opt\nomad.exe
|
|
C:\opt\nomad.exe version
|
|
rm nomad.zip
|
|
|
|
} Catch {
|
|
Write-Error "Failed to install Nomad."
|
|
$host.SetShouldExit(-1)
|
|
throw
|
|
}
|
|
|
|
Write-Output "Installed Nomad."
|