DragonFly On-Line Manual Pages
ppdb(1) Hieracles command manual ppdb(1)
NAME
ppdb - Command line tool to query puppetdb
SYNOPSIS
ppdb command [ options ]
DESCRIPTION
This tool is part of the Hieracles tools suite.
PuppetDB stores information gathered by Puppet when nodes run the
puppet client. It exposes a very neat REST interface, but its query
system can be a little complicated.
The purpose of ppdb is to overlay the calls to the REST API and propose
a more user-friendly way to query the Puppet Database (puppetdb).
Note that this tool is designed to work fine with the version 3 of the
PuppetDB API.
Ref http://docs.puppetlabs.com/puppetdb/2.3/api/
ppdb takes a command, plus extra parameters depending the command.
node info <fqdn>
will display the equivalent of GET /v3/nodes/<NODE> and takes
the node certname as an argument.
Optionaly, you can add a filter to limit what fields are
displayed.
eg. ppdb node info <fqdn>
will display all the fields from the API response
eg. ppdb node info <fqdn> time
will only display the fields containing time in their
label.
node facts <fqdn>
will display the equivalent of GET /v3/nodes/<NODE>/facts and
takes the node certname as an argument.
As the result can be verbose, you can add a filter to limit
what fields are displayed.
eg. ppdb node facts <fqdn>
will display all the fields from the API response
eg. ppdb node facts <fqdn> memory
will only display the fields containing memory in
their label.
node resources <fqdn>
will display the equivalent of GET /v3/nodes/<NODE>/resources
and takes the node certname as an argument. You can use res
instead of resources for shorter.
As the result can be verbose, you can add a filter to limit
what resources are displayed.
eg. ppdb node res <fqdn>
will display all the fields from the API response
eg. ppdb node res <fqdn> nagios
will only display the fields containing nagios in
their label.
facts <name> <value>
will list all fqdn (aka. certnames) of the nodes having the
<name> fact set to <value>.
eq. ppdb facts puppet_environment dev
same <name> <fqdn>
will list all the fqdn having the same value for the fact <name>
as <fqdn> has.
eq. ppdb same farm node32.example.com
resources <queries>
res <queries>
will list the resources matching a given set of queries.
Queries are a combination of statements, with a label, an
operator and a value. You can use or to separate one or several
statements. If there is no or indicated, the statements follow
an and logic. All statements that don't contain an operator or
match the or keyword are purely ignored (which makes possible to
use the and keyword for mental stability purpose).
Operators can be >, <, =, ~ and can be prefixed by a ! to negate
them.
eq. ppdb res type=Nagios_ghost and tag~api
eq. ppdb res tag~api title!~dev
eq. ppdb res tag~api or certname~api or title~api
factnames
will list all the factnames puppetdb knows about. This may be a
long list.
OPTIONS
-v
--version
outputs version.
-f format
--format format
outputs in the selected format. For now only the json format is
available as an alternative to the default console format.
FILES
~/.config/hieracles/config.yaml
ppdb uses the same configuration file as hieracles, and relies
on its information to find the url of the PuppetDB
EXAMPLES
A typical config file would contain, at minimum:
---
puppetdb:
usessl: false
host: localhost
port: 8080
SEE ALSO
hiera(1), puppet(8), hc(1)
BUGS
Please report any bug to https://github.com/Gandi/hieracles/issues
AUTHORS
Copyright (c) 2015 gandi.net https://gandi.net
Hieracles is written by mose@gandi.net
https://github.com/Gandi/hieracles
version 0.2.1 2015-12-05 ppdb(1)