|
This is what I wrote to make PuppetDB querying easier:
#!/bin/bash
ca_crt=$(puppet config print cacert) cert=$(puppet config print hostcert) key=$(puppet config print hostprivkey)
file=$1
curl -sk -X GET --cacert $ca_crt --cert $cert --key $key -H 'Accept: application/json' --data-urlencode "query@"$ {file}
https://localhost:8081/v3/resources
Much simpler than trying to handle it all manually. It could easily be extended to support different commands (e.g., pull a host's entire catalog or facts) and flags (e.g., certname).
|