2

I've moved from a Chef shop to a Puppet shop.

Here's something I would commonly do in Chef: I would have a template for a config file for, say, Varnish or haproxy, that would route requests to nodes matching a particular role and environment.

The best correlation for the Chef "role" I can find is a Puppet "group."

What's the equivalent of the Chef search? How do I get a collection of nodes (which I guess means their facts) that match some criteria?

Edit: I appreciate the great links and pointers! I'll add that our shop uses theForeman to manage hosts, environments, and puppet classes assigned to nodes. Does it come to play in PuppetDB queries?

1
  • Since you use the Foreman, you can use the Foreman API to search and return json that you can use in manifests.
    – Not Now
    May 8 '15 at 18:55
1

This isn't well supported by Puppet. To get this sort of information you can query PuppetDB. Puppet doesn't include the ability to do this itself as far as I know, but puppet-puppetdbquery adds that. Here's a tutorial on putting the two together to generate a a configuration file with data from PuppetDB.

0

You can do that using Exported Resources. You export a resource in a specific node definition with a specific tag, and collect those resources on a node that has HaProxy installed. For Exported Resources to function, you need PuppetDB.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.