Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 10 down vote accepted

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.

share|improve this answer
    
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 '12 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. –  Tim Landscheidt Nov 12 '13 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. –  jgoldschrafe Nov 14 '13 at 14:50

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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