Provisioning LXC Containers with Chef

Here is a very early look at an LXC container provisioning cookbook I’m currently working on. The goals for this project are to have a quick, mostly automated, consistent way of deploying replacement nodes or additional resources in my environment. I have a lot of ideas I want to implement, but here’s what is working thus far:

  1. Creation of the LXC container itself
  2. Using LXC to generate a unique MAC address per container
  3. Writing a custom LXC config
  4. Starting the container
  5. Stopping & Destroying the container


A set of attributes on the LXC host is what is controlling which container is brought online (or offline & destroyed), and the name of that container. The MAC address is also an attribute inside the file, but the initial value does not matter. The MAC address gets pulled in via Step 2 above, and is then written and saved over whatever value happens to be present at the time of execution.

So far I’m happy with the functionality, but since this was started this morning as a “I wonder if we can do this” project, the code is horribly written. So before we move forward, tomorrow’s goal is to get the current base re-written and then we can start implementing the additional ideas and wants I have for this little project.

Enjoy the video, and be sure and watch at 1080p for best viewing!


Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>