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?
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.
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.