UpGuard and Puppet - Fits Like a Glove

Posted by UpGuard

Going from nothing to automation using one of the many tools available can be a daunting task. How can you automate systems when you’re not even 100% sure how they’ve been configured? The documentation is months out of date and the last guy to configure anything on that box has since left the company to ply his trade somewhere that will more fully appreciate his Ops cowboy routine.

See your website's faults before your competitors

UpGuard makes this transition a much smoother experience by helping to bring your environment under control first, so that when you’re happy that you’ve captured your current state you can then move on to automation. It will even help you to get started with several of the IT automation tools available out there so that you don’t have to worry about having your config stored in multiple places and learning multiple tools from scratch. One such configuration management tool is Puppet (from parent Puppet Labs) .To show you a basic example here, I’ll be using it to set up Apache and MySQL using Puppet as part of automating a new LAMP server.

1. Scan & Understand

I could manually create a package and service template in UpGuard but that’s unnecessary as I’ve already got Apache installed on an existing machine. Instead I’ll scan it using UpGuard which will pick up the correct versions and state of my working system. I can then filter down to Apache and MySQL related items:

UpGuard scan

2. Control

I want the apache2 package installed with the service running and my default page updated so I’ll add them to my UpGuard package. I also want the mysql-server package, mysql service and the mysql config file, so I’ll add them too. The package that is getting created is a test package that I can later use to validate the new server I’ll be building using Puppet, both post build and ongoing, to make sure nothing changes without my knowledge.

LAMP Package

3. Automate

From here I can create a Puppet manifest file that will auto-generate a Puppet class for me with the package and service types filled in:

Generate Manifest

Which will produce the following output:

#
# Generated by UpGuard
# ---------------------------------
#
class lamp {

  file { '/etc/apache2/sites-available/default':
    ensure => file,
    source => '## TODO: Insert path to file source for /etc/apache2/sites-available/default',
    mode => '0644',
    group => '0',
    owner => '0'
  }

  package { 'apache2':
    ensure => '2.2.22-1ubuntu1.4'
  }

  service { 'apache2':
    ensure => running
  }

  file { '/etc/init/mysql.conf':
    ensure => file,
    source => '## TODO: Insert path to file source for /etc/init/mysql.conf',
    mode => '0644',
    group => '0',
    owner => '0'
  }

  package { 'mysql-server':
    ensure => '5.5.31-0ubuntu0.12.04.2'
  }

  service { 'mysql':
    ensure => running
  }
}

As you can see, I’ve still got some work to do to hook up the source. It also hasn’t added the dependencies between file, service and package (See Puppet Docs…). I’m well on my way though and I’m yet to open up a text editor.

5 Commonly Found Problems in Puppet Enterprise

Once I’ve update those values and am happy with the manifest I’ll use Puppet to apply it to my new server:

Puppet Report

I’ll then return to UpGuard and execute my tests against the new node to make sure everything has worked as expected:

Success!

Almost all Enterprises today aspire to, or are using some form of, IT automation. By complementing your automation efforts with a UpGuard deployment you can:

  • Make the process of discovering your automation requirements a breeze
  • Turn those same requirements into pre-formatted automation files (ie: Puppet manifests)
  • Validate your configuration, both post build to verify the automation, and ongoing to keep the configuration under control and prevent drift

Get a Guided UpGuard Demo

Topics: IT automation, configuration management, puppet, upguard

UpGuard Customers