Jan 042013
 

Puppet configuration can quickly become very large, interrelated and unwieldy. Even the most restrained and discplined architect can easily let it get away from itself. As its spread out over numerous disparate files, often an overview of how everything’s interconnected can be useful. Fortunately, the Puppet agent has the ability to create .dot files, viewable with Graphwiz, which allows a node’s configuration to be visualized, and hopefully, to be understood.

To set this up, edit /etc/puppet/puppet.conf, [agent] section:

   graph = true
   graphdir = /var/lib/puppet/state/graphs

Run a puppet update:

   # puppetd -t --noop

This time, three “.dot” files will be written to the graphdir location:

   expanded_relationships.dot
   relationships.dot
   resources.dot

This .dot format is a text file readable by the Graphviz program. It’s available from the standard Ubuntu and Fedora repositories. Install it (preferably on your workstation), copy across the generated Puppet agent .dot files and convert the dot files into pretty PNG image files like with the dot program which is installed as part of Graphviz:

   # dot -Tpng resources.dot -o resources.png

And similarly for the other two files. The generated image contains a map of all the configuration resources and/or relationships of the Puppet client.

One can also view the .dot files directly, as they are text. In fact, one could also trawl the Puppet configuration root and generate .dot files manually, as described in this example on this blog.

After using Graphviz to create pretty configuration visualizations, these maps may bring about some clarity regarding the Puppet config, or possibly identify a circular dependency. Equally, the map may be convoluted and unreadable, which may be a reason to overhaul one’s Puppet configuration.


Matt Parsons is a freelance Linux specialist who has designed, built and supported Unix and Linux systems in the finance, telecommunications and media industries.

He lives and works in London.

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>