/lxc-cookbook

Chef cookbook for managing lxc

Primary LanguageRuby

LXC cookbook

Chef cookbook for managing lxc (linux containers)

Usage

This cookbook provides container resource/providers. Currently its only tested on ubuntu 14.04. This cookbook uses native ruby bindings for managing containers.

Following will create a ubuntu container named test-1

container 'test-1'

And following will create and start a ubuntu 10.04 container

container 'test-2' do
  options(template: 'ubuntu', template_options: ['-r lucid'])
  action [:create, :start]
end

Details

container resource can have following actions:

  • create default
  • destroy
  • start
  • stop

And following attributes

  • container_name name attribute, default to resource name
  • options a hash of action specific parameters

The options attribute can take following parameters (as hash)

  • for create action:
    • template: name of the template that will be used for creating the container (e.g. ubuntu, fedora, oracle etc). Default is ubuntu.
    • template_options: an array containing addiotional arguments that will be passed to template (use lxc-create -t foo --help to get the list of supported options for individual templates). Default is an empty array
    • block_device: The backing storage device (e.g lvm, zfs etc). Default is nil
    • flags: An integer flag passed to lxc-crate (currently only LXC::LXC_CREATE_QUIET is available)