Published on 28 July 2015 by

Puppet’s unique model-based approach to configuration management has completely changed systems administration. While sysadmins have a plethora of imperative tools available, Puppet is the only declarative tool that uses your infrastructure code to generate a mathematical directed acyclic graph (DAG) containing every configuration’s desired state. This graph is the representation of the system’s configuration model, and it’s fully generated before any action is taken. Because of this graph, Puppet understands everything before it does anything.

The graph is emergent, meaning you don’t have to think about it. All you have to do is write Puppet code to express what configurations should look like (e.g., file modes, service states, user passwords, etc.) and to group configurations together into a reusable model. Unfortunately, there’s never been a clear way to understand the complete models generated by your code…. until now. Behold our new visualization of the Puppet graph!

Node Graph

You may not be familiar with how Puppet uses graphs to model your configurations, so let’s take the example of modeling a house. A resource can be a piece of plywood, a brick, a pane of glass, a pipe. You can group multiple pieces of pipe together to make a conduit. You can group multiple bricks together to make a wall. Now that you have a repeatable way to define a conduit and a wall, you can declare as many of them as you need throughout your house model. By taking simple objects and grouping them to make more complex objects, you create an abstraction, which reduces the complexity of the house’s model and makes it easier to understand how to build it. Now all you need to understand is the type of wall, conduit or window you need, and where you need it.

The same is done with Puppet. You can group packages, files, and services (the walls, conduits and windows of Puppet code) to model an SSH server or a web server. Now when you’re modeling your application, you simply say you need a web server and you don’t need to worry about which discrete resources are needed to accomplish it.

class myapplication::db::role {
  include profile::common
  include profile::application::db
  include profile::mysql

However, problems arise when you want to understand the entire model. A house is a physical object in three-dimensional space. It’s relatively easy to take a single brick and understand how it relates to every other object that makes up the house. When a brick is damaged, it’s easy to understand how that affects the rest of the house. Doing the same with conceptual models generated from a sprawling code base is not so simple.

The problem becomes even more complex when multiple teams are contributing to the code base. You don’t always have clear visibility into everyone else's work and how it relates to yours. Lack of visibility isn't limited to environments where multiple people contribute to the codebase. Even someone using a module from the Puppet Forge can feel like they're working with a black box, because the models the module generates aren't transparent to the user.

Visualize the Models

With the release of Puppet Enterprise 2015.2, we’re excited to offer a new way to see the models you’ve built. Puppet Enterprise now includes a graph that visualizes the models defined with Puppet code, so you can gain better insight into how well your model is constructed. The new node graph in Puppet Enterprise visualizes the classes and defined types (walls, conduits, etc.) that contain the individual resources. Since class and defined-type hierarchies can become complex, the ability to see the entire containment topology is incredible.

Collaboration is key to creating agile, maintainable, and robust code. The graph lets you see how all contributed code comes together to form the resulting models. This helps multiple teams identify where the models can be improved to minimize failures, improve change response time, and increase infrastructure collaboration.

Visualize Changes and Failures

We didn’t stop there. One problem you’ll likely run into repeatedly is understanding how a resource change or failure on a system relates to the rest of the system’s model. Event inspection in Puppet Enterprise is fantastic at showing you change events within your infrastructure, even showing the file and line number in your code where the resource was declared. The new node graph takes that information and adds context. Was that resource part of a defined type? How does the containing class relate to all the other classes on the system? These questions were nearly impossible to answer before. Now Puppet Enterprise can just show you.

Node Graph

Node Graph

We think you'll be as excited about the node graph visualization as we are. As amazing as this is, we are overjoyed to say this is just the beginning. There’s a lot more information we can surface through this visualization, forever changing how you develop, test, deploy, and monitor your infrastructure code, so be sure to stay tuned!

Learn More

Share via:
Posted in:
The content of this field is kept private and will not be shown publicly.

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.