PuppetDB API Cheat Sheet and Useful One Liners


This is my puppetdb api cheat sheet of useful one liners for querying against the puppetdb api. These are geared for a command line environment, so you’ll notice that they depend on the curl jq commands. These available through the package manager on most linux distributions.

This It’s a work in progress.

Generate a host list from the puppetdb api.

$ curl -s 'http://localhost:8080/v3/nodes' | jq -r '.[].name'
 
host1.example.com
host2.example.com
sandbox.example.com

PuppetDB API documentation: http://docs.puppetlabs.com/puppetdb/latest/api/”

jq documentation: http://stedolan.github.io/jq/manual/

Join the Conversation