hello,

I managed to sort out something here with Singleton (arg).

The end result looks like this:

Just an array of hostnames with the class 'bacula::node':

 $nodes = search_nodes("{'classes' => 'bacula::node'}")

In a template, an array of node objects with all facts, classes etc in it:

<% nodes = Puppet::Util::MongoQuery.instance.find_nodes({"facts.customer" => 
"rip"}) -%>
<%= 
nodes.map do |node| 
   "%s: %s" % [node["hostname"],
               node["facts"]["operatingsystem"]]
end.join("\n") 
%>


and I use above template like:

file{"/tmp/test":
   owner   => root,
   content => template("common/mongo.erb")
}

which results in:

nephilim.ml.org: CentOS
<others removed>


----- "Peter Meier" <[email protected]> wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> > Store configs just wont work for me - masters distributed in
> > different continents, machines hitting any one of those, networks
> > often down between them etc.
> 
> just a note: I think that it would be nice to have that also for
> stored
> configs, as it would make it easier to distribute puppet setups.
> 
> cheers pete
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.10 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
> 
> iEYEARECAAYFAkw/NFYACgkQbwltcAfKi392HgCgrd0ZPOrYiPE2JAqOsOLKhwIe
> KUkAnjv5j6JqtjCovFpV5EcBsh6YgGSg
> =+ycH
> -----END PGP SIGNATURE-----
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "Puppet Developers" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/puppet-dev?hl=en.

-- 
R.I.Pienaar

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to