Created
May 6, 2020 14:19
-
-
Save iversond/7d1a6d256ef12e2c533d5b20c54e4de8 to your computer and use it in GitHub Desktop.
.conf 2020 user provisioning script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Escape any variables that are not passed by Terraform ($$) | |
$hostname = "${hostname}" | |
# Set NODENAME Env Var | |
[Environment]::SetEnvironmentVariable("NODENAME", $hostname) | |
[Environment]::SetEnvironmentVariable("NODENAME", $hostname, [System.EnvironmentVariableTarget]::Machine) | |
# Add hosts Entry | |
# This is needed so the pt_pia status checking works | |
# The cloned instance does not update hosts, so we do it ourselves | |
$fqdn="$(facter fqdn)" | |
$ipaddr="$(facter ipaddress)" | |
add-content -path c:\windows\system32\drivers\etc\hosts -value "`n127.0.0.1 $${fqdn}" | |
add-content -path c:\windows\system32\drivers\etc\hosts -value "$${ipaddr} $${fqdn}" | |
add-content -path c:\windows\system32\drivers\etc\hosts -value "$${ipaddr} ps-terraform ps-terraform.psftcm.oraclevcn.com" | |
# Add java to PATH | |
# This also fixes the pt_pia status checking script | |
$path="$${env:PATH}" | |
$jdk_home="$(hiera jdk_location -c C:\psft\dpk\puppet\hiera.yaml)" | |
[Environment]::SetEnvironmentVariable("PATH", "$${env:PATH};$${jdk_home}\bin") | |
[Environment]::SetEnvironmentVariable("PATH", "$${env:PATH};$${jdk_home}\bin", [System.EnvironmentVariableTarget]::Machine) | |
# JMeter | |
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls13, [Net.SecurityProtocolType]::Tls12 | |
iwr https://mirrors.ocf.berkeley.edu/apache//jmeter/binaries/apache-jmeter-5.2.1.zip -outfile $env:TEMP\jmeter.zip | |
expand-archive $env:TEMP\jmeter.zip -destination c:\app\ | |
$jmeter="C:\app\apache-jmeter-5.2.1" | |
[Environment]::SetEnvironmentVariable("PATH", "$${env:PATH};$${jmeter}\bin", [System.EnvironmentVariableTarget]::Machine) | |
remove-item $env:TEMP\jmeter.zip | |
# Elasticsearch | |
$file="C:\psft\elk\pt\Elasticsearch7.0.0\config\elasticsearch.yml" | |
$find="network.host: localhost" | |
$replace="network.host: 0.0.0.0" | |
(Get-Content $file).replace($find, $replace) | Set-Content $file | |
restart-service elasticsearch-service-x64 | |
# Start PIA | |
start-service psftpia* |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment