File tree 1 file changed +30
-0
lines changed
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ # ps1_sysnative
2
+
3
+ $ErrorActionPreference = " Stop"
4
+
5
+ $puppet_master_server_ip = " 192.168.209.135"
6
+ $puppet_master_server_name = " puppet"
7
+
8
+ # For Puppet Enterprise replace the following url with:
9
+ # "https://pm.puppetlabs.com/cgi-bin/download.cgi?ver=latest&dist=win"
10
+ $puppet_agent_msi_url = " https://downloads.puppetlabs.com/windows/puppet-3.4.3.msi"
11
+
12
+ if ($puppet_master_server_ip ) {
13
+ # Validate IP address
14
+ $ip = [System.Net.IPAddress ]::Parse($puppet_master_server_ip )
15
+ # Add to hosts file
16
+ Add-Content - Path $ENV: SystemRoot \System32\Drivers\etc\hosts - Value " $puppet_master_server_ip $puppet_master_server_name "
17
+ }
18
+
19
+ $puppet_agent_msi_path = Join-Path $ENV: TEMP puppet_agent.msi
20
+
21
+ # You can also use Invoke-WebRequest but this is way faster :)
22
+ Import-Module BitsTransfer
23
+ Start-BitsTransfer - Source $puppet_agent_msi_url - Destination $puppet_agent_msi_path
24
+
25
+ cmd / c start / wait msiexec / qn / i $puppet_agent_msi_path / l* v puppet_agent_msi_log.txt PUPPET_MASTER_SERVER= $puppet_master_server_name
26
+ if ($lastexitcode ) {
27
+ throw " Puppet agent setup failed"
28
+ }
29
+
30
+ del $puppet_agent_msi_path
You can’t perform that action at this time.
0 commit comments