Very cool!

My brain has extrapolated a few cool uses already. :)

Thanks Erik!

On 20 July 2012 03:02, Erik Dalén <erik.gustav.da...@gmail.com> wrote:
> I've released a new version of this module, it no longer requires the
> rest_client gem and uses the Puppet HTTP pool instead.
> It also supports getting facts for an array of hosts at once. As an
> example if you want the IPs of all hosts with Apache class you could
> do this:
>
> $hosts = pdbfactquery(pdbresourcequery([ 'and', [ '=', [ 'node',
> 'active' ], true ], [ '=', 'type', 'Class' ], [ '=', 'title', 'Apache'
> ] ], 'certname'), 'ipaddress')
>
> It is also on the Puppet Forge now:
> http://forge.puppetlabs.com/dalen/puppetdbquery
>
> On 19 June 2012 16:48, Erik Dalén <erik.gustav.da...@gmail.com> wrote:
>> I've created a set of functions that exposes the PuppetDB query API
>> from inside puppet. Feel free to give them a spin and get back to me
>> with any bugs or feedback.
>>
>> https://github.com/dalen/puppet-puppetdbquery
>>
>> They require ruby-restclient, ruby-json and the puppetdb-terminus.
>>
>> To give you an example of a query you can do inside puppet code using
>> these functions and PuppetDB:
>>
>> # Return an array of active nodes with an uptime more than 30 days and
>> # having the class 'apache'
>> $hosts = pdbnodequery([ 'and', [ '=', [ 'node', 'active' ], true ],
>> ['>', [ 'fact', 'uptime_days' ], 30 ] ],
>>   [ 'and', [ '=', 'type', 'Class' ], [ '=', 'title', 'Apache' ] ] )"
>>
>> This can be used for example to populate lists of nodes behind load
>> balancers and such dynamically instead of writing them down in your
>> puppet code.
>>
>> --
>> Erik Dalén
>
>
>
> --
> Erik Dalén
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Puppet Users" group.
> To post to this group, send email to puppet-users@googlegroups.com.
> To unsubscribe from this group, send email to 
> puppet-users+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/puppet-users?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to