Local Puppet Development with Geppetto and VMware

This article describes the local development environment and workflow that I use for developing and testing multi-system configurations that are managed by Puppet. VMWare Workstation is used to run local Puppet Master and Test Node with '/etc/puppet' on the Master mapped to Geppetto's workstation located on my local computer.

Objectives

Effective and efficient development of Puppet-configured systems requires frequent integration and testing: the Puppet code you write should immediately appear on a Puppet Master and be applied to the various nodes comprising a test system.

How it Works

I use Windows as my local workstation. The Puppet manifests are stored in a code repository, such as Subversion or Git.  Geppetto is the IDE.  VMware Workstation provides virtual servers for a local Puppet Master and one or more testing nodes that simulate a multi-computer system configuration.

Using Geppetto, the Puppet code is checked out into a local workspace on my Windows workstation.  VMware Workstation makes this "Geppetto Workspace" available to the Puppet Master virtual server.  This mounting is made "read only", as a personal preference. I softlink the '/etc/puppet' directory on the Puppet Master to this mounted filesystem.

Any code changes that I now make using the Geppetto editor will immediately appear on the local Puppet Master.  Note that I have not yet checked in any code.  All of this development work is local to my workstation.

Regression and functional testing is done by triggering the Puppet agents on the various Test Nodes.  I frequently restore a Test Node to a base snapshot in order to test the Puppet manifest thoroughly.

In this approach, the Code-Test cycle is fast and gives more assurance that the code I eventually check in will succeed in both a bare metal scenario as well as incremental patch to an already-running environment.

After check in, the code is deployed to a QA environment and eventually to production servers.

How to Build It

VMware folder sharing is the only difficult step in achieving this local development environment.  Here is how to do it.

Create a Virtual Server to be the Local Puppet Master

I create a Debian-based virtual machine to use as the Puppet master. Generating the Puppet catalog is memory intensive, so I allocate more than enough memory, 2GB.

Configure Geppetto's Local Workspace
Enable "Folder Sharing" in the Options tab for the Puppet master virtual machine.

Enable "Folder Sharing" in the Options tab for the Puppet master virtual machine.

The Puppet code repository is checked out by Geppetto to a local workspace on the workstation.  This directory will be used in the next step, setting up folder sharing.

Enable Folder Sharing on VMworkstation

Enable Folder Sharing in the Options tab for the Puppet master virtual machine and select the same folder as used by Geppetto when it creates its local code repository workspace.

Install VMware Tools in Puppet Master Virtual Machine

Upon starting the Puppet master virtual machine, you will see the reminder message below:

VMware Reminder Message to Install Tools in Guest OS

VMware Reminder Message to Install Tools in Guest OS

Mount the CDRom drive using 'mount /dev/cdrom/' command from within the guest, extract the VMwareTools archive and then run the './vmware-install.pl' command.

If you see the error message below, then you need to take extra steps to install make, gcc and the kernel headers for the guest.

Required Packages Preventing the Installation of VMware Tools.

Required Packages Preventing the Installation of VMware Tools.

Under Debian these packages are installed using the command:

aptitude install gcc libglib2.0-0 make linux-headers-`uname -r` -y

If using VMware Workstation 7, you may need to specify the full path to the gcc-4.3 package, as shown below:

Specifying the full path to gcc-4.3: /usr/bin/gcc-4.3 in Debian.

Specifying the full path to gcc-4.3: /usr/bin/gcc-4.3 in Debian.

Likewise, you may need to manually specify the location of the kernel headers. In my virtual machine, they are located in '/usr/src/linux-headers-2.6.32-5-686/include'. This will be different for your computer:

KernelHeaders

Location of Kernel Headers

The VMware tools should now compile and display the success messages shown below:

Successful Compilation of VMware Tools.

Successful Compilation of VMware Tools.

Linking /etc/puppet to Mounted Filesystem

To allow the Puppet master to use the modules stored on the shared folder, the simplest approach is to replace the '/etc/puppet' directory with a softlink to the mounted filesystem, as shown in the command below:

Replacing the Puppet Directory with a Softlink to the Mounted Filesystem.

Replacing the Puppet Directory with a Softlink to the Mounted Filesystem.

We can now confirm that the '/etc/puppet' directory on the Puppet master virtual machine is a read-only mounting of the Geppetto workspace on the local workstation, as shown by the test below:

Testing the Setup

Testing the Setup

June 18th, 2013 Posted by Jon Jaroker Filed in: Puppet Workflows