Puppet – get list of packages and versions

asset-managementpackage-managementpuppet

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.

Best Answer

UPDATE

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.

Related Topic