.conf 2020 user provisioning script
This file contains 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