On Monday, 8 August 2016 14:02:39 UTC-7, Christopher Wood wrote:
>
> On Mon, Aug 08, 2016 at 11:28:55AM -0700, Matthew Pounsett wrote:
> > I'm using puppet 4.4.1. I have a case where I need the IP addresses
> of
> > all the servers that fit a certain set of criteria to appear in a
> YAML
> > list in a config file on a particular host.
>
> Been there for an activemq.xml config file, ended up using Erik Dalén's
> puppetdbquery.
>
> https://forge.puppet.com/dalen/puppetdbquery
>
That looks like it quite neatly solves the problem.
Thanks!
>
> This in a manifest:
>
> $qf = query_facts('id=root', ['owner', 'datacenter'])
>
> This in a template used in that manifest:
>
> <%
> list = {}
> @qf.values.each do |h|
> if h['owner']
> owner = h['owner']
> list[owner] = 1
> end
> if h['datacenter']
> datacenter = h['datacenter']
> list[datacenter] = 1
> end
> end
> -%>
>
> You get the idea, could output yaml there or whatever you wanted really.
>
> > It seems like the first step would be to create an exported resource
> with
> > the required data in it, but I haven't yet found a way to refer to
> those
> > data from inside a template (or from inside a module in order to
> populate
> > a variable I can use in a template). It seems like this would be a
> > common pattern, but the closest examples I've been able to find are
> for
> > realizing the exported resource to create a file or other resource on
> a
> > system, rather than incorporate some of the exported resource's data
> in
> > other resources.
> > How do people normally go about doing something like this? Are there
> some
> > examples I've just failed to find?
> >
> > --
> > 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 [1][email protected] <javascript:>.
> > To view this discussion on the web visit
> > [2]
> https://groups.google.com/d/msgid/puppet-users/d60d5c64-babe-4b46-8529-ceac74cf576b%40googlegroups.com.
>
>
> > For more options, visit [3]https://groups.google.com/d/optout.
> >
> > References
> >
> > Visible links
> > 1. mailto:[email protected] <javascript:>
> > 2.
> https://groups.google.com/d/msgid/puppet-users/d60d5c64-babe-4b46-8529-ceac74cf576b%40googlegroups.com?utm_medium=email&utm_source=footer
>
> > 3. https://groups.google.com/d/optout
>
>
--
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/8eeec81b-407c-4c34-b58b-1d4352af10ec%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.