FAQ
I just released dalen-puppetdbquery 1.1.0, one cool new feature in this
release is a hiera backend.

So if you have a puppet class that takes a list of hosts as a parameter you
can now fill it using dynamic data from a puppetdb query. No need anymore
to modify the module itself or create a wrapper class around it to do the
puppetdb query in.

It requires another hiera backend to be active at the same time, and that
will be used to define the actual puppetdb query to be used. It does not
matter which backend that is, there can even be several of them. To enable
add the backend `puppetdb`to the backends list in `hiera.yaml`.

So instead of writing something like this in for example your
`hiera-data/common.yaml`:

     ntp::servers:
       - 'ntp1.example.com'
       - 'ntp2.example.com'

You can now instead write:

     ntp::servers::_nodequery: 'Class[Ntp::Server]'

It will then find all nodes with the class ntp::server and return an array
containing their certname. If you instead want to return the value of a
fact, for example the `ipaddress`, the nodequery can be a query and fact
tuple, like:

     ntp::servers::_nodequery: ['Class[Ntp::Server]', 'ipaddress']

or a hash:

     ntp::servers::_nodequery:
       query: 'Class[Ntp::Server]'
       fact: 'ipaddress'

When returning facts only nodes that actually have the fact are returned,
even if more nodes would in fact match the query itself.

--
Erik Dalén

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

Search Discussions

  • Martijn at May 28, 2013 at 7:53 am
    That is very cool, Erik, and looks very useful.

    Thanks,
    Martijn

    Op maandag 27 mei 2013 20:44:19 UTC+2 schreef Erik Dalén het volgende:
    I just released dalen-puppetdbquery 1.1.0, one cool new feature in this
    release is a hiera backend.
    --
    You received this message because you are subscribed to the Google Groups "Puppet Users" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com.
    To post to this group, send email to puppet-users@googlegroups.com.
    Visit this group at http://groups.google.com/group/puppet-users?hl=en.
    For more options, visit https://groups.google.com/groups/opt_out.
  • Cody Herriges at May 30, 2013 at 5:38 pm
    Really awesome.

    On Tue, May 28, 2013 at 12:53 AM, Martijn wrote:

    That is very cool, Erik, and looks very useful.

    Thanks,
    Martijn

    Op maandag 27 mei 2013 20:44:19 UTC+2 schreef Erik Dalén het volgende:
    I just released dalen-puppetdbquery 1.1.0, one cool new feature in this
    release is a hiera backend.

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

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedMay 27, '13 at 6:44p
activeMay 30, '13 at 5:38p
posts3
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase