Useful puppetdb queries

Posted . Visible to the public.

Pick up All Servers:

curl -X GET --tlsv1
--cacert /etc/puppetlabs/puppet/ssl/certs/ca.pem
--cert /etc/puppetlabs/puppet/ssl/certs/.pem
--key /etc/puppetlabs/puppet/ssl/private_keys/<cert_name>.pem
-H "Accept application/json"
https://localhost:8081/pdb/query/v4/facts/ipaddress | python -m json.tool

Response:

{
    "certname": "XPTO",
    "environment": "production",
    "name": "ipaddress",
    "value": "xxx.xxx.xxx.xxx"
},

curl 'http://localhost:8080/pdb/query/v4/facts'

Get ALL Node Information

OPTION='-X GET --tlsv1 --cacert /tmp/ca.pem --cert /tmp/????.pem --key /tmp/key_????.pem -H "Accept application/json"'

curl $OPTION https://localhost:8081/pdb/query/v4/nodes | python -m json.tool

Fabio Silva
Last edit
Fabio Silva
Posted by Fabio Silva to Fabio Silva's deck (2018-02-11 14:37)