a simple gem for interacting with the PuppetDB API.
This library was migrated from puppetlabs ownership to VoxPupuli on 19 October 2016.
gem install puppetdb-ruby
require 'puppetdb'
# Defaults to latest API version.
# non-ssl
client = PuppetDB::Client.new({:server => 'http://localhost:8080'})
# ssl
client = PuppetDB::Client.new({
:server => 'https://localhost:8081',
:pem => {
'key' => "keyfile",
'cert' => "certfile",
'ca_file' => "cafile"
}})
response = client.request(
'nodes',
[:and,
[:'=', ['fact', 'kernel'], 'Linux'],
[:>, ['fact', 'uptime_days'], 30]
],
{:limit => 10}
)
nodes = response.data
# queries are composable
uptime = PuppetDB::Query[:>, [:fact, 'uptime_days'], 30]
redhat = PuppetDB::Query[:'=', [:fact, 'osfamily'], 'RedHat']
debian = PuppetDB::Query[:'=', [:fact, 'osfamily'], 'Debian']
client.request uptime.and(debian)
client.request uptime.and(redhat)
client.request uptime.and(debian.or(redhat))
bundle install bundle exec rspec
File issues or feature requests using GitHub issues.
If you are interested in contributing to this project, please see the Contribution Guidelines
This module was donated to VoxPupuli by Puppet Inc on 10-19-2016.
Nathaniel Smith nathaniel@puppetlabs.com Lindsey Smith lindsey@puppetlabs.com Ruth Linehan ruth@puppetlabs.com
See LICENSE.