You want to enable catalog graphs
First install the puppetlabs-inifile
module from the Puppetforge:
puppet module install puppetlabs-inifile --version 1.6.0
Notice: Downloading from https://forgeapi.puppet.com ...
/etc/puppetlabs/code/environments/production/modules
|----puppetlabs-inifile (v1.6.0)
Then use it to enable graphs in your puppet config:
class puppet_agent_graphs {
ini_setting { 'enable graphs':
ensure => present,
path => '/etc/puppetlabs/puppet/puppet.conf',
section => 'agent',
setting => 'graph',
value => 'true',
}
}
The config file now includes the setting:
$ cat /etc/puppetlabs/puppet/puppet.conf
... snip ...
[agent]
graph = true
... snip ...
One of the lesser known but very helpful Puppet features is the puppet agents ability to create graph files when it has finished executing. These files allow you to view dependencies and relationships between resources in the puppet catalog, which can be especially helpful when trying to track down dependency cycles between resources.
To generate these files you need to specify graph = true
in the agents config
file, this has to be specified on each node, not as a setting on the puppet
master. While you can do this by hand we'll use puppet, and the
puppetlabs-inifile
module, to do it automatically. First you'll need to install the module
from the forge:
puppet module install puppetlabs-inifile --version 1.6.0
Notice: Downloading from https://forgeapi.puppet.com ...
/etc/puppetlabs/code/environments/production/modules
|----puppetlabs-inifile (v1.6.0)
Once this is done you should add an ini_setting
resource to the class
you use to manage your puppet agents.
class puppet_agent_graphs {
ini_setting { 'enable graphs':
ensure => present,
path => '/etc/puppetlabs/puppet/puppet.conf',
section => 'agent',
setting => 'graph',
value => 'true',
}
}
You'll need to run puppet twice before you will see the graph files. The first run will modify the client config:
$ cat /etc/puppetlabs/puppet/puppet.conf
... snip ...
[agent]
graph = true
... snip ...
and the second will run puppet with the new config applied and create
the graph files in the /opt/puppetlabs/puppet/cache/state/graphs
directory. Once you have them you can load and view these files with
tools like OmniGraffle (OS X) or graphviz (multi-platform).