Sha256: 2677c0ce60e182e471f3c106d30c64dc28f02ce6fe698dc7e84cb8b5ffb151b3

Contents?: true

Size: 1.45 KB

Versions: 4

Compression:

Stored size: 1.45 KB

Contents

# install the server dependencies to run lxc
node[:lxc][:packages].each do |lxcpkg|
  package lxcpkg
end

include_recipe 'lxc::install_dependencies'

#if the server uses the apt::cacher-client recipe, re-use it
unless Chef::Config[:solo]
  if File.exists?('/etc/apt/apt.conf.d/01proxy')
    query = 'recipes:apt\:\:cacher-ng'
    query += " AND chef_environment:#{node.chef_environment}" if node['apt']['cacher-client']['restrict_environment']
    Chef::Log.debug("apt::cacher-client searching for '#{query}'")
    servers = search(:node, query)
    if servers.length > 0
      Chef::Log.info("apt-cacher-ng server found on #{servers[0]}.")
      node.default[:lxc][:mirror] = "http://#{servers[0]['ipaddress']}:3142/archive.ubuntu.com/ubuntu"
    end
  end
end

template '/etc/default/lxc' do
  source 'default-lxc.erb'
  mode 0644
  variables(
    :config => {
      :lxc_auto => node[:lxc][:auto_start],
      :use_lxc_bridge => node[:lxc][:use_bridge],
      :lxc_bridge => node[:lxc][:bridge],
      :lxc_addr => node[:lxc][:addr],
      :lxc_netmask => node[:lxc][:netmask],
      :lxc_network => node[:lxc][:network],
      :lxc_dhcp_range => node[:lxc][:dhcp_range],
      :lxc_dhcp_max => node[:lxc][:dhcp_max],
      :lxc_shutdown_timeout => node[:lxc][:shutdown_timeout],
      :mirror => node[:lxc][:mirror]
    }
  )
end

#this just reloads the dnsmasq rules when
service "lxc-net" do
  action :enable
  subscribes :restart, resources("template[/etc/default/lxc]")
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
vagabond-0.2.0 lib/vagabond/cookbooks/lxc/recipes/default.rb
vagabond-0.1.4 lib/vagabond/cookbooks/lxc/recipes/default.rb
vagabond-0.1.2 lib/vagabond/cookbooks/lxc/recipes/default.rb
vagabond-0.1.0 lib/vagabond/cookbooks/lxc/recipes/default.rb