vagabond 0.2.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +18 -0
- data/README.md +125 -4
- data/bin/vagabond +43 -16
- data/lib/vagabond/actions/cluster.rb +66 -0
- data/lib/vagabond/actions/create.rb +12 -7
- data/lib/vagabond/actions/destroy.rb +69 -15
- data/lib/vagabond/actions/init.rb +75 -0
- data/lib/vagabond/actions/provision.rb +4 -2
- data/lib/vagabond/actions/status.rb +33 -22
- data/lib/vagabond/actions/up.rb +8 -1
- data/lib/vagabond/bootstraps/server-zero.erb +20 -0
- data/lib/vagabond/bootstraps/server.erb +3 -2
- data/lib/vagabond/constants.rb +0 -15
- data/lib/vagabond/cookbooks/lxc/CHANGELOG.md +16 -0
- data/lib/vagabond/cookbooks/lxc/Gemfile +3 -2
- data/lib/vagabond/cookbooks/lxc/Gemfile.lock +30 -121
- data/lib/vagabond/cookbooks/lxc/README.md +43 -14
- data/lib/vagabond/cookbooks/lxc/attributes/default.rb +3 -3
- data/lib/vagabond/cookbooks/lxc/files/default/lxc-awesome-ephemeral +499 -0
- data/lib/vagabond/cookbooks/lxc/libraries/lxc.rb +223 -58
- data/lib/vagabond/cookbooks/lxc/libraries/lxc_file_config.rb +3 -0
- data/lib/vagabond/cookbooks/lxc/libraries/monkey.rb +51 -0
- data/lib/vagabond/cookbooks/lxc/metadata.rb +6 -5
- data/lib/vagabond/cookbooks/lxc/providers/config.rb +9 -16
- data/lib/vagabond/cookbooks/lxc/providers/container.rb +241 -229
- data/lib/vagabond/cookbooks/lxc/providers/default.rb +57 -0
- data/lib/vagabond/cookbooks/lxc/providers/ephemeral.rb +40 -0
- data/lib/vagabond/cookbooks/lxc/providers/fstab.rb +13 -54
- data/lib/vagabond/cookbooks/lxc/providers/interface.rb +13 -67
- data/lib/vagabond/cookbooks/lxc/providers/service.rb +14 -14
- data/lib/vagabond/cookbooks/lxc/recipes/default.rb +17 -4
- data/lib/vagabond/cookbooks/lxc/recipes/install_dependencies.rb +1 -1
- data/lib/vagabond/cookbooks/lxc/resources/config.rb +2 -2
- data/lib/vagabond/cookbooks/lxc/resources/container.rb +31 -6
- data/lib/vagabond/cookbooks/lxc/resources/default.rb +12 -0
- data/lib/vagabond/cookbooks/lxc/resources/ephemeral.rb +13 -0
- data/lib/vagabond/cookbooks/lxc/resources/fstab.rb +2 -1
- data/lib/vagabond/cookbooks/lxc/resources/interface.rb +6 -3
- data/lib/vagabond/cookbooks/lxc/resources/service.rb +1 -1
- data/lib/vagabond/cookbooks/lxc/templates/default/file_content.erb +2 -0
- data/lib/vagabond/cookbooks/lxc/templates/default/interface.erb +9 -3
- data/lib/vagabond/cookbooks/vagabond/README.md +10 -0
- data/lib/vagabond/cookbooks/vagabond/attributes/default.rb +1 -0
- data/lib/vagabond/cookbooks/vagabond/files/default/lxc-centos +13 -6
- data/lib/vagabond/cookbooks/vagabond/metadata.rb +1 -0
- data/lib/vagabond/cookbooks/vagabond/recipes/default.rb +46 -4
- data/lib/vagabond/cookbooks/vagabond/recipes/zero.rb +9 -0
- data/lib/vagabond/errors.rb +23 -0
- data/lib/vagabond/helpers.rb +41 -14
- data/lib/vagabond/internal_configuration.rb +120 -27
- data/lib/vagabond/kitchen.rb +143 -63
- data/lib/vagabond/knife.rb +8 -5
- data/lib/vagabond/layout.rb +16 -0
- data/lib/vagabond/monkey/kitchen_config.rb +23 -0
- data/lib/vagabond/server.rb +79 -63
- data/lib/vagabond/spec.rb +345 -0
- data/lib/vagabond/uploader.rb +30 -0
- data/lib/vagabond/uploader/berkshelf.rb +53 -0
- data/lib/vagabond/uploader/knife.rb +24 -0
- data/lib/vagabond/uploader/librarian.rb +31 -0
- data/lib/vagabond/vagabond.rb +30 -11
- data/lib/vagabond/vagabondfile.rb +40 -5
- data/lib/vagabond/version.rb +1 -1
- data/vagabond.gemspec +5 -2
- metadata +75 -15
- data/lib/vagabond/cookbooks/lxc/resources/#container.rb# +0 -28
- data/lib/vagabond/cookbooks/lxc/test/kitchen/Kitchenfile +0 -7
- data/lib/vagabond/cookbooks/lxc/test/kitchen/cookbooks/lxc_test/metadata.rb +0 -2
- data/lib/vagabond/cookbooks/lxc/test/kitchen/cookbooks/lxc_test/recipes/centos_lxc.rb +0 -0
- data/lib/vagabond/cookbooks/lxc/test/kitchen/cookbooks/lxc_test/recipes/chef-bootstrap.rb +0 -0
- data/lib/vagabond/cookbooks/lxc/test/kitchen/cookbooks/lxc_test/recipes/lxc_files.rb +0 -0
- data/lib/vagabond/cookbooks/lxc/test/kitchen/cookbooks/lxc_test/recipes/lxc_templates.rb +0 -0
- data/lib/vagabond/cookbooks/lxc/test/kitchen/cookbooks/lxc_test/recipes/ubuntu_lxc.rb +0 -0
@@ -0,0 +1,75 @@
|
|
1
|
+
module Vagabond
|
2
|
+
module Actions
|
3
|
+
module Init
|
4
|
+
class << self
|
5
|
+
def included(klass)
|
6
|
+
klass.class_eval do
|
7
|
+
class << self
|
8
|
+
def _init_desc
|
9
|
+
['init', 'initialize the Vagabondfile and setup LXC if needed.']
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def _init
|
17
|
+
do_init
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def empty_vagabondfile_hash
|
23
|
+
require 'chef/node'
|
24
|
+
node = Chef::Node.new
|
25
|
+
node.from_file(
|
26
|
+
File.join(
|
27
|
+
File.dirname(__FILE__),
|
28
|
+
'../cookbooks/vagabond/attributes/default.rb'
|
29
|
+
)
|
30
|
+
)
|
31
|
+
nodes = {}
|
32
|
+
node[:vagabond][:bases].keys.each do |template|
|
33
|
+
answer = nil
|
34
|
+
until(%w(n y).include?(answer))
|
35
|
+
answer = ui.ask_question("Include template: #{template} ", :default => 'y').downcase
|
36
|
+
end
|
37
|
+
if(answer.downcase == 'y')
|
38
|
+
ui.info "Enabling template #{template} with node name #{template.gsub('_', '')}"
|
39
|
+
nodes[template.gsub('_', '').to_sym] = {
|
40
|
+
:template => template,
|
41
|
+
:run_list => []
|
42
|
+
}
|
43
|
+
else
|
44
|
+
ui.warn "Skipping instance for template #{template}"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
{
|
48
|
+
:nodes => nodes,
|
49
|
+
:clusters => {},
|
50
|
+
:local_chef_server => {
|
51
|
+
:zero => false,
|
52
|
+
:berkshelf => false,
|
53
|
+
:librarian => false,
|
54
|
+
:enabled => false,
|
55
|
+
:auto_upload => true
|
56
|
+
},
|
57
|
+
:sudo => true
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
def do_init
|
62
|
+
if(File.exists?(vagabondfile.path))
|
63
|
+
ui.confirm('Overwrite existing Vagabondfile', true)
|
64
|
+
ui.info 'Overwriting existing Vagabondfile'
|
65
|
+
end
|
66
|
+
require 'pp'
|
67
|
+
File.open(vagabondfile.path, 'w') do |file|
|
68
|
+
file.write(empty_vagabondfile_hash.pretty_inspect)
|
69
|
+
end
|
70
|
+
@vagabondfile.load_configuration!
|
71
|
+
@internal_config = InternalConfiguration.new(@vagabondfile, ui, options)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -29,10 +29,12 @@ module Vagabond
|
|
29
29
|
debug(com)
|
30
30
|
# Send the live stream out since people will generally want to
|
31
31
|
# know what's happening
|
32
|
-
cmd = Mixlib::ShellOut.new(com, :live_stream => STDOUT)
|
32
|
+
cmd = Mixlib::ShellOut.new(com, :live_stream => STDOUT, :timeout => 2000)
|
33
33
|
cmd.run_command
|
34
34
|
# NOTE: cmd.status.success? won't be valid, so check for FATAL
|
35
|
-
|
35
|
+
# TODO: This isn't really the best check, but should be good
|
36
|
+
# enough for now
|
37
|
+
unless(cmd.stdout.include?('FATAL: Stacktrace'))
|
36
38
|
ui.info ui.color(' -> PROVISIONED', :magenta)
|
37
39
|
true
|
38
40
|
else
|
@@ -18,14 +18,25 @@ module Vagabond
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def _status
|
21
|
-
|
21
|
+
status = [
|
22
|
+
ui.color('Name', :bold),
|
23
|
+
ui.color('State', :bold),
|
24
|
+
ui.color('PID', :bold),
|
25
|
+
ui.color('IP', :bold)
|
26
|
+
]
|
22
27
|
if(name)
|
23
|
-
status_for(name)
|
28
|
+
status += status_for(name)
|
24
29
|
else
|
25
|
-
(
|
26
|
-
|
30
|
+
if(self.is_a?(Vagabond))
|
31
|
+
names = (Array(vagabondfile[:boxes].keys) | Array(internal_config[mappings_key].keys))
|
32
|
+
else
|
33
|
+
names = Array(internal_config[mappings_key].keys)
|
34
|
+
end
|
35
|
+
names.sort.each do |n|
|
36
|
+
status += status_for(n)
|
27
37
|
end
|
28
38
|
end
|
39
|
+
puts ui.list(status, :uneven_columns_across, 4)
|
29
40
|
end
|
30
41
|
|
31
42
|
private
|
@@ -35,27 +46,27 @@ module Vagabond
|
|
35
46
|
state = nil
|
36
47
|
status = []
|
37
48
|
if(Lxc.exists?(m_name))
|
38
|
-
@lxc = Lxc.new(m_name) unless lxc.name == m_name
|
49
|
+
@lxc = Lxc.new(m_name) unless defined?(lxc) && lxc.name == m_name
|
39
50
|
info = Lxc.info(m_name)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
51
|
+
case info[:state]
|
52
|
+
when :running
|
53
|
+
color = :green
|
54
|
+
when :frozen
|
55
|
+
color = :blue
|
56
|
+
when :stopped
|
57
|
+
color = :yellow
|
58
|
+
else
|
59
|
+
color = :red
|
60
|
+
end
|
61
|
+
status << ui.color(c_name, color)
|
62
|
+
status << (info[:state] || 'N/A').to_s
|
63
|
+
status << (info[:pid] == -1 ? 'N/A' : info[:pid]).to_s
|
64
|
+
status << (@lxc.container_ip || 'unknown')
|
52
65
|
else
|
53
|
-
color
|
54
|
-
|
55
|
-
ui.info ui.color(" #{c_name}: #{state || "Not currently created\n"}", color)
|
56
|
-
unless(status.empty?)
|
57
|
-
ui.info(status.map{|s| " #{s}"}.join("\n").chomp)
|
66
|
+
status << ui.color(c_name, :red)
|
67
|
+
status += ['N/A'] * 3
|
58
68
|
end
|
69
|
+
status
|
59
70
|
end
|
60
71
|
end
|
61
72
|
end
|
data/lib/vagabond/actions/up.rb
CHANGED
@@ -23,10 +23,17 @@ module Vagabond
|
|
23
23
|
lxc.start
|
24
24
|
ui.info ui.color(' -> STARTED', :green)
|
25
25
|
end
|
26
|
+
end
|
27
|
+
if(options[:parallel])
|
28
|
+
@threads[:up] ||= []
|
29
|
+
@threads[:up] << Thread.new do
|
30
|
+
_create
|
31
|
+
do_provision if options[:auto_provision]
|
32
|
+
end
|
26
33
|
else
|
27
34
|
_create
|
35
|
+
do_provision if options[:auto_provision]
|
28
36
|
end
|
29
|
-
do_provision if options[:auto_provision]
|
30
37
|
end
|
31
38
|
|
32
39
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
bash -c '
|
2
|
+
|
3
|
+
apt-get install -y -q wget
|
4
|
+
|
5
|
+
mkdir -p /var/chef/cookbooks/vagabond
|
6
|
+
mkdir -p /var/chef/cookbooks/lxc
|
7
|
+
wget -qO- https://github.com/chrisroberts/chef-vagabond/tarball/master | tar xvzC /var/chef/cookbooks/vagabond --strip-components=1
|
8
|
+
wget -qO- https://github.com/hw-cookbooks/lxc/tarball/master | tar xvzC /var/chef/cookbooks/lxc --strip-components=1
|
9
|
+
|
10
|
+
(
|
11
|
+
echo "
|
12
|
+
{
|
13
|
+
\"run_list\": [ \"recipe[vagabond::zero]\" ]
|
14
|
+
}
|
15
|
+
"
|
16
|
+
) > /tmp/chef-server.json
|
17
|
+
|
18
|
+
chef-solo -j /tmp/chef-server.json
|
19
|
+
|
20
|
+
'
|
@@ -1,7 +1,5 @@
|
|
1
1
|
bash -c '
|
2
|
-
|
3
2
|
apt-get install -y -q wget
|
4
|
-
curl -L https://www.opscode.com/chef/install.sh | sudo bash
|
5
3
|
mkdir -p /var/chef/cache /var/chef/cookbooks/chef-server /var/chef/cookbooks/chef-server-populator
|
6
4
|
wget -qO- https://github.com/opscode-cookbooks/chef-server/archive/master.tar.gz | tar xvzC /var/chef/cookbooks/chef-server --strip-components=1
|
7
5
|
wget -qO- https://github.com/hw-cookbooks/chef-server-populator/tarball/master | tar xvzC /var/chef/cookbooks/chef-server-populator --strip-components=1
|
@@ -36,6 +34,9 @@ echo "
|
|
36
34
|
\"chef_server_webui\": {
|
37
35
|
\"enable\": false
|
38
36
|
}
|
37
|
+
},
|
38
|
+
\"erchef\": {
|
39
|
+
\"s3_url_ttl\": 3600
|
39
40
|
}
|
40
41
|
},
|
41
42
|
\"chef_server_populator\": {
|
data/lib/vagabond/constants.rb
CHANGED
@@ -18,19 +18,4 @@ module Vagabond
|
|
18
18
|
:destroyed => :red,
|
19
19
|
:kitchen => [:cyan, :bold]
|
20
20
|
)
|
21
|
-
|
22
|
-
EXIT_CODES = Mash.new(
|
23
|
-
:success => 0,
|
24
|
-
:reserved_name => 1,
|
25
|
-
:invalid_name => 2,
|
26
|
-
:invalid_base_template => 3,
|
27
|
-
:invalid_action => 4,
|
28
|
-
:invalid_template => 5,
|
29
|
-
:kitchen_missing_yml => 6,
|
30
|
-
:kitchen_no_cookbook_arg => 7,
|
31
|
-
:kitchen_too_many_args => 8,
|
32
|
-
:kitchen_invalid_platform => 9,
|
33
|
-
:missing_node_name => 10,
|
34
|
-
:cluster_invalid => 11
|
35
|
-
)
|
36
21
|
end
|
@@ -1,3 +1,19 @@
|
|
1
|
+
## v1.0.0
|
2
|
+
* Extract container actions out to new LWRP `lxc`
|
3
|
+
* Update `container` to use `lxc` resource for container actions
|
4
|
+
* Update `container` to allow nested subresources for `interface` and `fstab_mount`
|
5
|
+
* Fix `interface` LWRP to allow IPv6 based values
|
6
|
+
* Remove static_ip config set as it was introducing bogus route
|
7
|
+
* Provide assumed environment when not available (like when running via runit)
|
8
|
+
* Make chef enabled containers properly idempotent
|
9
|
+
* Clean up the `container` provider implementation to be more resource based
|
10
|
+
* Add `ephemeral` LWRP
|
11
|
+
* Add custom ephemeral script to allow host directory overlay or virtual block device
|
12
|
+
* Patches execute resource to provide streaming output
|
13
|
+
* Updates Lxc library to be more reusable
|
14
|
+
* Add proc based network detection for more robust address discovery
|
15
|
+
* Shell out directly to ssh for container commands instead of using knife ssh
|
16
|
+
|
1
17
|
## v0.1.0
|
2
18
|
* Abstracted out packages for cross-platform support later.
|
3
19
|
* Added the 'containers' recipe to create containers for the members of the node['lxc']['containers'] hash
|
@@ -1,132 +1,41 @@
|
|
1
|
-
|
2
|
-
remote:
|
1
|
+
GIT
|
2
|
+
remote: git://github.com/opscode/test-kitchen.git
|
3
|
+
revision: ab1b878561e896c0619a780d168e71addff2ad91
|
4
|
+
branch: 1.0
|
3
5
|
specs:
|
4
|
-
|
5
|
-
|
6
|
-
bunny (0.7.9)
|
7
|
-
chef (10.18.2)
|
8
|
-
bunny (>= 0.6.0, < 0.8.0)
|
9
|
-
erubis
|
10
|
-
highline (>= 1.6.9)
|
11
|
-
json (>= 1.4.4, <= 1.6.1)
|
12
|
-
mixlib-authentication (>= 1.3.0)
|
13
|
-
mixlib-cli (>= 1.1.0)
|
14
|
-
mixlib-config (>= 1.1.2)
|
15
|
-
mixlib-log (>= 1.3.0)
|
6
|
+
test-kitchen (1.0.0.dev)
|
7
|
+
celluloid
|
16
8
|
mixlib-shellout
|
17
|
-
|
18
|
-
net-ssh
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
9
|
+
net-scp
|
10
|
+
net-ssh
|
11
|
+
pry
|
12
|
+
safe_yaml
|
13
|
+
thor
|
14
|
+
|
15
|
+
GEM
|
16
|
+
remote: https://rubygems.org/
|
17
|
+
specs:
|
18
|
+
celluloid (0.12.4)
|
19
|
+
facter (>= 1.6.12)
|
20
|
+
timers (>= 1.0.0)
|
27
21
|
coderay (1.0.9)
|
28
|
-
|
29
|
-
|
30
|
-
ffi (1.4.0)
|
31
|
-
fog (1.9.0)
|
32
|
-
builder
|
33
|
-
excon (~> 0.14)
|
34
|
-
formatador (~> 0.2.0)
|
35
|
-
mime-types
|
36
|
-
multi_json (~> 1.0)
|
37
|
-
net-scp (~> 1.0.4)
|
38
|
-
net-ssh (>= 2.1.3)
|
39
|
-
nokogiri (~> 1.5.0)
|
40
|
-
ruby-hmac
|
41
|
-
foodcritic (1.7.0)
|
42
|
-
erubis
|
43
|
-
gherkin (~> 2.11.1)
|
44
|
-
gist (~> 3.1.0)
|
45
|
-
nokogiri (~> 1.5.4)
|
46
|
-
pry (~> 0.9.8.4)
|
47
|
-
rak (~> 1.4)
|
48
|
-
treetop (~> 1.4.10)
|
49
|
-
yajl-ruby (~> 1.1.0)
|
50
|
-
formatador (0.2.4)
|
51
|
-
gherkin (2.11.5)
|
52
|
-
json (>= 1.4.6)
|
53
|
-
gist (3.1.1)
|
54
|
-
hashr (0.0.22)
|
55
|
-
highline (1.6.15)
|
56
|
-
i18n (0.6.1)
|
57
|
-
ipaddress (0.8.0)
|
58
|
-
json (1.5.5)
|
59
|
-
librarian (0.0.26)
|
60
|
-
archive-tar-minitar (>= 0.5.2)
|
61
|
-
chef (>= 0.10)
|
62
|
-
highline
|
63
|
-
thor (~> 0.15)
|
64
|
-
log4r (1.1.10)
|
65
|
-
method_source (0.7.1)
|
66
|
-
mime-types (1.21)
|
67
|
-
mixlib-authentication (1.3.0)
|
68
|
-
mixlib-log
|
69
|
-
mixlib-cli (1.2.2)
|
70
|
-
mixlib-config (1.1.2)
|
71
|
-
mixlib-log (1.4.1)
|
22
|
+
facter (1.6.17)
|
23
|
+
method_source (0.8.1)
|
72
24
|
mixlib-shellout (1.1.0)
|
73
|
-
|
74
|
-
|
75
|
-
net-
|
76
|
-
|
77
|
-
net-ssh (2.2.2)
|
78
|
-
net-ssh-gateway (1.1.0)
|
79
|
-
net-ssh (>= 1.99.1)
|
80
|
-
net-ssh-multi (1.1)
|
81
|
-
net-ssh (>= 2.1.4)
|
82
|
-
net-ssh-gateway (>= 0.99.0)
|
83
|
-
nokogiri (1.5.6)
|
84
|
-
ohai (6.16.0)
|
85
|
-
ipaddress
|
86
|
-
mixlib-cli
|
87
|
-
mixlib-config
|
88
|
-
mixlib-log
|
89
|
-
mixlib-shellout
|
90
|
-
systemu
|
91
|
-
yajl-ruby
|
92
|
-
polyglot (0.3.3)
|
93
|
-
pry (0.9.8.4)
|
25
|
+
net-scp (1.1.0)
|
26
|
+
net-ssh (>= 2.6.5)
|
27
|
+
net-ssh (2.6.6)
|
28
|
+
pry (0.9.12)
|
94
29
|
coderay (~> 1.0.5)
|
95
|
-
method_source (~> 0.
|
96
|
-
slop (
|
97
|
-
|
98
|
-
|
99
|
-
mime-types (>= 1.16)
|
100
|
-
ruby-hmac (0.4.0)
|
101
|
-
slop (2.4.4)
|
102
|
-
systemu (2.5.2)
|
103
|
-
test-kitchen (0.7.0)
|
104
|
-
fog
|
105
|
-
foodcritic (>= 1.4.0)
|
106
|
-
hashr (~> 0.0.20)
|
107
|
-
highline (>= 1.6.9)
|
108
|
-
librarian (~> 0.0.20)
|
109
|
-
mixlib-cli (~> 1.2.2)
|
110
|
-
vagrant (~> 1.0.2)
|
111
|
-
yajl-ruby (~> 1.1.0)
|
30
|
+
method_source (~> 0.8)
|
31
|
+
slop (~> 3.4)
|
32
|
+
safe_yaml (0.8.5)
|
33
|
+
slop (3.4.4)
|
112
34
|
thor (0.17.0)
|
113
|
-
|
114
|
-
polyglot
|
115
|
-
polyglot (>= 0.3.1)
|
116
|
-
uuidtools (2.1.3)
|
117
|
-
vagrant (1.0.6)
|
118
|
-
archive-tar-minitar (= 0.5.2)
|
119
|
-
childprocess (~> 0.3.1)
|
120
|
-
erubis (~> 2.7.0)
|
121
|
-
i18n (~> 0.6.0)
|
122
|
-
json (~> 1.5.1)
|
123
|
-
log4r (~> 1.1.9)
|
124
|
-
net-scp (~> 1.0.4)
|
125
|
-
net-ssh (~> 2.2.2)
|
126
|
-
yajl-ruby (1.1.0)
|
35
|
+
timers (1.1.0)
|
127
36
|
|
128
37
|
PLATFORMS
|
129
38
|
ruby
|
130
39
|
|
131
40
|
DEPENDENCIES
|
132
|
-
test-kitchen
|
41
|
+
test-kitchen!
|
@@ -1,20 +1,20 @@
|
|
1
|
-
|
1
|
+
# LXC
|
2
2
|
|
3
3
|
Manage linux containers with Chef.
|
4
4
|
|
5
|
-
|
5
|
+
## Recipes
|
6
6
|
|
7
|
-
|
7
|
+
### default
|
8
8
|
|
9
9
|
Installs the packages and configuration files needed for lxc on the server. If
|
10
10
|
the node uses apt-cacher-ng as a client, the server will be reused when building
|
11
11
|
containers.
|
12
12
|
|
13
|
-
|
13
|
+
### install_dependencies
|
14
14
|
|
15
15
|
Installs the packages needed to support lxc's containers.
|
16
16
|
|
17
|
-
|
17
|
+
### containers
|
18
18
|
|
19
19
|
This recipe creates all of the containers defined in the `['lxc']['containers']`
|
20
20
|
hash. Here is an example of an `example` container:
|
@@ -22,20 +22,43 @@ hash. Here is an example of an `example` container:
|
|
22
22
|
```ruby
|
23
23
|
node['lxc']['containers']['example'] = {
|
24
24
|
'template' => 'ubuntu',
|
25
|
-
'
|
26
|
-
'debug' => , true
|
25
|
+
'initialize_commands' => ['apt-get update']
|
27
26
|
}
|
28
27
|
```
|
29
28
|
|
30
|
-
|
29
|
+
### knife
|
31
30
|
|
32
|
-
|
31
|
+
Install and manage containers via the knife-remotelxc plugin.
|
33
32
|
|
34
|
-
|
33
|
+
## LWRPs
|
35
34
|
|
36
|
-
|
35
|
+
### lxc
|
36
|
+
|
37
|
+
Allows for creation, deletion, and cloning of containers
|
38
|
+
|
39
|
+
### lxc_config
|
40
|
+
|
41
|
+
Allows configuration of the LXC configuration file
|
42
|
+
|
43
|
+
### lxc_fstab
|
44
|
+
|
45
|
+
Allows defining mounts to be used within the container
|
37
46
|
|
38
|
-
###
|
47
|
+
### lxc_interface
|
48
|
+
|
49
|
+
Allows configurations of network interfaces within a container
|
50
|
+
|
51
|
+
### lxc_ephemeral
|
52
|
+
|
53
|
+
Run a command within an ephemeral container
|
54
|
+
|
55
|
+
### lxc_container
|
56
|
+
|
57
|
+
Creates a container using the `lxc` LWRP and configures the container
|
58
|
+
as requested. This resource also allows nesting `lxc_fstab` and
|
59
|
+
`lxc_interface` within the container resource.
|
60
|
+
|
61
|
+
## Example
|
39
62
|
|
40
63
|
```ruby
|
41
64
|
include_recipe 'lxc'
|
@@ -47,11 +70,17 @@ lxc_container 'my_container' do
|
|
47
70
|
validator_pem content_from_encrypted_dbag
|
48
71
|
run_list ['role[base]']
|
49
72
|
chef_enabled true
|
73
|
+
fstab_mount "Persist" do
|
74
|
+
file_system '/opt/file_store'
|
75
|
+
mount_point '/opt/file_store'
|
76
|
+
type 'none'
|
77
|
+
options 'bind,rw'
|
78
|
+
end
|
50
79
|
end
|
51
80
|
|
52
81
|
lxc_container 'my_container_clone' do
|
53
|
-
action :
|
54
|
-
|
82
|
+
action :create
|
83
|
+
clone 'my_container'
|
55
84
|
chef_enabled true
|
56
85
|
end
|
57
86
|
|