Query puppetdb sane and dependency free.
BSD
package documentation at go.pkgdoc.org
-
put URL to your puppetdb in
$HOME/.config/puppetquery/config.ini
with a line likeurl=http://localhost:8080
-
list names of all active puppet nodes by calling
nq
without parameters -
list names of active puppet nodes having
fact1=foo
andfact2=bar
(implicit and)nq fact1=foo fact2=bar
-
list all facts of a given hostname (nodename in puppet)
nq -l hostname
-
show values of fact1 and fact2 for hosts having fact3=foo and fact4= bar, if fact1 and fact2 are set for this host
nq -f fact1,fact2 fact3=foo fact4=bar
-
show values of fact1 and fact2 for specific host, if they exist
nq -f fact1,fact2 fqdn=hostname.fully.qualified.domain.tld
Just install the package puppetquery.
Works like any other debian source package
- Install build tools from debian via
apt-get install devscripts fakeroot
- Install build dependencies as reported with
dpkg-checkbuilddeps
- Run
fakeroot debian/rules binary
Note: Please don't forget to increase the version number and adding your changes
to the debian/changelog via dch -i
before building a package you plan to release!
Install Go 1, either from source or with a prepackaged binary.
Then run
go get github.com/nightlyone/puppetquery
go get github.com/nightlyone/puppetquery/cmd/nq
List all active puppet nodes
$GOPATH/bin/nq
List all active puppet nodes have 2 processors and running Debian
$GOPATH/bin/nq processorcount=2 osfamily=Debian
BSD
Contributions are welcome. Please open an issue or send me a pull request for a dedicated branch. Make sure the git commit hooks show it works.
enable commit hooks via
cd .git ; rm -rf hooks; ln -s ../git-hooks hooks ; cd ..