Ok folks, since I got help last time, thought I'd try again. This time I'm
trying to deactivate nodes instead of signing their certs.
Here is the code, the first two invoke-restmethods work as expected. But
when I try to call the command to Deactivate the node it throws a Schema
error.
$ErrorActionPreference = 'continue'
[System.net.ServicePointManager]::ServerCertificateValidationCallback =
{$true}
$console_server = 'puppetmater.domain'
$node = "node.domain"
$action = @{desired_state='revoked'}
$json = $action | ConvertTo-Json
$url =
"https://${console_server}:8140/puppet-ca/v1/certificate_status/${node}"
echo $url
$results = Invoke-RestMethod -Uri "$url" -body $json -method PUT
-Certificate (Get-PfxCertificate -FilePath
\\server\puppet-certs\Non-Production\certname)
$url =
"https://${console_server}:8140/puppet-ca/v1/certificate_status/${node}"
$response = Invoke-RestMethod -Uri "$url" -method DELETE -Certificate
(Get-PfxCertificate -FilePath \\server\puppet-certs\Non-Production\certname)
echo $response
$deactivateAction = @{command="deactivate node"
version='3'
payload=@{
certname="$node"
}
}
$json2 = $deactivateAction | ConvertTo-Json
$commandURL = "https://${console_server}:8081/pdb/cmd/v1"
echo $json2
$response = Invoke-RestMethod -Uri $commandURL -Method Post -ContentType
'application/json' -Body $json2 -Certificate (Get-PfxCertificate -FilePath
\\server\puppet-certs\Non-Production\certname.pfx)
echo $response
--
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/c400f341-2ac4-46e1-aa55-40dbca61d048%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.