Is it possible to tell puppet to compile a catalog for one (or all) node(s) and save that particular data somewhere?

I'm specifically interested in getting all needed packages and their versions per node, but a general approach for getting any data is also suitable.

2 Answers 2



This original answer is now out of date. The updated command for Puppet 3.x is:

puppet resource package

If you're looking for all the packages and versions installed on a node regardless of whether they're installed by Puppet or not, the following command is built in and can be run on any Puppet node:

ralsh package

This will output the data in a Puppet manifest form to stdout.

Ralsh will work for any resource type that has the instances method implemented (users, groups, etc.).

If you're looking to centrally inspect the YAML catalog for all resources defined in Puppet manifests, your Puppetmaster already caches this information in /var/lib/puppet/client_yaml/catalog and you just need to parse it with your YAML parser of choice. The Puppet Inventory Service that was introduced fairly recently may also be a good option for you; you can make do with storeconfigs if you're running on an older version like 0.25.x.

  • One problem with this approach is that it doesn't allow for multiple versions of the same package, as is common with the kernel package on Red Hat-based distros.
    – Paul Gear
    Aug 31, 2012 at 3:57
  • I'm not sure this really answers the question: The command lists the currently installed packages, not the packages required by Puppet. I'm interested in a list of the latter to feed it to rpmorphan. Nov 12, 2013 at 16:21
  • @TimLandscheidt, are you asking about the full list of package resources that Puppet lists in the catalog for a node? Unless you feel up to parsing the cached catalog, your best bet would be to query PuppetDB. The query API is available here. Nov 14, 2013 at 14:50
  • @jgoldschrafe Finally got around to installing PuppetDB, and indeed it does what I want. I can query for all package resources that have "ensure" not equal to "absent" for a specific host, and use the JSON result to feed a list to rpmorphan. Thanks! Oct 8, 2014 at 1:17

Honestly, this is the sort of thing that mcollective was built to do. Specifically, the package provider for mcollective: http://projects.puppetlabs.com/projects/mcollective-plugins/wiki/AgentPackage

This completely skips puppet, and doesn't even require that puppet is installed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .