Create LXC system containers easily with Puppet

Overview

I'm refactoring Puppet manifests and refactoring requires automated testing.

rspec-puppet and cucumber-puppet test Puppet catalog, but I need to test actual server status that Puppet manifests applied to.

For actual testing, several virtual machines are needed. Vagrant is the one for creating virtual machines for testing easily.

But I'm using KVM mainly and would like to create virtual machines for testing on a KVM based virtual machine.

LXC suits that purpose.

For testing purpose, how to create LXC system containers easily is important. So I've created a Puppet module to create LXC system containers easily.

mizzy/puppet-lxc-test-box


How To Use

First, git clone puppet-lxc-test-box module and puppet-sysctl module.

$ git clone git://github.com/mizzy/puppet-lxc-test-box.git lxc-test-box
$ git clone git://github.com/duritong/puppet-sysctl.git sysctl

Next, write a manifest to create system containers.

include lxc-test-box

Exec { path => '/sbin:/usr/sbin:/bin:/usr/bin' }

lxc-test-box::lxc::setup { 'proxy': ipaddress => '172.16.0.2' }
lxc-tets-box::lxc::setup { 'www':   ipaddress => '172.16.0.3' }
lxc-test-box::lxc::setup { 'db':    ipaddress => '172.16.0.4' }

Apply this manifest.

$ sudo puppet apply --modulepath=. lxc-test-box.pp

3 containers will be created.