Can I find out about another node?

39 views
Skip to first unread message

Robert Inder

unread,
Jul 5, 2017, 10:34:26 AM7/5/17
to Puppet Users
I'm using Puppet (3.8) to set up installations of a system for different clients.

We have a number of servers running "live" installations,
and others running corresponding development installations.

There is a module for the system, and each node has a separate
instance for each client that that machine is to support.

I'd like to tell the development system for a given client
where to find the corresponding "live" installation.

Can I do that?  Can an instance of a OurSystem resource for client
"Edinburgh"  on node "devel9"  determine which other
node also has an instance of OurSystem for "Edinburgh"?

Robert.






Eric Sorenson

unread,
Jul 5, 2017, 12:37:37 PM7/5/17
to Puppet Users
The best way to do this is to use puppetdb, which you can then query from manifests using the puppetdb_query() function.

Your query would look like (untested but i think this is right...)

$nodes_array = puppetdb_query('inventory[certname] { resources { type = "OurSystem" } }')

(You may see references to "exported resources" which accomplishes a similar goal but IMO querying is better because it has a superset of exported resource functionality and you don't need to know beforehand which resources you want to mark as being 'collectable'.)

HTH
--eric0
Reply all
Reply to author
Forward
0 new messages