github.com/iqoqo/nomad@v0.11.3-0.20200911112621-d7021c74d101/e2e/terraform/shared/config/provision-windows-client.ps1 (about) 1 param( 2 [string]$Cloud = "aws", 3 [string]$Index=0 4 ) 5 6 # Force TLS1.2 7 [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 8 9 # Consul 10 Copy-Item -Force ` 11 -Path "C:\ops\shared\consul\base.json" ` 12 -Destination "C:\opt\consul.d\base.json" 13 Copy-Item -Force ` 14 -Path "C:\ops\shared\consul\retry_$Cloud.json" ` 15 -Destination "C:\opt\consul.d\retry_$Cloud.json" 16 New-Service ` 17 -Name "Consul" ` 18 -BinaryPathName "C:\opt\consul.exe agent -config-dir C:\opt\consul.d -log-file C:\opt\consul\consul.log" ` 19 -StartupType "Automatic" ` 20 -ErrorAction Ignore 21 Start-Service "Consul" 22 23 # Vault 24 # TODO(tgross): we don't need Vault for clients 25 # cp "C:\ops\shared\vault\vault.hcl" C:\opt\vault.d\vault.hcl 26 # sc.exe create "Vault" binPath= "C:\opt\vault.exe" agent -config-dir "C:\opt\vault.d" start= auto 27 28 # install config file 29 New-Item -ItemType "directory" -Path "C:\opt\nomad" -Force 30 Copy-Item "C:\ops\shared\nomad\client-windows.hcl" ` 31 -Destination "C:\opt\nomad.d\nomad.hcl" -Force 32 33 # Setup Host Volumes 34 New-Item -ItemType "directory" -Path "C:\tmp\data" -Force 35 36 # TODO(tgross): not sure we even support this for Windows? 37 # Write-Output "Install CNI" 38 # md C:\opt\cni\bin 39 # $cni_url = "https://github.com/containernetworking/plugins/releases/download/v0.8.6/cni-plugins-windows-amd64-v0.8.6.tgz" 40 # Invoke-WebRequest -Uri "$cni_url" -Outfile cni.tgz 41 # Expand-7Zip -ArchiveFileName .\cni.tgz -TargetPath C:\opt\cni\bin\ -Force 42 43 # needed for metrics scraping HTTP API calls to the client 44 New-NetFirewallRule -DisplayName 'Nomad HTTP Inbound' -Profile @('Public', 'Domain', 'Private') -Direction Inbound -Action Allow -Protocol TCP -LocalPort @('4646') 45 46 # idempotently enable as a service 47 New-Service ` 48 -Name "Nomad" ` 49 -BinaryPathName "C:\opt\nomad.exe agent -config C:\opt\nomad.d" ` 50 -StartupType "Automatic" ` 51 -ErrorAction Ignore 52 53 Start-Service "Nomad" 54 55 Write-Output "Nomad started!"