31 Dec 2010

Infrastructure Management: Part #1, Puppet 

By - puppet No Comments

Puppet Master

This blog series will showcase some of the better technologies that we implement for our customers to create a truly scalable, fault-tolerant, easily managed, and well configured infrastructure.

A challenge of any system administration team is to not only ensure that applications are working as expected, but deploying them in a way that consistency is kept and nothing is ever in an ‘unexpected state’. Our first post will be about Puppet, a configuration management application that will help once again give sanity and continuity to your vital infrastructure.

Update: Part 2 is now available.

Puppet Configuration Management
All too often an employee will leave a company and it’s up to the new guy to figure out the intricacies of what files & applications are installed on systems and how they intertwine with each other. Puppet is a great way to cultivate a ‘development operations‘ mentally of infrastructure management. That’s to say, treating infrastructure as code with the same procedures that application designers use such as revision control, commenting, unified syntax, and other elements which ensure certain practices are met when deploying systems and applications.

Start ‘Programming’ Your Infrastructure
For anyone who ever tried to create shell scripts to automate the deployment of their entire infrastructure, Puppet was made to lessen your struggle. As an administrator we want to ensure that our systems are online and if they aren’t, to get them back online as quickly as possible. By utilizing Puppet for configuration management, we can streamline this process by creating ‘manifests’ of Puppet DSL code which dictate how a system and its unique set of configuration exists.

The following simple example of Puppet will ensure that the file ‘httpd.conf’ is placed on the desired server with root:root ownership, 0644 permissions, and if there are differences from the ‘installed’ version versus the ‘desired’ version, the file will be updated as needed.

file file { "/etc/httpd/httpd.conf"
    ensure  => present,
    owner   => "root",
    group   => "root",
    mode    => "0644",
    source  => "puppet:///modules/httpd/httpd.conf";

As a quick anecdote, I previously had a client who was getting unexpected errors with their nginx/haproxy configuration and it was rather unclear why. After tedious troubleshooting, it was found that one server of the twelve was not configured the same as the others. This single file mismatch led to hours of wasted time for us and the customer. Now scale this example across the hundreds or thousands of important files in a large network and it quickly becomes obvious how useful even just the above snippet can be. But of course, that’s not all Puppet can do.

A Simple HTTP Server Module
With just a few declarations we can do the following:

  1. Install the httpd package
  2. Ensure that the httpd service is always running and configured to run on boot
  3. Copy the desired httpd.conf to the server and whenever the file is changed, the httpd service restarts
class httpd {
	package { "httpd": 
		ensure => present;

	service { "httpd":
		ensure    => running,
		enable    => true,
		subscribe => File["/etc/httpd/httpd.conf"],
		require   => Package["httpd"];
	file { "/etc/httpd/httpd.conf":
		ensure  => present,
		owner   => "root",
		group   => "root",
		mode    => "0644",
		source  => "puppet:///modules/httpd/httpd.conf",
        require => Package["httpd"];

Taking Back Your Infrastructure
This is a very small, simplistic showcase of what Puppet can do for an environment. Beyond just typical file, package, and service management, Puppet can be used to automatically deploy Nagios and Munin monitoring, be used to deploy code (think Capistrano), and manage any conceivable aspect of your infrastructure.

Update: Part 2 is now available.

Looking to automate your infrastructure?

We are infrastructure management experts. Give us a call at 888-877-7118 or click here to request a proposal.

No Responses to “Infrastructure Management: Part #1, Puppet”

Leave a Reply