Tuesday, May 7, 2013

Featured Forge Module: Craig Watson’s VMware Tools


Friday, May 3, 2013 5:52 PMFeatured Forge Module: Craig Watson's VMware ToolsPuppet LabsMike Hall

Craig Watson had a touch of "green tick syndrome." With 25 virtual machines running "every kind of system configuration you could squeeze into a LAMP stack, including DNS/DHCP servers, Collectd/Graphite system metrics, Memcached and Nagios monitoring," he was looking for a green tick on the console that would tell him VMware's tools were installed correctly. So he wrote a module.

The problem Craig solved with his VMware tools module was pretty straightforward:

He couldn't get that green tick with existing packages; the open-vm-toolspackage reports a "third party" status, and the OSP packages didn't have the kernel-speciifc packages he required. His module solves all that by installing the archive distributed with vSphere.

So, Craig's module got him his green tick, helped him scratch an itch, and ended up helping the Puppet documentation team: His module was used as a key example in the recently published Hiera walkthrough.

What the Module Does

Craig's module eases the download and installation of the VMware Tools distribution on virtual machines by providing a vmwaretools class.

The module packs along its own shell script in its templates directory to handle the download. Given no arguments, it grabs a recent version of the source distribution of the tools, builds them, then installs them on the target system.

The vmwaretools class can also take a few parameters to customize the experience, including the version, installation directory, and a URL for a copy of the tools archive:

class { 'vmwaretools':    version     => '8.6.5-621624',    working_dir => '/tmp/vmwaretools'    archive_url => 'http://server.local/my/dir',    archive_md5 => '9df56c317ecf466f954d91f6c5ce8a6f',  }  

Under the hood, the module is doing even more, providing avmwaretools_version custom fact from another Puppet user to report any existing VMware Tools installations and their version.

Craig said the initial impetus for the module was a lack of official packages for Ubuntu 12.04 LTS, which is supported along with other Debian osfamilyhosts as well as RHEL 5 and 6.

What Craig Does

Craig's been a system administrator for about three years. He told us, "Puppet is pretty much the single system configuration utility I use. It's an absolutely awesome tool. I try to use it whenever I can." On his LAMP stack VMs, "all of my users are puppetized; system configuration, Apache vhosts and PHP modules. Anything that can be puppetized is (or should be!)"

Puppet also turns up on the dev side of the house at his workplace: "Our developers are using Puppet in an embryonic way to bootstrap Vagrant for virtual environments, and I'm planning to introduce Puppet to our production systems very soon" he said.

He's also written a few other modules: One to install and configure the Subsonic music service, and another to quickly add custom apt repositories.

He told us the best part of writing Puppet modules "is actually seeing results from it, and also getting contributions from the community." He handled a pull request on his VMware Tools module, which has seen a few hundred downloads since its first release, while he was on vacation.

Learn More

  • If you like Craig's VMware Tools module, we have even more VMware modules for managing VMware vCloud Network and Security and VMware vCenter Server Appliance 5.1.

  • You can find over 1,000 modules on the Puppet Forge. Puppet modules help you automate tasks such as setting up a database, web server, or mail server, and you can install any of them with a single command.

  • We recently made it even easier to contribute to the Puppet Forge:Puppet Forge News — One Less Step to Publish … and More

No comments:

Post a Comment