chef-provisioning 0.15
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +207 -0
- data/LICENSE +201 -0
- data/README.md +260 -0
- data/Rakefile +6 -0
- data/lib/chef/provider/load_balancer.rb +77 -0
- data/lib/chef/provider/machine.rb +176 -0
- data/lib/chef/provider/machine_batch.rb +191 -0
- data/lib/chef/provider/machine_execute.rb +35 -0
- data/lib/chef/provider/machine_file.rb +54 -0
- data/lib/chef/provider/machine_image.rb +60 -0
- data/lib/chef/provisioning.rb +95 -0
- data/lib/chef/provisioning/action_handler.rb +68 -0
- data/lib/chef/provisioning/add_prefix_action_handler.rb +31 -0
- data/lib/chef/provisioning/chef_image_spec.rb +108 -0
- data/lib/chef/provisioning/chef_load_balancer_spec.rb +108 -0
- data/lib/chef/provisioning/chef_machine_spec.rb +84 -0
- data/lib/chef/provisioning/chef_provider_action_handler.rb +74 -0
- data/lib/chef/provisioning/chef_run_data.rb +139 -0
- data/lib/chef/provisioning/convergence_strategy.rb +28 -0
- data/lib/chef/provisioning/convergence_strategy/install_cached.rb +156 -0
- data/lib/chef/provisioning/convergence_strategy/install_msi.rb +58 -0
- data/lib/chef/provisioning/convergence_strategy/install_sh.rb +55 -0
- data/lib/chef/provisioning/convergence_strategy/no_converge.rb +39 -0
- data/lib/chef/provisioning/convergence_strategy/precreate_chef_objects.rb +183 -0
- data/lib/chef/provisioning/driver.rb +304 -0
- data/lib/chef/provisioning/image_spec.rb +72 -0
- data/lib/chef/provisioning/load_balancer_spec.rb +86 -0
- data/lib/chef/provisioning/machine.rb +112 -0
- data/lib/chef/provisioning/machine/basic_machine.rb +84 -0
- data/lib/chef/provisioning/machine/unix_machine.rb +278 -0
- data/lib/chef/provisioning/machine/windows_machine.rb +104 -0
- data/lib/chef/provisioning/machine_spec.rb +82 -0
- data/lib/chef/provisioning/recipe_dsl.rb +103 -0
- data/lib/chef/provisioning/transport.rb +95 -0
- data/lib/chef/provisioning/transport/ssh.rb +343 -0
- data/lib/chef/provisioning/transport/winrm.rb +151 -0
- data/lib/chef/provisioning/version.rb +5 -0
- data/lib/chef/resource/chef_data_bag_resource.rb +148 -0
- data/lib/chef/resource/load_balancer.rb +57 -0
- data/lib/chef/resource/machine.rb +124 -0
- data/lib/chef/resource/machine_batch.rb +78 -0
- data/lib/chef/resource/machine_execute.rb +28 -0
- data/lib/chef/resource/machine_file.rb +34 -0
- data/lib/chef/resource/machine_image.rb +35 -0
- data/lib/chef_metal.rb +1 -0
- metadata +217 -0
@@ -0,0 +1,78 @@
|
|
1
|
+
require 'chef/resource/lwrp_base'
|
2
|
+
require 'chef/mixin/deep_merge'
|
3
|
+
|
4
|
+
class Chef
|
5
|
+
class Resource
|
6
|
+
class MachineBatch < Chef::Resource::LWRPBase
|
7
|
+
|
8
|
+
self.resource_name = 'machine_batch'
|
9
|
+
|
10
|
+
def initialize(*args)
|
11
|
+
super
|
12
|
+
@machines = []
|
13
|
+
@driver = run_context.chef_provisioning.current_driver
|
14
|
+
@chef_server = run_context.cheffish.current_chef_server
|
15
|
+
@machine_options = run_context.chef_provisioning.current_machine_options
|
16
|
+
end
|
17
|
+
|
18
|
+
actions :allocate, :ready, :setup, :converge, :converge_only, :destroy, :stop
|
19
|
+
default_action :converge
|
20
|
+
|
21
|
+
attribute :machines, :kind_of => [ Array ]
|
22
|
+
attribute :max_simultaneous, :kind_of => [ Integer ]
|
23
|
+
attribute :from_recipe
|
24
|
+
|
25
|
+
# These four attributes are for when you pass names or MachineSpecs to
|
26
|
+
# "machines". Not used for auto-batch or explicit inline machine declarations.
|
27
|
+
attribute :driver
|
28
|
+
attribute :chef_server
|
29
|
+
attribute :machine_options
|
30
|
+
attribute :files, :kind_of => [ Array ]
|
31
|
+
|
32
|
+
def machines(*values)
|
33
|
+
if values.size == 0
|
34
|
+
@machines
|
35
|
+
else
|
36
|
+
@machines += values.flatten
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
def machine(name, &block)
|
41
|
+
machines << from_recipe.build_resource(:machine, name, caller[0], &block)
|
42
|
+
end
|
43
|
+
|
44
|
+
def add_machine_options(options)
|
45
|
+
@machine_options = Chef::Mixin::DeepMerge.hash_only_merge(@machine_options, options)
|
46
|
+
end
|
47
|
+
|
48
|
+
# We override this because we want to hide @from_recipe and shorten @machines
|
49
|
+
# in error output.
|
50
|
+
def to_text
|
51
|
+
ivars = instance_variables.map { |ivar| ivar.to_sym } - HIDDEN_IVARS - [ :@from_recipe, :@machines ]
|
52
|
+
text = "# Declared in #{@source_line}\n\n"
|
53
|
+
text << self.class.dsl_name + "(\"#{name}\") do\n"
|
54
|
+
ivars.each do |ivar|
|
55
|
+
if (value = instance_variable_get(ivar)) && !(value.respond_to?(:empty?) && value.empty?)
|
56
|
+
value_string = value.respond_to?(:to_text) ? value.to_text : value.inspect
|
57
|
+
text << " #{ivar.to_s.sub(/^@/,'')} #{value_string}\n"
|
58
|
+
end
|
59
|
+
end
|
60
|
+
machine_names = @machines.map do |m|
|
61
|
+
if m.is_a?(Chef::Provisioning::MachineSpec)
|
62
|
+
m.name
|
63
|
+
elsif m.is_a?(Chef::Resource::Machine)
|
64
|
+
m.name
|
65
|
+
else
|
66
|
+
m
|
67
|
+
end
|
68
|
+
end
|
69
|
+
text << " machines #{machine_names.inspect}\n"
|
70
|
+
[@not_if, @only_if].flatten.each do |conditional|
|
71
|
+
text << " #{conditional.to_text}\n"
|
72
|
+
end
|
73
|
+
text << "end\n"
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'chef/resource/lwrp_base'
|
2
|
+
require 'chef/provisioning'
|
3
|
+
require 'chef/provisioning/machine'
|
4
|
+
require 'chef/provisioning/driver'
|
5
|
+
|
6
|
+
class Chef
|
7
|
+
class Resource
|
8
|
+
class MachineExecute < Chef::Resource::LWRPBase
|
9
|
+
|
10
|
+
self.resource_name = 'machine_execute'
|
11
|
+
|
12
|
+
def initialize(*args)
|
13
|
+
super
|
14
|
+
@chef_server = run_context.cheffish.current_chef_server
|
15
|
+
end
|
16
|
+
|
17
|
+
actions :run
|
18
|
+
default_action :run
|
19
|
+
|
20
|
+
attribute :command, :kind_of => String, :name_attribute => true
|
21
|
+
attribute :machine, :kind_of => String
|
22
|
+
|
23
|
+
attribute :chef_server, :kind_of => Hash
|
24
|
+
attribute :driver, :kind_of => Chef::Provisioning::Driver
|
25
|
+
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'chef/resource/lwrp_base'
|
2
|
+
require 'chef/provisioning'
|
3
|
+
require 'chef/provisioning/machine'
|
4
|
+
require 'chef/provisioning/driver'
|
5
|
+
|
6
|
+
class Chef
|
7
|
+
class Resource
|
8
|
+
class MachineFile < Chef::Resource::LWRPBase
|
9
|
+
|
10
|
+
self.resource_name = 'machine_file'
|
11
|
+
|
12
|
+
def initialize(*args)
|
13
|
+
super
|
14
|
+
@chef_server = run_context.cheffish.current_chef_server
|
15
|
+
end
|
16
|
+
|
17
|
+
actions :upload, :download, :delete, :nothing
|
18
|
+
default_action :upload
|
19
|
+
|
20
|
+
attribute :path, :kind_of => String, :name_attribute => true
|
21
|
+
attribute :machine, :kind_of => String
|
22
|
+
attribute :local_path, :kind_of => String
|
23
|
+
attribute :content
|
24
|
+
|
25
|
+
attribute :owner, :kind_of => String
|
26
|
+
attribute :group, :kind_of => String
|
27
|
+
attribute :mode, :kind_of => String
|
28
|
+
|
29
|
+
attribute :chef_server, :kind_of => Hash
|
30
|
+
attribute :driver, :kind_of => Chef::Provisioning::Driver
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'chef/resource/lwrp_base'
|
2
|
+
require 'cheffish'
|
3
|
+
require 'chef/provisioning'
|
4
|
+
require 'cheffish/merged_config'
|
5
|
+
|
6
|
+
class Chef
|
7
|
+
class Resource
|
8
|
+
class MachineImage < Chef::Resource::Machine
|
9
|
+
|
10
|
+
self.resource_name = 'machine_image'
|
11
|
+
|
12
|
+
def initialize(*args)
|
13
|
+
super
|
14
|
+
@image_options = run_context.chef_provisioning.current_image_options
|
15
|
+
@machine_options = run_context.chef_provisioning.current_machine_options
|
16
|
+
end
|
17
|
+
|
18
|
+
# TODO check if we still have all the actions from machine
|
19
|
+
actions :create, :destroy, :archive
|
20
|
+
default_action :create
|
21
|
+
|
22
|
+
attribute :image_options, :kind_of => Hash
|
23
|
+
|
24
|
+
# TODO
|
25
|
+
# - policy for old version cleanup
|
26
|
+
# - when attributes or recipes of the machine_image changes, or when the actual
|
27
|
+
# recipes therein change, we will regenerate the image
|
28
|
+
# - attribute to force or turn off image updates
|
29
|
+
# - ability to rebuild new image based on the previous image
|
30
|
+
# - ability to specify whether and how to keep the image-building machine around
|
31
|
+
# - ability to specify whether to leave the chef config around or not
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
data/lib/chef_metal.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'chef/provisioning'
|
metadata
ADDED
@@ -0,0 +1,217 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: chef-provisioning
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: '0.15'
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- John Keiser
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-29 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: chef
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: net-ssh
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: net-scp
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: net-ssh-gateway
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.2.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 1.2.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: inifile
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: cheffish
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.8'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.8'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: winrm
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.2.0
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.2.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rspec
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rake
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
description: A library for creating machines and infrastructures idempotently in Chef.
|
140
|
+
email: jkeiser@opscode.com
|
141
|
+
executables: []
|
142
|
+
extensions: []
|
143
|
+
extra_rdoc_files:
|
144
|
+
- README.md
|
145
|
+
- CHANGELOG.md
|
146
|
+
- LICENSE
|
147
|
+
files:
|
148
|
+
- CHANGELOG.md
|
149
|
+
- LICENSE
|
150
|
+
- README.md
|
151
|
+
- Rakefile
|
152
|
+
- lib/chef/provider/load_balancer.rb
|
153
|
+
- lib/chef/provider/machine.rb
|
154
|
+
- lib/chef/provider/machine_batch.rb
|
155
|
+
- lib/chef/provider/machine_execute.rb
|
156
|
+
- lib/chef/provider/machine_file.rb
|
157
|
+
- lib/chef/provider/machine_image.rb
|
158
|
+
- lib/chef/provisioning.rb
|
159
|
+
- lib/chef/provisioning/action_handler.rb
|
160
|
+
- lib/chef/provisioning/add_prefix_action_handler.rb
|
161
|
+
- lib/chef/provisioning/chef_image_spec.rb
|
162
|
+
- lib/chef/provisioning/chef_load_balancer_spec.rb
|
163
|
+
- lib/chef/provisioning/chef_machine_spec.rb
|
164
|
+
- lib/chef/provisioning/chef_provider_action_handler.rb
|
165
|
+
- lib/chef/provisioning/chef_run_data.rb
|
166
|
+
- lib/chef/provisioning/convergence_strategy.rb
|
167
|
+
- lib/chef/provisioning/convergence_strategy/install_cached.rb
|
168
|
+
- lib/chef/provisioning/convergence_strategy/install_msi.rb
|
169
|
+
- lib/chef/provisioning/convergence_strategy/install_sh.rb
|
170
|
+
- lib/chef/provisioning/convergence_strategy/no_converge.rb
|
171
|
+
- lib/chef/provisioning/convergence_strategy/precreate_chef_objects.rb
|
172
|
+
- lib/chef/provisioning/driver.rb
|
173
|
+
- lib/chef/provisioning/image_spec.rb
|
174
|
+
- lib/chef/provisioning/load_balancer_spec.rb
|
175
|
+
- lib/chef/provisioning/machine.rb
|
176
|
+
- lib/chef/provisioning/machine/basic_machine.rb
|
177
|
+
- lib/chef/provisioning/machine/unix_machine.rb
|
178
|
+
- lib/chef/provisioning/machine/windows_machine.rb
|
179
|
+
- lib/chef/provisioning/machine_spec.rb
|
180
|
+
- lib/chef/provisioning/recipe_dsl.rb
|
181
|
+
- lib/chef/provisioning/transport.rb
|
182
|
+
- lib/chef/provisioning/transport/ssh.rb
|
183
|
+
- lib/chef/provisioning/transport/winrm.rb
|
184
|
+
- lib/chef/provisioning/version.rb
|
185
|
+
- lib/chef/resource/chef_data_bag_resource.rb
|
186
|
+
- lib/chef/resource/load_balancer.rb
|
187
|
+
- lib/chef/resource/machine.rb
|
188
|
+
- lib/chef/resource/machine_batch.rb
|
189
|
+
- lib/chef/resource/machine_execute.rb
|
190
|
+
- lib/chef/resource/machine_file.rb
|
191
|
+
- lib/chef/resource/machine_image.rb
|
192
|
+
- lib/chef_metal.rb
|
193
|
+
homepage: http://wiki.opscode.com/display/chef
|
194
|
+
licenses: []
|
195
|
+
metadata: {}
|
196
|
+
post_install_message:
|
197
|
+
rdoc_options: []
|
198
|
+
require_paths:
|
199
|
+
- lib
|
200
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
202
|
+
- - ">="
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '0'
|
205
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
206
|
+
requirements:
|
207
|
+
- - ">="
|
208
|
+
- !ruby/object:Gem::Version
|
209
|
+
version: '0'
|
210
|
+
requirements: []
|
211
|
+
rubyforge_project:
|
212
|
+
rubygems_version: 2.2.2
|
213
|
+
signing_key:
|
214
|
+
specification_version: 4
|
215
|
+
summary: A library for creating machines and infrastructures idempotently in Chef.
|
216
|
+
test_files: []
|
217
|
+
has_rdoc:
|