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.
38 lines
1.2 KiB
PowerShell
Executable file
38 lines
1.2 KiB
PowerShell
Executable file
Set-StrictMode -Version latest
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
$RunningAsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
|
|
if (!$RunningAsAdmin) {
|
|
Write-Error "Must be executed in Administrator level shell."
|
|
exit 1
|
|
}
|
|
|
|
# Force TLS1.2
|
|
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
|
|
|
# TODO (tgross: some stuff installed on Linux but not here yet
|
|
# - Possible issues: no redis-tools for windows
|
|
# - Possible non-issues: probably don't need tree, curl,tmux
|
|
|
|
Try {
|
|
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
|
|
|
|
Write-Output "Installing 7Zip"
|
|
Install-Package -Force 7Zip4PowerShell
|
|
|
|
Write-Output "Installing JQ"
|
|
Invoke-WebRequest `
|
|
-Uri https://github.com/stedolan/jq/releases/download/jq-1.6/jq-win64.exe `
|
|
-Outfile jq-win64.exe
|
|
|
|
} Catch {
|
|
Write-Error "Failed to install dependencies."
|
|
$host.SetShouldExit(-1)
|
|
throw
|
|
} Finally {
|
|
# clean up by re-securing this package repo
|
|
Set-PSRepository -InstallationPolicy Untrusted -Name PSGallery
|
|
}
|
|
|
|
Write-Output "Installed dependencies"
|