chef-metal 0.9.3 → 0.9.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +22 -2
- data/lib/chef/provider/machine.rb +6 -0
- data/lib/chef/provider/machine_batch.rb +49 -0
- data/lib/chef/resource/machine_batch.rb +13 -0
- data/lib/chef_metal/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 00a282ef18ac2646f17721192ffadb941fdcb633
|
4
|
+
data.tar.gz: 5661ed9e46d23ca6d8a58a7b7ea83e2004dea534
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 14715c670bde674c517bf4239b558e0cd435e0a9b9bcfee580c71653fc10699b792461563c818f004519c089272365fc38bf47c0c818eb094a451177dd68991a
|
7
|
+
data.tar.gz: f11ccb2cea40c9afab0ad34eddd177c297a8ba169a9f34f757048866f36af6ceffea92bc9e5852ad27e78928c536218698c9b62e40b2f45dbc27df71b4eba93c
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
Chef Metal
|
2
|
+
==========
|
3
3
|
|
4
4
|
This library solves the problem of repeatably creating machines and infrastructures in Chef. It has a plugin model that lets you write bootstrappers for your favorite infrastructures, including VirtualBox, EC2, LXC, bare metal, and many more!
|
5
5
|
|
@@ -54,6 +54,11 @@ end
|
|
54
54
|
|
55
55
|
You will notice the dynamic nature of the number of web servers. It's all code, your imagination is the limit :)
|
56
56
|
|
57
|
+
Kitchen
|
58
|
+
-------
|
59
|
+
|
60
|
+
Chef Metal also works with Test Kitchen, allowing you to test entire clusters, not just machines! The repository for the kitchen-metal gem is https://github.com/doubt72/kitchen-metal.
|
61
|
+
|
57
62
|
Provisioners
|
58
63
|
------------
|
59
64
|
|
@@ -67,6 +72,21 @@ The provisioner API is separated out so that new provisioners can be made with m
|
|
67
72
|
|
68
73
|
Provisioners save their data in the Chef node itself, so that they will be accessible to everyone who is using the Chef server to manage the nodes.
|
69
74
|
|
75
|
+
Provisioners each have their own repository. Current provisioners:
|
76
|
+
|
77
|
+
**Cloud:**
|
78
|
+
- [FOG: EC2, DigitalOcean, OpenStack, etc.](https://github.com/opscode/chef-metal-fog)
|
79
|
+
|
80
|
+
**Virtualization:**
|
81
|
+
- [Vagrant: VirtualBox, VMWare Fusion, etc.](https://github.com/opscode/chef-metal-vagrant)
|
82
|
+
|
83
|
+
**Containers:**
|
84
|
+
- [LXC](https://github.com/opscode/chef-metal-lxc)
|
85
|
+
- [Docker](https://github.com/opscode/chef-metal-docker)
|
86
|
+
|
87
|
+
**Bare Metal:**
|
88
|
+
- [SSH (no PXE)](https://github.com/double-z/chef-metal-ssh)
|
89
|
+
|
70
90
|
### Vagrant
|
71
91
|
|
72
92
|
chef-zero comes with a provisioner for Vagrant, an abstraction that covers VirtualBox, VMWare and other Virtual Machine providers. To run it, you can check out the sample recipes with:
|
@@ -16,6 +16,8 @@ class Chef::Provider::Machine < Chef::Provider::LWRPBase
|
|
16
16
|
action :create do
|
17
17
|
node_json = node_provider.new_json
|
18
18
|
node_json['normal']['provisioner_options'] = new_resource.provisioner_options
|
19
|
+
# Preserve provisioner_output, whatever the cost
|
20
|
+
node_json['normal']['provisioner_output'] = node_provider.current_json['normal']['provisioner_output']
|
19
21
|
machine = new_resource.provisioner.acquire_machine(self, node_json)
|
20
22
|
begin
|
21
23
|
machine.setup_convergence(self, new_resource)
|
@@ -33,6 +35,8 @@ class Chef::Provider::Machine < Chef::Provider::LWRPBase
|
|
33
35
|
action :converge do
|
34
36
|
node_json = node_provider.new_json
|
35
37
|
node_json['normal']['provisioner_options'] = new_resource.provisioner_options
|
38
|
+
# Preserve provisioner_output, whatever the cost
|
39
|
+
node_json['normal']['provisioner_output'] = node_provider.current_json['normal']['provisioner_output']
|
36
40
|
machine = new_resource.provisioner.connect_to_machine(node_json)
|
37
41
|
begin
|
38
42
|
machine.converge(self, new_resource.chef_server)
|
@@ -44,6 +48,8 @@ class Chef::Provider::Machine < Chef::Provider::LWRPBase
|
|
44
48
|
action :stop do
|
45
49
|
node_json = node_provider.new_json
|
46
50
|
node_json['normal']['provisioner_options'] = new_resource.provisioner_options
|
51
|
+
# Preserve provisioner_output, whatever the cost
|
52
|
+
node_json['normal']['provisioner_output'] = node_provider.current_json['normal']['provisioner_output']
|
47
53
|
new_resource.provisioner.stop_machine(self, node_json)
|
48
54
|
end
|
49
55
|
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'chef/provider/lwrp_base'
|
2
|
+
require 'chef_metal/provider_action_handler'
|
3
|
+
require 'chef/chef_fs/parallelizer'
|
4
|
+
|
5
|
+
class Chef::Provider::MachineBatch < Chef::Provider::LWRPBase
|
6
|
+
|
7
|
+
include ChefMetal::ProviderActionHandler
|
8
|
+
|
9
|
+
use_inline_resources
|
10
|
+
|
11
|
+
def whyrun_supported?
|
12
|
+
true
|
13
|
+
end
|
14
|
+
|
15
|
+
action :create do
|
16
|
+
# Collect nodes by provisioner
|
17
|
+
|
18
|
+
by_provisioner = new_resource.machines.group_by { |machine| machine.provisioner }
|
19
|
+
# Talk to each provisioner in parallel
|
20
|
+
Chef::ChefFS::Parallelizer.parallelize(by_provisioner) do |provisioner, machines|
|
21
|
+
nodes_json = machines.map do |machine|
|
22
|
+
node_json = node_providers[machine].node_json
|
23
|
+
node_json['normal']['provisioner_options'] = machine.provisioner_options
|
24
|
+
node_json
|
25
|
+
end
|
26
|
+
if provisioner.respond_to?(:acquire_machines)
|
27
|
+
provisioner.acquire_machines(self, nodes_json)
|
28
|
+
else
|
29
|
+
Chef::ChefFS::Parallelizer.parallelize(nodes_json) do |node_json|
|
30
|
+
provisioner.acquire_machine(self, node_json)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
attr_reader :node_providers
|
37
|
+
|
38
|
+
def load_current_resource
|
39
|
+
@node_providers = {}
|
40
|
+
new_resource.machines.each do |machine|
|
41
|
+
@node_providers[machine] = Chef::Provider.ChefNode.new(machine, nil)
|
42
|
+
end
|
43
|
+
# Load nodes in parallel
|
44
|
+
Chef::ChefFS::Parallelizer.parallelize(@node_providers.values) do |node_provider|
|
45
|
+
node_provider.load_current_resource
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'chef/resource/lwrp_base'
|
2
|
+
|
3
|
+
class Chef::Resource::MachineBatch < Chef::Resource::LWRPBase
|
4
|
+
def initialize(*args)
|
5
|
+
super
|
6
|
+
@machines = []
|
7
|
+
end
|
8
|
+
|
9
|
+
actions :create, :setup, :converge, :stop
|
10
|
+
default_action :create
|
11
|
+
|
12
|
+
attribute :machines, :kind_of => [ Array ]
|
13
|
+
end
|
data/lib/chef_metal/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chef-metal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Keiser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|
@@ -151,9 +151,11 @@ files:
|
|
151
151
|
- README.md
|
152
152
|
- CHANGELOG.md
|
153
153
|
- lib/chef/provider/machine.rb
|
154
|
+
- lib/chef/provider/machine_batch.rb
|
154
155
|
- lib/chef/provider/machine_execute.rb
|
155
156
|
- lib/chef/provider/machine_file.rb
|
156
157
|
- lib/chef/resource/machine.rb
|
158
|
+
- lib/chef/resource/machine_batch.rb
|
157
159
|
- lib/chef/resource/machine_execute.rb
|
158
160
|
- lib/chef/resource/machine_file.rb
|
159
161
|
- lib/chef_metal/action_handler.rb
|