Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

RSS

lxc (11) Versions 2.0.0

Chef driven Linux Containers

Berkshelf/Librarian
Policyfile
Knife
cookbook 'lxc', '~> 2.0.0'
cookbook 'lxc', '~> 2.0.0', :supermarket
knife cookbook site install lxc
knife cookbook site download lxc
README
Dependencies
Changelog
Quality 33%

LXC

Manage linux containers with Chef.

Note

Test this cookbook before applying to existing nodes. Lots of updates have been applied, and some tooling has been replaced. Also, rhel is working in a pretty hacky way, so use at your own risk. YOLO!

Recipes

default

Installs the packages and configuration files needed for lxc on the server. If the node uses apt-cacher-ng as a client, the server will be reused when building containers.

install_dependencies

Installs the packages needed to support lxc's containers.

containers

This recipe creates all of the containers defined in the ['lxc']['containers'] hash. Here is an example of an example container:

node['lxc']['containers']['example'] = {
  'template' => 'ubuntu',
  'initialize_commands' => ['apt-get update']
}

knife

Install and manage containers via the knife-remotelxc plugin.

package

Installs lxc packages

service

Configures lxc services

LWRPs

lxc

Allows for creation, deletion, and cloning of containers

lxc_config

Allows configuration of the LXC configuration file

lxc_fstab

Allows defining mounts to be used within the container

lxc_interface

Allows configurations of network interfaces within a container

lxc_ephemeral

Run a command within an ephemeral container

lxc_container

Creates a container using the lxc LWRP and configures the container as requested. This resource also allows nesting lxc_fstab and lxc_interface within the container resource.

Example

include_recipe 'lxc'

lxc_container 'my_container' do
  action :create
  validation_client 'my-validator'
  server_uri 'https://api.opscode.com/organizations/myorg'
  validator_pem content_from_encrypted_dbag
  run_list ['role[base]']
  chef_enabled true
  fstab_mount "Persist" do
    file_system '/opt/file_store'
    mount_point '/opt/file_store'
    type 'none'
    options 'bind,rw'
  end
end

lxc_container 'my_container_clone' do
  action :create
  clone 'my_container'
  chef_enabled true
end

lxc_service 'my_container_clone' do
  action :start
end

Containers do not have to be Chef enabled but it does make them extremely easy to configure. If you want the Omnibus installer cached, you can set the attribute

node['omnibus_updater']['cache_omnibus_installer'] = true

in a role or environment (default is false). The lxc_container resource also provides initialize_commands which an array of commands can be provided that will be run after the container is created.

Repository:

Contributors

v2.0.0

  • Remove apt-cacher. Use polipo.
  • Update network configurations
  • Remove dpkg options on package install
  • Only use apparmor helper on ubuntu
  • Set auto on all interfaces
  • Fix up container setup command checks
  • Set up hacky support on RHEL family (still needs cleanup)

v1.1.8

  • Bug fix release: Upgrades elecksee gem to 1.0.20 minimum (#45)

v1.1.6

  • Fix data bag secret copy (thanks @jbianquetti)
  • Support upstart based services (thanks @bkw)
  • Update minimum version for elecksee helper gem

v1.1.4

  • Use latest omnibus deb for chef install within containers
  • Apt cacher related fixes
  • Handful of bug fixes

v1.1.2

  • Update lxc package installation to accept existing configuration file
  • Add missing -n option in destroy action for LWRP (thanks @sanders)

v1.1.0

  • Use elecksee gem for Lxc interaction
  • Add ephemeral LWRP
  • Allow AppArmor configuration
  • Unset default container passwords
  • Allow nesting LWRPs
  • Use dpkg_autostart and config ordering to allow lxc installation on hosts with 10.0.0.x address space in use
  • Remove deprecated lxc-awesome-ephemeral script by default

v1.0.0

  • Extract container actions out to new LWRP lxc
  • Update container to use lxc resource for container actions
  • Update container to allow nested subresources for interface and fstab_mount
  • Fix interface LWRP to allow IPv6 based values
  • Remove static_ip config set as it was introducing bogus route
  • Provide assumed environment when not available (like when running via runit)
  • Make chef enabled containers properly idempotent
  • Clean up the container provider implementation to be more resource based
  • Add ephemeral LWRP
  • Add custom ephemeral script to allow host directory overlay or virtual block device
  • Patches execute resource to provide streaming output
  • Updates Lxc library to be more reusable
  • Add proc based network detection for more robust address discovery
  • Shell out directly to ssh for container commands instead of using knife ssh

v0.1.0

  • Abstracted out packages for cross-platform support later.
  • Added the 'containers' recipe to create containers for the members of the node['lxc']['containers'] hash
  • Add support for use of the apt::cacher-client settings if a proxy is in use.
  • chef_enabled defaults to false on lxc_containers
  • Better idempotency checks when building new containers
  • Refactoring of lxc_service
  • Container based commands run via knife::ssh providing proper logging feedback
  • New networking related attributes added to lxc_container for easy basic network setups

v0.0.3

  • Remove resource for deprecated template

v0.0.2

  • Cleanup current config and container LWRPs
  • Add new LWRPs (fstab and interface)
  • Add better configuration build to prevent false updates
  • Thanks to Sean Porter (https://github.com/portertech) for help debugging LWRP updates

v0.0.1

  • Initial release

Collaborator Number Metric
            

2.0.0 failed this metric

Failure: Cookbook has 0 collaborators. A cookbook must have at least 2 collaborators to pass this metric.

Contributing File Metric
            

2.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Foodcritic Metric
            

2.0.0 failed this metric

FC007: Ensure recipe dependencies are reflected in cookbook metadata: lxc/recipes/install_dependencies.rb:14
FC017: LWRP does not notify when updated: lxc/providers/config.rb:68
FC017: LWRP does not notify when updated: lxc/providers/container.rb:26
FC017: LWRP does not notify when updated: lxc/providers/container.rb:359
FC017: LWRP does not notify when updated: lxc/providers/default.rb:52
FC017: LWRP does not notify when updated: lxc/providers/fstab.rb:14
FC017: LWRP does not notify when updated: lxc/providers/interface.rb:19
FC021: Resource condition in provider may not behave as expected: lxc/providers/container.rb:110
FC021: Resource condition in provider may not behave as expected: lxc/providers/container.rb:260
FC022: Resource condition within loop may not behave as expected: lxc/providers/container.rb:176
FC047: Attribute assignment does not specify precedence: lxc/recipes/knife.rb:4
FC052: Metadata uses the deprecated "suggests" keyword: lxc/metadata.rb:9
FC052: Metadata uses the deprecated "suggests" keyword: lxc/metadata.rb:10
FC059: LWRP provider does not declare use_inline_resources: lxc/providers/config.rb:1
FC059: LWRP provider does not declare use_inline_resources: lxc/providers/container.rb:1
FC059: LWRP provider does not declare use_inline_resources: lxc/providers/default.rb:1
FC059: LWRP provider does not declare use_inline_resources: lxc/providers/fstab.rb:1
FC059: LWRP provider does not declare use_inline_resources: lxc/providers/interface.rb:1
FC059: LWRP provider does not declare use_inline_resources: lxc/providers/service.rb:1
FC064: Ensure issues_url is set in metadata: lxc/metadata.rb:1
FC065: Ensure source_url is set in metadata: lxc/metadata.rb:1
FC066: Ensure chef_version is set in metadata: lxc/metadata.rb:1
FC067: Ensure at least one platform supported in metadata: lxc/metadata.rb:1
FC069: Ensure standardized license defined in metadata: lxc/metadata.rb:1
FC104: Use the :run action in ruby_block instead of :create: lxc/providers/container.rb:247
Run with Foodcritic Version 12.2.1 with tags metadata,correctness ~FC031 ~FC045 and failure tags any

License Metric
            

2.0.0 passed this metric

No Binaries Metric
            

2.0.0 passed this metric

Publish Metric
            

2.0.0 passed this metric

Supported Platforms Metric
            

2.0.0 failed this metric

lxc should declare what platform(s) it supports.

Testing File Metric
            

2.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

2.0.0 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number