Skip to content

Latest commit

 

History

History
98 lines (64 loc) · 2.37 KB

README.md

File metadata and controls

98 lines (64 loc) · 2.37 KB

puppetquery

Query puppetdb sane and dependency free.

Build Status

LICENSE

BSD

documentation

package documentation at go.pkgdoc.org

quick usage

  • put URL to your puppetdb in $HOME/.config/puppetquery/config.ini with a line like url=http://localhost:8080

  • list names of all active puppet nodes by calling nq without parameters

  • list names of active puppet nodes having fact1=foo and fact2=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

build and install

install from package

Just install the package puppetquery.

build the package

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 from source

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

LICENSE

BSD

documentation

contributing

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.

git commit hooks

enable commit hooks via

    cd .git ; rm -rf hooks; ln -s ../git-hooks hooks ; cd ..