Skip to content

Commit b5efb96

Browse files
davidsandilandsody
authored andcommitted
Adding submit csr for windows and resolved way to pass variables
Adding submit csr for windows and resolved way to pass variables
1 parent b7738bc commit b5efb96

File tree

4 files changed

+26
-7
lines changed

4 files changed

+26
-7
lines changed

Diff for: tasks/agent_install.json

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"default": []
1212
}
1313
},
14-
"input_method": "environment",
1514
"implementations": [
1615
{"name": "agent_install.sh", "requirements": ["shell"]},
1716
{"name": "agent_install.ps1", "requirements": ["powershell"]}

Diff for: tasks/agent_install.ps1

+12-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
# agent_install.ps1
2-
2+
Param(
3+
$install_flags,
4+
$server
5+
)
36
if (Test-Path "C:\Program Files\Puppet Labs\Puppet\puppet\bin\puppet"){
47
Write-Host "ERROR: Puppet agent is already installed. Re-install, re-configuration, or upgrade not supported. Please uninstall the agent before running this task."
58
Exit 1
69
}
7-
8-
$flags=$PT_install_flags -replace '^\["*','' -replace 's/"*\]$','' -replace '/", *"',' '
9-
[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; $webClient = New-Object System.Net.WebClient; $webClient.DownloadFile("https://${PT_server}:8140/packages/current/install.ps1", 'install.ps1'); .\install.ps1 $flags
10+
$flags=$install_flags -replace '^\["*','' -replace 's/"*\]$','' -replace '/", *"',' '
11+
try {
12+
[Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}; $webClient = New-Object System.Net.WebClient; $webClient.DownloadFile("https://${server}:8140/packages/current/install.ps1", 'install.ps1'); powershell.exe -c "install.ps1 $flags"
13+
}
14+
catch {
15+
Write-Host "Installer failed with Exception: $_.Exception.Message"
16+
Exit 1
17+
}

Diff for: tasks/submit_csr.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
"description": "DNS Alternative Names to request for the certificate"
77
}
88
},
9-
"input_method": "stdin",
109
"implementations": [
11-
{"name": "submit_csr.rb"}
10+
{"name": "submit_csr.rb", "requirements": ["shell"]},
11+
{"name": "submit_csr.ps1", "requirements": ["powershell"]}
1212
]
1313
}

Diff for: tasks/submit_csr.ps1

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Param(
2+
$dns_alt_names
3+
)
4+
if ( C:\"Program Files"\"Puppet Labs"\Puppet\bin\puppet ssl verify ) {
5+
Write-Host "ERROR: Puppet agent certificate is already signed"
6+
Exit 1
7+
}else{
8+
if ($dns_alt_names) {
9+
$submit_flags = "--dns_alt_names" + ($dns_alt_names -join ',')
10+
}
11+
C:\"Program Files"\"Puppet Labs"\Puppet\bin\puppet ssl submit_request $submit_flags
12+
}

0 commit comments

Comments
 (0)