vagabond 0.2.8 → 0.2.10
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +16 -0
- data/DEVELOP.md +38 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +33 -0
- data/README.md +55 -21
- data/USAGE.md +28 -3
- data/Vagabondfile.sample +47 -0
- data/Vagrantfile +17 -5
- data/bin/vagabond +5 -0
- data/lib/vagabond/Cheffile +7 -0
- data/lib/vagabond/Cheffile.dev +7 -0
- data/lib/vagabond/actions/cluster.rb +22 -8
- data/lib/vagabond/actions/create.rb +7 -4
- data/lib/vagabond/actions/destroy.rb +24 -14
- data/lib/vagabond/actions/freeze.rb +1 -0
- data/lib/vagabond/actions/init.rb +8 -11
- data/lib/vagabond/actions/provision.rb +16 -8
- data/lib/vagabond/actions/rebuild.rb +4 -9
- data/lib/vagabond/actions/ssh.rb +9 -1
- data/lib/vagabond/actions/start.rb +1 -0
- data/lib/vagabond/actions/status.rb +1 -0
- data/lib/vagabond/actions/thaw.rb +1 -0
- data/lib/vagabond/actions/up.rb +22 -7
- data/lib/vagabond/bootstraps/chef_10_compat_config.erb +62 -0
- data/lib/vagabond/bootstraps/no_lazy_load.erb +63 -0
- data/lib/vagabond/bootstraps/server-zero.erb +1 -8
- data/lib/vagabond/bootstraps/server.erb +9 -6
- data/lib/vagabond/constants.rb +1 -6
- data/lib/vagabond/core.rb +209 -0
- data/lib/vagabond/errors.rb +3 -0
- data/lib/vagabond/helpers.rb +11 -99
- data/lib/vagabond/helpers/base.rb +134 -0
- data/lib/vagabond/helpers/callbacks.rb +47 -0
- data/lib/vagabond/helpers/chains.rb +23 -0
- data/lib/vagabond/helpers/commands.rb +49 -0
- data/lib/vagabond/helpers/knife.rb +47 -0
- data/lib/vagabond/helpers/naming.rb +39 -0
- data/lib/vagabond/helpers/server.rb +30 -0
- data/lib/vagabond/internal_configuration.rb +186 -32
- data/lib/vagabond/kitchen.rb +110 -60
- data/lib/vagabond/knife.rb +5 -1
- data/lib/vagabond/layout.rb +1 -0
- data/lib/vagabond/monkey/kitchen_config.rb +1 -0
- data/lib/vagabond/notify_mash.rb +25 -0
- data/lib/vagabond/server.rb +81 -49
- data/lib/vagabond/settings.rb +17 -0
- data/lib/vagabond/spec.rb +125 -99
- data/lib/vagabond/uploader.rb +4 -1
- data/lib/vagabond/uploader/berkshelf.rb +2 -1
- data/lib/vagabond/uploader/knife.rb +3 -9
- data/lib/vagabond/uploader/librarian.rb +2 -5
- data/lib/vagabond/vagabond.rb +77 -93
- data/lib/vagabond/vagabondfile.rb +73 -9
- data/lib/vagabond/version.rb +2 -1
- data/vagabond.gemspec +7 -5
- metadata +58 -81
- data/lib/vagabond/cookbooks/apt/Berksfile +0 -8
- data/lib/vagabond/cookbooks/apt/CHANGELOG.md +0 -97
- data/lib/vagabond/cookbooks/apt/CONTRIBUTING +0 -29
- data/lib/vagabond/cookbooks/apt/LICENSE +0 -201
- data/lib/vagabond/cookbooks/apt/README.md +0 -243
- data/lib/vagabond/cookbooks/apt/TESTING.md +0 -25
- data/lib/vagabond/cookbooks/apt/attributes/default.rb +0 -4
- data/lib/vagabond/cookbooks/apt/files/default/apt-proxy-v2.conf +0 -50
- data/lib/vagabond/cookbooks/apt/metadata.rb +0 -30
- data/lib/vagabond/cookbooks/apt/providers/preference.rb +0 -61
- data/lib/vagabond/cookbooks/apt/providers/repository.rb +0 -132
- data/lib/vagabond/cookbooks/apt/recipes/cacher-client.rb +0 -59
- data/lib/vagabond/cookbooks/apt/recipes/cacher-ng.rb +0 -40
- data/lib/vagabond/cookbooks/apt/recipes/default.rb +0 -68
- data/lib/vagabond/cookbooks/apt/resources/preference.rb +0 -30
- data/lib/vagabond/cookbooks/apt/resources/repository.rb +0 -40
- data/lib/vagabond/cookbooks/apt/templates/debian-6.0/acng.conf.erb +0 -174
- data/lib/vagabond/cookbooks/apt/templates/default/01proxy.erb +0 -2
- data/lib/vagabond/cookbooks/apt/templates/default/acng.conf.erb +0 -276
- data/lib/vagabond/cookbooks/apt/templates/ubuntu-10.04/acng.conf.erb +0 -270
- data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/README.md +0 -1
- data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/cacher-ng_test.rb +0 -28
- data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/default_test.rb +0 -28
- data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/lwrps_test.rb +0 -48
- data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/files/default/tests/minitest/support/helpers.rb +0 -29
- data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/metadata.rb +0 -6
- data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/recipes/cacher-ng.rb +0 -20
- data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/recipes/default.rb +0 -20
- data/lib/vagabond/cookbooks/apt/test/cookbooks/apt_test/recipes/lwrps.rb +0 -66
- data/lib/vagabond/cookbooks/lxc/CHANGELOG.md +0 -37
- data/lib/vagabond/cookbooks/lxc/Gemfile +0 -4
- data/lib/vagabond/cookbooks/lxc/Gemfile.lock +0 -41
- data/lib/vagabond/cookbooks/lxc/README.md +0 -112
- data/lib/vagabond/cookbooks/lxc/attributes/default.rb +0 -26
- data/lib/vagabond/cookbooks/lxc/files/default/knife_lxc +0 -228
- data/lib/vagabond/cookbooks/lxc/files/default/lxc-awesome-ephemeral +0 -499
- data/lib/vagabond/cookbooks/lxc/libraries/lxc.rb +0 -477
- data/lib/vagabond/cookbooks/lxc/libraries/lxc_expanded_resources.rb +0 -40
- data/lib/vagabond/cookbooks/lxc/libraries/lxc_file_config.rb +0 -84
- data/lib/vagabond/cookbooks/lxc/libraries/monkey.rb +0 -51
- data/lib/vagabond/cookbooks/lxc/metadata.rb +0 -12
- data/lib/vagabond/cookbooks/lxc/providers/config.rb +0 -75
- data/lib/vagabond/cookbooks/lxc/providers/container.rb +0 -354
- data/lib/vagabond/cookbooks/lxc/providers/default.rb +0 -57
- data/lib/vagabond/cookbooks/lxc/providers/ephemeral.rb +0 -40
- data/lib/vagabond/cookbooks/lxc/providers/fstab.rb +0 -30
- data/lib/vagabond/cookbooks/lxc/providers/interface.rb +0 -45
- data/lib/vagabond/cookbooks/lxc/providers/service.rb +0 -53
- data/lib/vagabond/cookbooks/lxc/recipes/containers.rb +0 -13
- data/lib/vagabond/cookbooks/lxc/recipes/default.rb +0 -58
- data/lib/vagabond/cookbooks/lxc/recipes/install_dependencies.rb +0 -15
- data/lib/vagabond/cookbooks/lxc/recipes/knife.rb +0 -37
- data/lib/vagabond/cookbooks/lxc/resources/config.rb +0 -19
- data/lib/vagabond/cookbooks/lxc/resources/container.rb +0 -54
- data/lib/vagabond/cookbooks/lxc/resources/default.rb +0 -12
- data/lib/vagabond/cookbooks/lxc/resources/ephemeral.rb +0 -13
- data/lib/vagabond/cookbooks/lxc/resources/fstab.rb +0 -12
- data/lib/vagabond/cookbooks/lxc/resources/interface.rb +0 -13
- data/lib/vagabond/cookbooks/lxc/resources/service.rb +0 -5
- data/lib/vagabond/cookbooks/lxc/templates/default/client.rb.erb +0 -13
- data/lib/vagabond/cookbooks/lxc/templates/default/default-lxc.erb +0 -3
- data/lib/vagabond/cookbooks/lxc/templates/default/file_content.erb +0 -2
- data/lib/vagabond/cookbooks/lxc/templates/default/fstab.erb +0 -5
- data/lib/vagabond/cookbooks/lxc/templates/default/interface.erb +0 -27
- data/lib/vagabond/cookbooks/vagabond/README.md +0 -10
- data/lib/vagabond/cookbooks/vagabond/attributes/default.rb +0 -18
- data/lib/vagabond/cookbooks/vagabond/files/default/lxc-centos +0 -460
- data/lib/vagabond/cookbooks/vagabond/libraries/vagabond.rb +0 -10
- data/lib/vagabond/cookbooks/vagabond/metadata.rb +0 -8
- data/lib/vagabond/cookbooks/vagabond/recipes/default.rb +0 -132
- data/lib/vagabond/cookbooks/vagabond/recipes/zero.rb +0 -9
- data/lib/vagabond/helpers/cheffile_loader.rb +0 -20
- data/vagabond-0.2.6.gem +0 -0
@@ -1,57 +0,0 @@
|
|
1
|
-
def load_current_resource
|
2
|
-
@lxc = ::Lxc.new(
|
3
|
-
new_resource.name,
|
4
|
-
:base_dir => node[:lxc][:container_directory],
|
5
|
-
:dnsmasq_lease_file => node[:lxc][:dnsmasq_lease_file]
|
6
|
-
)
|
7
|
-
end
|
8
|
-
|
9
|
-
action :create do
|
10
|
-
_lxc = @lxc
|
11
|
-
execute "LXC Create: #{new_resource.name}" do
|
12
|
-
command "lxc-create -n #{new_resource.name} -t #{new_resource.template} -- #{new_resource.template_opts.to_a.flatten.join(' ')}"
|
13
|
-
only_if do
|
14
|
-
!_lxc.exists? && new_resource.updated_by_last_action(true)
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
action :clone do
|
20
|
-
_lxc = @lxc
|
21
|
-
_base_lxc = ::Lxc.new(
|
22
|
-
new_resource.base_container,
|
23
|
-
:base_dir => node[:lxc][:container_directory],
|
24
|
-
:dnsmasq_lease_file => node[:lxc][:dnsmasq_lease_file]
|
25
|
-
)
|
26
|
-
|
27
|
-
unless(_base_lxc.exists?)
|
28
|
-
raise "LXC clone failed! Base container #{new_resource.base_container} does not exist. Cannot create #{new_resource.name}"
|
29
|
-
end
|
30
|
-
|
31
|
-
execute "LXC Clone: #{new_resource.base_container} -> #{new_resource.name}" do
|
32
|
-
command "lxc-clone -o #{new_resource.base_container} -n #{new_resource.name}"
|
33
|
-
only_if do
|
34
|
-
!_lxc.exists? && new_resource.updated_by_last_action(true)
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
|
40
|
-
action :delete do
|
41
|
-
_lxc = @lxc
|
42
|
-
ruby_block "Stop container #{new_resource.name}" do
|
43
|
-
block do
|
44
|
-
_lxc.shutdown
|
45
|
-
end
|
46
|
-
only_if do
|
47
|
-
_lxc.exists? && _lxc.running?
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
execute "Destroy container #{new_resource.name}" do
|
52
|
-
command "lxc-destroy #{new_resource.name}"
|
53
|
-
only_if do
|
54
|
-
_lxc.exists?
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
use_inline_resources if self.respond_to?(:use_inline_resources)
|
2
|
-
|
3
|
-
def load_current_resource
|
4
|
-
@lxc = ::Lxc.new(
|
5
|
-
new_resource.base_container,
|
6
|
-
:base_dir => node[:lxc][:container_directory],
|
7
|
-
:dnsmasq_lease_file => node[:lxc][:dnsmasq_lease_file]
|
8
|
-
)
|
9
|
-
unless(@lxc.exists?)
|
10
|
-
raise "Requested base contianer: #{new_resource.base_container} does not exist"
|
11
|
-
end
|
12
|
-
@start_script = node[:lxc][:awesome_ephemerals] ? '/usr/local/bin/lxc-awesome-ephemeral' : 'lxc-ephemeral-start'
|
13
|
-
unless(node[:lxc][:awesome_ephemerals])
|
14
|
-
%w(host_rootfs virtual_device).each do |key|
|
15
|
-
if(resource.send(key))
|
16
|
-
raise "#{key} lxc ephemeral attribute only valid when awesome_ephemerals is true!"
|
17
|
-
end
|
18
|
-
end
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
action :run do
|
23
|
-
com = [@start_script]
|
24
|
-
com << "-o #{new_resource.base_container}"
|
25
|
-
com << "-b #{new_resource.bind_directory}" if new_resource.bind_directory
|
26
|
-
com << "-U #{new_resource.union_type}"
|
27
|
-
com << "-u #{new_resource.user}"
|
28
|
-
com << "-S #{new_resource.key}"
|
29
|
-
com << "-z #{new_resource.host_rootfs}" if new_resource.host_rootfs
|
30
|
-
com << "-D #{new_resource.virtual_device}" if new_resource.virtual_device
|
31
|
-
if(new_resource.background)
|
32
|
-
Chef::Log.warn("Ephemeral container will be backgrounded: #{new_resource.name}")
|
33
|
-
com << '-d'
|
34
|
-
end
|
35
|
-
com << "\"#{new_resource.command}\"" # TODO: fix this to be proper
|
36
|
-
execute "LXC ephemeral: #{new_resource.name}" do
|
37
|
-
command com.join(' ')
|
38
|
-
stream_output new_resource.stream_output
|
39
|
-
end
|
40
|
-
end
|
@@ -1,30 +0,0 @@
|
|
1
|
-
def load_current_resource
|
2
|
-
if(new_resource.auto_join_rootfs_mount)
|
3
|
-
new_resource.mount_point(
|
4
|
-
::Lxc.new(new_resource.container).rootfs.join(
|
5
|
-
new_resource.mount_point
|
6
|
-
).to_path
|
7
|
-
)
|
8
|
-
end
|
9
|
-
node.run_state[:lxc] ||= Mash.new
|
10
|
-
node.run_state[:lxc][:fstabs] ||= Mash.new
|
11
|
-
node.run_state[:lxc][:fstabs][new_resource.container] ||= []
|
12
|
-
end
|
13
|
-
|
14
|
-
action :create do
|
15
|
-
|
16
|
-
line = "#{new_resource.file_system}\t#{new_resource.mount_point}\t" <<
|
17
|
-
"#{new_resource.type}\t#{Array(new_resource.options).join(',')}\t" <<
|
18
|
-
"#{new_resource.dump}\t#{new_resource.pass}"
|
19
|
-
|
20
|
-
if(new_resource.create_mount_point)
|
21
|
-
directory new_resource.mount_point do
|
22
|
-
recursive true
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
unless(node.run_state[:lxc][:fstabs][new_resource.container].include?(line))
|
27
|
-
node.run_state[:lxc][:fstabs][new_resource.container] << line
|
28
|
-
end
|
29
|
-
|
30
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
def load_current_resource
|
2
|
-
@lxc = ::Lxc.new(
|
3
|
-
new_resource.container,
|
4
|
-
:base_dir => node[:lxc][:container_directory],
|
5
|
-
:dnsmasq_lease_file => node[:lxc][:dnsmasq_lease_file]
|
6
|
-
)
|
7
|
-
@loaded ||= {}
|
8
|
-
# value checks
|
9
|
-
unless(new_resource.dynamic)
|
10
|
-
%w(address netmask).each do |key|
|
11
|
-
raise "#{key} is required for static interfaces" if new_resource.send(key).nil?
|
12
|
-
end
|
13
|
-
end
|
14
|
-
node.run_state[:lxc] ||= Mash.new
|
15
|
-
node.run_state[:lxc][:interfaces] ||= Mash.new
|
16
|
-
node.run_state[:lxc][:interfaces][new_resource.container] ||= []
|
17
|
-
end
|
18
|
-
|
19
|
-
action :create do
|
20
|
-
raise 'Device is required for creating an LXC interface!' unless new_resource.device
|
21
|
-
|
22
|
-
unless(@loaded[new_resource.container])
|
23
|
-
@loaded[new_resource.container] = true
|
24
|
-
end
|
25
|
-
|
26
|
-
net_set = Mash.new(:device => new_resource.device)
|
27
|
-
if(new_resource.dynamic)
|
28
|
-
net_set[:dynamic] = true
|
29
|
-
else
|
30
|
-
net_set[:auto] = new_resource.auto
|
31
|
-
net_set[:address] = new_resource.address
|
32
|
-
net_set[:gateway] = new_resource.gateway
|
33
|
-
net_set[:netmask] = new_resource.netmask
|
34
|
-
net_set[:up] = new_resource.up if new_resource.up
|
35
|
-
net_set[:down] = new_resource.down if new_resource.down
|
36
|
-
net_set[:ipv6] = new_resource.ipv6
|
37
|
-
end
|
38
|
-
|
39
|
-
node.run_state[:lxc][:interfaces][new_resource.container] << net_set
|
40
|
-
end
|
41
|
-
|
42
|
-
action :delete do
|
43
|
-
# do nothing, simply not provided to run_state, and thus implicitly
|
44
|
-
# deleted
|
45
|
-
end
|
@@ -1,53 +0,0 @@
|
|
1
|
-
def load_current_resource
|
2
|
-
@lxc = ::Lxc.new(
|
3
|
-
new_resource.name,
|
4
|
-
:base_dir => node[:lxc][:container_directory],
|
5
|
-
:dnsmasq_lease_file => node[:lxc][:dnsmasq_lease_file]
|
6
|
-
)
|
7
|
-
if(new_resource.service_name.to_s.empty?)
|
8
|
-
new_resource.service_name new_resource.name
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
action :start do
|
13
|
-
if(@lxc.stopped?)
|
14
|
-
@lxc.start
|
15
|
-
new_resource.updated_by_last_action(true)
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
action :halt do
|
20
|
-
if(@lxc.running?)
|
21
|
-
@lxc.stop
|
22
|
-
new_resource.updated_by_last_action(true)
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
action :restart do
|
27
|
-
if(@lxc.running?)
|
28
|
-
@lxc.shutdown
|
29
|
-
end
|
30
|
-
@lxc.start
|
31
|
-
new_resource.updated_by_last_action(true)
|
32
|
-
end
|
33
|
-
|
34
|
-
action :stop do
|
35
|
-
if(@lxc.running?)
|
36
|
-
@lxc.stop
|
37
|
-
new_resource.updated_by_last_action(true)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
action :freeze do
|
42
|
-
if(@lxc.running?)
|
43
|
-
@lxc.freeze
|
44
|
-
new_resource.updated_by_last_action(true)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
action :unfreeze do
|
49
|
-
if(@lxc.frozen?)
|
50
|
-
@lxc.unfreeze
|
51
|
-
new_resource.updated_by_last_action(true)
|
52
|
-
end
|
53
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# create the containers defined in the ['lxc']['containers'] hash
|
2
|
-
|
3
|
-
include_recipe "lxc"
|
4
|
-
|
5
|
-
node['lxc']['containers'].each do | name, container |
|
6
|
-
Chef::Log.info "Creating LXC container name:#{name}"
|
7
|
-
lxc_container name do
|
8
|
-
container.each do |meth, param|
|
9
|
-
self.send(meth, param)
|
10
|
-
end
|
11
|
-
action :create unless container.has_key?(:action)
|
12
|
-
end
|
13
|
-
end
|
@@ -1,58 +0,0 @@
|
|
1
|
-
# install the server dependencies to run lxc
|
2
|
-
node[:lxc][:packages].each do |lxcpkg|
|
3
|
-
package lxcpkg
|
4
|
-
end
|
5
|
-
|
6
|
-
include_recipe 'lxc::install_dependencies'
|
7
|
-
|
8
|
-
directory '/usr/local/bin' do
|
9
|
-
recursive true
|
10
|
-
end
|
11
|
-
|
12
|
-
cookbook_file '/usr/local/bin/lxc-awesome-ephemeral' do
|
13
|
-
source 'lxc-awesome-ephemeral'
|
14
|
-
mode 0755
|
15
|
-
end
|
16
|
-
|
17
|
-
#if the server uses the apt::cacher-client recipe, re-use it
|
18
|
-
unless Chef::Config[:solo]
|
19
|
-
if File.exists?('/etc/apt/apt.conf.d/01proxy')
|
20
|
-
query = 'recipes:apt\:\:cacher-ng'
|
21
|
-
query += " AND chef_environment:#{node.chef_environment}" if node['apt']['cacher-client']['restrict_environment']
|
22
|
-
Chef::Log.debug("apt::cacher-client searching for '#{query}'")
|
23
|
-
servers = search(:node, query)
|
24
|
-
if servers.length > 0
|
25
|
-
Chef::Log.info("apt-cacher-ng server found on #{servers[0]}.")
|
26
|
-
node.default[:lxc][:mirror] = "http://#{servers[0]['ipaddress']}:3142/archive.ubuntu.com/ubuntu"
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
template '/etc/default/lxc' do
|
32
|
-
source 'default-lxc.erb'
|
33
|
-
mode 0644
|
34
|
-
variables(
|
35
|
-
:config => {
|
36
|
-
:lxc_auto => node[:lxc][:auto_start],
|
37
|
-
:use_lxc_bridge => node[:lxc][:use_bridge],
|
38
|
-
:lxc_bridge => node[:lxc][:bridge],
|
39
|
-
:lxc_addr => node[:lxc][:addr],
|
40
|
-
:lxc_netmask => node[:lxc][:netmask],
|
41
|
-
:lxc_network => node[:lxc][:network],
|
42
|
-
:lxc_dhcp_range => node[:lxc][:dhcp_range],
|
43
|
-
:lxc_dhcp_max => node[:lxc][:dhcp_max],
|
44
|
-
:lxc_shutdown_timeout => node[:lxc][:shutdown_timeout],
|
45
|
-
:mirror => node[:lxc][:mirror]
|
46
|
-
}
|
47
|
-
)
|
48
|
-
end
|
49
|
-
|
50
|
-
# this just reloads the dnsmasq rules when the template is adjusted
|
51
|
-
service 'lxc-net' do
|
52
|
-
action [:enable]
|
53
|
-
subscribes :restart, resources("template[/etc/default/lxc]"), :immediately
|
54
|
-
end
|
55
|
-
|
56
|
-
service 'lxc' do
|
57
|
-
action [:enable, :start]
|
58
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
# Fedora allowed? Needs yum and curl to download packages
|
2
|
-
if node[:lxc][:allowed_types].include?('fedora')
|
3
|
-
['yum', 'curl'].each do |pkg|
|
4
|
-
package pkg
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
# OpenSuse allowed? Needs zypper (no package available yet!)
|
9
|
-
# package 'zypper' if node[:lxc][:allowed_types].include?('opensuse')
|
10
|
-
raise 'OpenSuse not currently supported' if node[:lxc][:allowed_types].include?('opensuse')
|
11
|
-
|
12
|
-
#store a copy of the Omnibus installer for use by the lxc containers
|
13
|
-
if(node[:omnibus_updater] && node[:omnibus_updater][:cache_omnibus_installer])
|
14
|
-
include_recipe 'omnibus_updater::downloader'
|
15
|
-
end
|
@@ -1,37 +0,0 @@
|
|
1
|
-
include_recipe 'lxc'
|
2
|
-
|
3
|
-
# This shuts down the default lxcbr0
|
4
|
-
node[:lxc][:use_bridge] = false
|
5
|
-
service 'lxc' do
|
6
|
-
action :stop
|
7
|
-
end
|
8
|
-
|
9
|
-
directory '/etc/knife-lxc' do
|
10
|
-
action :create
|
11
|
-
mode 0755
|
12
|
-
end
|
13
|
-
|
14
|
-
file '/etc/knife-lxc/config.json' do
|
15
|
-
mode 0644
|
16
|
-
content(
|
17
|
-
JSON.pretty_generate(
|
18
|
-
:addresses => {
|
19
|
-
:static => node[:lxc][:knife][:static_ips],
|
20
|
-
:range => node[:lxc][:knife][:static_range]
|
21
|
-
}
|
22
|
-
)
|
23
|
-
)
|
24
|
-
end
|
25
|
-
|
26
|
-
cookbook_file '/usr/local/bin/knife_lxc' do
|
27
|
-
source 'knife_lxc'
|
28
|
-
mode 0755
|
29
|
-
end
|
30
|
-
|
31
|
-
node[:lxc][:allowed_types].each do |type|
|
32
|
-
lxc_container "#{type}_base" do
|
33
|
-
template type
|
34
|
-
chef_enabled false
|
35
|
-
action :create
|
36
|
-
end
|
37
|
-
end
|
@@ -1,19 +0,0 @@
|
|
1
|
-
actions :create, :delete
|
2
|
-
default_action :create
|
3
|
-
|
4
|
-
attribute :utsname, :kind_of => String, :default => nil # defaults to resource name
|
5
|
-
attribute :aa_profile, :kind_of => String, :default => nil # platform specific?
|
6
|
-
attribute :network, :kind_of => [Array, Hash]
|
7
|
-
attribute :default_bridge, :kind_of => String
|
8
|
-
attribute :static_ip, :kind_of => String
|
9
|
-
attribute :pts, :kind_of => Numeric, :default => 1024
|
10
|
-
attribute :tty, :kind_of => Numeric, :default => 4
|
11
|
-
attribute :arch, :kind_of => String, :default => 'amd64'
|
12
|
-
attribute :devttydir, :kind_of => String, :default => 'lxc'
|
13
|
-
attribute :cgroup, :kind_of => Hash, :default => Mash.new
|
14
|
-
attribute :cap_drop, :kind_of => [String, Array], :default => %w(sys_module mac_admin)
|
15
|
-
attribute :mount, :kind_of => String
|
16
|
-
attribute :mount_entry, :kind_of => String
|
17
|
-
attribute :rootfs, :kind_of => [String,Pathname]
|
18
|
-
attribute :rootfs_mount, :kind_of => String
|
19
|
-
attribute :pivotdir, :kind_of => String
|
@@ -1,54 +0,0 @@
|
|
1
|
-
def initialize(*args)
|
2
|
-
@subresources = []
|
3
|
-
super
|
4
|
-
end
|
5
|
-
|
6
|
-
actions :create, :delete
|
7
|
-
default_action :create
|
8
|
-
|
9
|
-
attribute :validation_client, :kind_of => String
|
10
|
-
attribute :validator_pem, :kind_of => String, :default => nil
|
11
|
-
attribute :server_uri, :kind_of => String
|
12
|
-
attribute :chef_environment, :kind_of => String, :default => '_default'
|
13
|
-
attribute :node_name, :kind_of => String
|
14
|
-
attribute :run_list, :kind_of => Array
|
15
|
-
attribute :chef_enabled, :kind_of => [TrueClass, FalseClass], :default => false
|
16
|
-
attribute :chef_retries, :kind_of => Fixnum, :default => 0
|
17
|
-
attribute :copy_data_bag_secret_file, :kind_of => [TrueClass, FalseClass], :default => false
|
18
|
-
attribute :data_bag_secret_file, :kind_of => String, :default => Chef::EncryptedDataBagItem::DEFAULT_SECRET_FILE
|
19
|
-
attribute :default_bridge, :kind_of => String
|
20
|
-
attribute :static_ip, :kind_of => String
|
21
|
-
attribute :static_netmask, :kind_of => String, :default => '255.255.255.0'
|
22
|
-
attribute :static_gateway, :kind_of => String
|
23
|
-
attribute :default_config, :kind_of => [TrueClass, FalseClass], :default => true
|
24
|
-
attribute :default_fstab, :kind_of => [TrueClass, FalseClass], :default => true
|
25
|
-
attribute :container_commands, :kind_of => Array, :default => []
|
26
|
-
attribute :initialize_commands, :kind_of => Array, :default => []
|
27
|
-
attribute :clone, :kind_of => String
|
28
|
-
attribute :template, :kind_of => String, :default => 'ubuntu'
|
29
|
-
attribute :template_opts, :kind_of => Hash, :default => {}
|
30
|
-
attribute :create_environment, :kind_of => Hash, :default => {}
|
31
|
-
|
32
|
-
def fstab_mount(fname, &block)
|
33
|
-
fstab = Chef::Resource::LxcFstab.new("lxc_fstab[#{self.name} - #{fname}]", nil)
|
34
|
-
fstab.action :nothing
|
35
|
-
fstab.container self.name
|
36
|
-
|
37
|
-
@subresources << [fstab, block]
|
38
|
-
end
|
39
|
-
|
40
|
-
def interface(iname, &block)
|
41
|
-
iface = Chef::Resource::LxcInterface.new("lxc_interface[#{self.name} - #{iname}]", nil)
|
42
|
-
iface.container self.name
|
43
|
-
iface.action :nothing
|
44
|
-
@subresources << [iface, block]
|
45
|
-
end
|
46
|
-
|
47
|
-
def config(cname, &block)
|
48
|
-
conf = Chef::Resource::LxcConfig.new("lxc_config[#{self.name} - #{cname}]", nil)
|
49
|
-
conf.container self.name
|
50
|
-
conf.action :nothing
|
51
|
-
@subresources << [conf, block]
|
52
|
-
end
|
53
|
-
|
54
|
-
attr_reader :subresources
|
@@ -1,12 +0,0 @@
|
|
1
|
-
actions :create, :delete, :clone
|
2
|
-
default_action :create
|
3
|
-
|
4
|
-
attribute :template, :kind_of => String, :default => 'ubuntu'
|
5
|
-
attribute :template_opts, :kind_of => Hash, :default => {}
|
6
|
-
attribute :base_container, :kind_of => String
|
7
|
-
|
8
|
-
# Backing store options. Not yet in use
|
9
|
-
attribute :fstype, :kind_of => String, :default => 'ext4'
|
10
|
-
attribute :fssize, :kind_of => String, :default => '2G'
|
11
|
-
attribute :vgname, :kind_of => String
|
12
|
-
attribute :lvname, :kind_of => String
|