Sometimes it’s nice to try and figure out what resources of a machine are being managed by puppet. Puppet keeps a state file in either YAML or Marshall format called localconfig.yaml it’s full of useful information, I wrote a quick script to parse it and show you what’s being managed.
Typical output is:
Classes included on this node:
Resources managed by puppet on this node:
defined in common/modules/smokeping/manifests/service.pp:6
defined in common/modules/puppet/manifests/init.pp:201
It will show all classes and all resources including where in your manifests the resource comes from. Unfortunately for resources created by defines it shows the define as the source but I guess you can’t have it all.
You can get the code here it’s pretty simple, just pass it a path to your localconfig.yaml file, it supports both YAML and Marshal formats.
The file also has every property of the resources in it etc, so you can easily extend this to print a lot of other information, just use something like pp to dump out the contents of Puppet::TransObject objects to see what’s possible.