Em sexta-feira, 17 de julho de 2015 00:17:28 UTC-3, Ken Barber escreveu:
>
> > Hello list. 
> > 
> > I'm trying to use PuppetDB to link a webserver cluster to an EJB 
> cluster. 
> > Each webserver host need to reference a comma separated list of IPs 
> provided 
> > by each EJB host 
> > 
> > Exporting and collecting resources works pretty nice but I think this 
> isn't 
> > the better approach. I just need a variable with a hash or an array to 
> > iterate within an ERB template in order to build my list. 
>
> Joao, 
>
> Take a look at this library, authored by my friend Eric: 
>
> https://github.com/dalen/puppet-puppetdbquery 
>
> It provides Puppet functions for querying PDB, its syntax is a wrapper 
> around our own PDB one, but should provide you with the tools to do 
> queries against PDB in a more arbitrary way hopefully avoiding the 
> need for your own curl/shell methodology. You might still need to 
> manipulate the data you receive using other tools, but it should be a 
> good start for what you want. If you get stuck further down the line, 
> respond to this thread. 
>
> We have plans to solidify this story, and make it closer to our core 
> offerings but I'm wary to get into a vapourware discussion until we 
> have something to show. For now, what I've provided is where you want 
> to look. 
>
>
Thanks Christopher and Ken. I'm doing some tests with puppetdbquery module 
and it apparently worked very well for my need.

Please let me know if I'm doing something nasty or if something could be 
improved. I need to create a comma separated list of remote IPs.

Nodes which are being referenced:

    define exporting (
        $ipbind,
        $env,
    ) {
    }

    ...

    @@exporting { "type_of_server":
        ipbind    => "<binding-ip>",
        my_system => "<my-system-id>",
        my_env    => "<my-environment>",
    }

Nodes that reference:

    $server_resources = 
query_resources("@@Exporting{my_system=<my-system-id> and 
my_env=<my-environment>}", "@@Exporting[type_of_server]")

All IPs are here:

    $server_resources[<iterate-here>]['parameters']['ipbind']

Even better if I could use join() (from stdlib) in order to create my list. 
=)

JM

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/565ba8cd-cf39-4e81-9c4e-baa7f64bf7b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to