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
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 611cb52d02b2fcedc3d919e3c43ffec244d24508
|
4
|
+
data.tar.gz: 1a5effed9787a551bfb2fb1eb9bd48e7d305de37
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 24df478126fe1673f447c71a3c2f17f20389faed39d0799e1d2770faa413b0a1510308d566c2c1c97216bb9d219a92abba6435f913e1d3732b79ea97108ab5d6
|
7
|
+
data.tar.gz: 2a90b86f5c2d502e3c557476ad62fd3b5a9d3833c86771d48bce4fb2abb71ceb447154dd2fff26683b05182f767405fdfa842e4aa0c744bfba673456ba96a996
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,207 @@
|
|
1
|
+
# Chef Metal Changelog
|
2
|
+
## 0.15 (10/29/2014)
|
3
|
+
|
4
|
+
- Rename from chef-metal to chef-provisioning
|
5
|
+
|
6
|
+
## 0.14.2 (9/2/2014)
|
7
|
+
|
8
|
+
- Disable auto batching
|
9
|
+
- Fix for with_machine_options context hash
|
10
|
+
- Pass timeout from execution_options to winrm set_timeout
|
11
|
+
- Add better error message when driver does not specify driver_url
|
12
|
+
- Add info that location.driver_url is required
|
13
|
+
- Remove Chef 11.14 alpha note in readme
|
14
|
+
- Gracefully handle Host Down and Network Unreachable
|
15
|
+
|
16
|
+
## 0.14.1 (8/18/2014)
|
17
|
+
|
18
|
+
- Fix "metal execute mario ls" to work again
|
19
|
+
|
20
|
+
## 0.14 (8/18/2014)
|
21
|
+
|
22
|
+
- FEATURE: Add the machine_image resource (@jkeiser, @johnewart):
|
23
|
+
```ruby
|
24
|
+
machine_image 'base' do
|
25
|
+
machine_options :bootstrap_options => { :image_id => 'ami-1234798123431', :ssh_username => 'root' }
|
26
|
+
recipe 'secure_base'
|
27
|
+
recipe 'corp_users'
|
28
|
+
end
|
29
|
+
# Build an image based on 'base' that has apache
|
30
|
+
machine_image 'apache' do
|
31
|
+
# All bootstrap options, like ssh_username, are carried forward
|
32
|
+
from_image 'base'
|
33
|
+
recipe 'apache2'
|
34
|
+
end
|
35
|
+
# Build an image with my web app based on the apache base image
|
36
|
+
machine_image 'myapp' do
|
37
|
+
from_image 'apache'
|
38
|
+
recipe 'mywebapp'
|
39
|
+
end
|
40
|
+
# Build an image with mysql and my schema based on the corporate base image
|
41
|
+
machine_image 'mydb' do
|
42
|
+
from_image 'base'
|
43
|
+
recipe 'mysql'
|
44
|
+
recipe 'myschema'
|
45
|
+
end
|
46
|
+
# Build a DB machine from mydb. Does not reinstall stuff! :)
|
47
|
+
machine 'db' do
|
48
|
+
from_image 'mydb'
|
49
|
+
end
|
50
|
+
# Build a web app machine from myapp. Does not reinstall stuff! :)
|
51
|
+
machine 'myapp1' do
|
52
|
+
from_image 'myapp'
|
53
|
+
end
|
54
|
+
```
|
55
|
+
- Creates a node with the name of the machine_image, which contains metadata
|
56
|
+
like the username of the image. This makes things like AWS image registries
|
57
|
+
possible.
|
58
|
+
- Fix the no_converge convergence strategy (@johnewart)
|
59
|
+
- SSH port forwarding improvements:
|
60
|
+
- Detects *any* IP on the localhost and forwards it--not just 127.0.0.1
|
61
|
+
- Binds to localhost on the remote side instead of 127.0.0.1, allowing for IPv6 communication
|
62
|
+
- Tries multiple ports--if the origin port is already taken, tries "0" (ephemeral).
|
63
|
+
- Fix SSH race condition causing port forwarding to happen twice (and fail miserably)
|
64
|
+
- Add Chef::Provisioning.connect_to_machine('mario')
|
65
|
+
|
66
|
+
## 0.13 (6/17/2014)
|
67
|
+
|
68
|
+
- make winrm work again (@mwrock)
|
69
|
+
- add bootstrap_proxy as a convergence_option for when target machines require a proxy (@MrMMorris)
|
70
|
+
|
71
|
+
## 0.12.1 (6/18/2014)
|
72
|
+
|
73
|
+
- fix machine_batch action :setup
|
74
|
+
- fix issue with default machine_batch names being non-unique across recipes
|
75
|
+
|
76
|
+
## 0.12 (6/18/2014)
|
77
|
+
|
78
|
+
- Remove chef-provisioning-fog and chef-provisioning-vagrant as dependencies (install whatever things you want directly!)
|
79
|
+
- Fix ssl_verify_mode to work correctly when other HTTPS calls are made (@mwrock)
|
80
|
+
- Fix machine_file and machine_execute resources (@irvingpop)
|
81
|
+
|
82
|
+
## 0.11.2 (6/4/2014)
|
83
|
+
|
84
|
+
- Fix issue where machines with different drivers could get default options from the global current driver
|
85
|
+
|
86
|
+
## 0.11.1 (6/4/2014)
|
87
|
+
|
88
|
+
- fix local mode port forwarding on IPv6 hosts
|
89
|
+
|
90
|
+
## 0.11 (6/4/2014)
|
91
|
+
|
92
|
+
- New Driver interface (see docs/ and blogs/ directories for documentation)
|
93
|
+
- New configuration (see docs/ and blogs/)
|
94
|
+
- get rid of annoying SSL warning (note: this turns off SSL verification, which was the default anyway)
|
95
|
+
- fix machine_batch error report to be less verbose
|
96
|
+
- fail when machine is being moved from driver to driver
|
97
|
+
- @marcusn disconnect from SSH when there is a problem
|
98
|
+
- fix SSH gateway code to honor any options given (@marcusn)
|
99
|
+
- Make machine_batch auto batching smarter (only batch things that have the same actions)
|
100
|
+
- Allow auto batching to be turned off with `auto_batch_machines = false` in recipes or config
|
101
|
+
- Allow this:
|
102
|
+
```ruby
|
103
|
+
machine_batch do
|
104
|
+
machine 'a'
|
105
|
+
machine 'b'
|
106
|
+
end
|
107
|
+
```
|
108
|
+
- Allow this:
|
109
|
+
```ruby
|
110
|
+
machine_batch do
|
111
|
+
machines 'a', 'b', 'c'
|
112
|
+
action :destroy
|
113
|
+
end
|
114
|
+
- fix issue setting Hosted Chef ACLs on nodes
|
115
|
+
- fix local mode forwarding in mixed IPv4/IPv6 environments
|
116
|
+
|
117
|
+
## 0.10.2 (5/2/2014)
|
118
|
+
|
119
|
+
- Fix crash with add_provisioner_options when provisioner_options is not yet set
|
120
|
+
|
121
|
+
## 0.10.1 (5/2/2014)
|
122
|
+
|
123
|
+
- Fix a crash when uploading files in a machine batch
|
124
|
+
|
125
|
+
## 0.10 (5/1/2014)
|
126
|
+
|
127
|
+
- Parallelism!
|
128
|
+
- All machines by default will be created in parallel just before the first "machine" definition. They will attempt to run all the way to converge. If they fail, add "with_machine_batch 'mybatch', :setup"
|
129
|
+
- Use "with_machine_batch 'mybatch'" before any machines if you want tighter control. Actions include :delete, :acquire, :setup, and :converge.
|
130
|
+
- Parallelizableness: chef-provisioning now stores data in the run_context instead of globally, so that it can be run multiple times in parallel. This capability is not yet being used.
|
131
|
+
|
132
|
+
## 0.9.4 (4/23/2014)
|
133
|
+
|
134
|
+
- Preserve provisioner_output in machine resource (don't destroy it!!)
|
135
|
+
|
136
|
+
## 0.9.3 (4/13/2014)
|
137
|
+
|
138
|
+
- SSH: Treat EHOSTUNREACH as "machine not yet available" (helps with AWS)
|
139
|
+
|
140
|
+
## 0.9.2 (4/13/2014)
|
141
|
+
|
142
|
+
- Timeout stability fixes (makes EC2 a little stabler for some AMIs)
|
143
|
+
|
144
|
+
## 0.9.1 (4/11/2014)
|
145
|
+
|
146
|
+
- Make write_file and upload_file create parent directory
|
147
|
+
|
148
|
+
## 0.9 (4/9/2014)
|
149
|
+
|
150
|
+
- Add `files` and `file` attributes to the `machine` resource
|
151
|
+
- Fix `machine_execute` resource (@irvingpop)
|
152
|
+
- Fix `machine :converge` action (thanks @double-z)
|
153
|
+
- Make chef-client timeout longer by default (2 hours)
|
154
|
+
- Make chef_client_timeout a configurable option for all convergence strategies and provisioner_options
|
155
|
+
- Add `metal cp` command
|
156
|
+
|
157
|
+
## 0.8.2 (4/9/2014)
|
158
|
+
|
159
|
+
- Add timeout support to execute
|
160
|
+
- Fix machine_file resource
|
161
|
+
- Add ohai_hints DSL to machine resource (@xorl)
|
162
|
+
|
163
|
+
## 0.8.1 (4/9/2014)
|
164
|
+
|
165
|
+
- Bug: error! was not raising an error in the SSH and WinRM transports
|
166
|
+
- Transports: stream output automatically when in debug
|
167
|
+
- Support the :read_only execute hint (for Docker)
|
168
|
+
- Add more metal command lines (converge, update, delete)
|
169
|
+
- Add Chef::Provisioning.connect_to_machine(machine_name) method to get Machine object for a node name
|
170
|
+
|
171
|
+
## 0.8 (4/8/2014)
|
172
|
+
|
173
|
+
- New machine_execute resource! (irving@getchef.com)
|
174
|
+
- Experimental "metal" command line: metal execute NODENAME COMMAND ARGS
|
175
|
+
- Transport: Add ability to stream execute() for better nested chef-client debugging
|
176
|
+
|
177
|
+
## 0.7 (4/5/2014)
|
178
|
+
|
179
|
+
- Change transport interface: add ability to rewrite URL instead of forwarding ports
|
180
|
+
|
181
|
+
## 0.6 (4/4/2014)
|
182
|
+
|
183
|
+
- Vagrant and Fog provisioners moved to their own gems (chef-provisioning-vagrant and chef-provisioning-fog)
|
184
|
+
- Support for Hosted and Enterprise Chef (https://github.com/dafyddcrosby)
|
185
|
+
|
186
|
+
## 0.5 (4/3/2014)
|
187
|
+
|
188
|
+
* Provisioner interface changes designed to allow provisioners to be used outside of Chef (doubt@getchef.com)
|
189
|
+
* All Provisioner and Machine methods now take "action_handler" instead of "driver." It uses the ActionHandler interface described in action_handler.rb. In short:
|
190
|
+
- driver.run_context -> action_handler.recipe_context
|
191
|
+
- driver.updated_by_last_action(true) -> action_handler.updated!
|
192
|
+
- driver.converge_by -> action_handler.perform_action
|
193
|
+
- driver.cookbook_name -> driver.debug_name
|
194
|
+
* Convergence strategy: delete_chef_objects() -> cleanup_convergence()
|
195
|
+
* Ability to get back to a machine from a node (another Provisioner interface change) (doubt@getchef.com):
|
196
|
+
* Provisioners must create a file named `chef_provisioning/provisioner_init/<scheme>_init.rb`. It will be required when a node is encountered with that scheme. It should call Chef::Provisioning.add_registered_provisioner_class(<scheme>, <provisioner class name>). For the provisioner_url `fog:AWS:21348723432`, the scheme is "fog" and the file is `chef_provisioningprovisioner_init/fog_init.rb`. It should call `Chef::Provisioning.add_registered_provisioner_class('fog', Chef::Provisioning::Provisioner::FogProvisioner)`.
|
197
|
+
* Provisioner classes must implement the class method `inflate(node)`, which should create a Provisioner instance appropriate to the given `node` (generally by looking at `node['normal']['provisioner_output']`)
|
198
|
+
* New `NoConverge` convergence strategy that creates a node but does not install Chef or converge.
|
199
|
+
* Support for machine_file `group`, `owner` and `mode` attributes (@irvingpop)
|
200
|
+
* SSH transport (ryan@segv.net): try to enable pty when possible (increases chance of successful connection). Set options[:ssh_pty_enable] to `false` to turn this off. Set `true` to force it (and fail if we can't get it)
|
201
|
+
|
202
|
+
## 0.4 (3/29/2014)
|
203
|
+
|
204
|
+
* EC2: Make it possible for multiple IAM users to converge chef-provisioning on the same account
|
205
|
+
* Openstack: Openstack support via the Fog driver! (@cstewart87)
|
206
|
+
* EC2: Add :use_private_ip_for_ssh option, and use private ip by default if public IP does not exist. (@xorl, @dafyddcrosby)
|
207
|
+
* RHEL/Centos: fix platform detection and installation
|
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,260 @@
|
|
1
|
+
[![Stories in Ready](https://badge.waffle.io/opscode/chef-provisioning.png?label=ready&title=Ready)](https://waffle.io/opscode/chef-provisioning)
|
2
|
+
Chef Provisioning
|
3
|
+
==========
|
4
|
+
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/opscode/chef-metal?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
5
|
+
|
6
|
+
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!
|
7
|
+
|
8
|
+
[This video](https://www.youtube.com/watch?v=Yb8QdL30WgM) explains the basics of chef-provisioning (though provisioners are now called drivers). Slides (more up to date) are [here](http://slides.com/jkeiser/chef-provisioning).
|
9
|
+
|
10
|
+
Date | Blog
|
11
|
+
-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
12
|
+
6/3/2014 | [machine_batch and parallelization](https://github.com/opscode/chef-provisioning/blob/master/docs/blogs/2012-05-28-machine_batch.html.markdown#chef-provisioning-parallelization)
|
13
|
+
6/3/2014 | [Chef Provisioning, Configuration and Drivers](https://github.com/opscode/chef-provisioning/blob/master/docs/blogs/2012-05-22-new-driver-interface.html.markdown#chef-provisioning-configuration-and-drivers)
|
14
|
+
3/4/2014 | [Chef Provisioning 0.2: Overview](http://www.getchef.com/blog/2014/03/04/chef-provisioning-0-2-release/) - this is a pretty good overview (though dated).
|
15
|
+
12/20/2013 | [Chef Provisioning Alpha](http://www.getchef.com/blog/2013/12/20/chef-provisioning-alpha/)
|
16
|
+
|
17
|
+
Documentation
|
18
|
+
-------------
|
19
|
+
* [Frequently Asked Questions](https://github.com/opscode/chef-provisioning/blob/master/docs/faq.md)
|
20
|
+
* [Configuration](https://github.com/opscode/chef-provisioning/blob/master/docs/configuration.md#configuring-and-using-provisioning-drivers)
|
21
|
+
* [Writing Drivers](https://github.com/opscode/chef-provisioning/blob/master/docs/building_drivers.md#writing-drivers)
|
22
|
+
* [Embedding](https://github.com/opscode/chef-provisioning/blob/master/docs/embedding.md)
|
23
|
+
* [Providers](https://github.com/opscode/chef-provisioning/blob/master/docs/providers)
|
24
|
+
|
25
|
+
Try It Out
|
26
|
+
----------
|
27
|
+
|
28
|
+
You can try out Chef Provisioning in many different flavors.
|
29
|
+
|
30
|
+
### Vagrant
|
31
|
+
|
32
|
+
To give it a spin, install Vagrant and VirtualBox and try this from the `chef-provisioning/docs/examples` directory:
|
33
|
+
|
34
|
+
```
|
35
|
+
gem install chef-provisioning chef-provisioning-vagrant
|
36
|
+
export CHEF_DRIVER=vagrant
|
37
|
+
chef-client -z vagrant_linux.rb simple.rb
|
38
|
+
```
|
39
|
+
|
40
|
+
This will create two vagrant precise64 linux boxes, "mario" and "luigi1", in `~/machinetest`, bootstrapped to an empty runlist. For Windows, you can replace `myapp::linux` with `myapp::windows`, but you'll need your own Windows vagrant box to do that (licensing!).
|
41
|
+
|
42
|
+
### AWS
|
43
|
+
|
44
|
+
If you have an AWS account, you can spin up a machine there like this:
|
45
|
+
|
46
|
+
```
|
47
|
+
gem install chef-provisioning chef-provisioning-fog
|
48
|
+
export CHEF_DRIVER=fog:AWS
|
49
|
+
chef-client -z simple.rb
|
50
|
+
```
|
51
|
+
|
52
|
+
This will create two linux boxes in the AWS account referenced by your default profile in `~/.aws/config` (or your environment variables).
|
53
|
+
|
54
|
+
### DigitalOcean
|
55
|
+
|
56
|
+
If you are on DigitalOcean and using the `tugboat` gem, you can do this:
|
57
|
+
|
58
|
+
```
|
59
|
+
gem install chef-provisioning chef-provisioning-fog
|
60
|
+
export CHEF_DRIVER=fog:DigitalOcean
|
61
|
+
chef-client -z simple.rb
|
62
|
+
```
|
63
|
+
|
64
|
+
If you aren't using the `tugboat` gem, you can put `driver` and `driver_options` into your `.chef/knife.rb` file.
|
65
|
+
|
66
|
+
This will use your tugboat settings to create whatever sort of instance you normally create.
|
67
|
+
|
68
|
+
### Cleaning up
|
69
|
+
|
70
|
+
When you are done with the examples, run this to clean up:
|
71
|
+
|
72
|
+
```
|
73
|
+
chef-client -z destroy_all.rb
|
74
|
+
```
|
75
|
+
|
76
|
+
What Is Chef Provisioning?
|
77
|
+
-------------------
|
78
|
+
|
79
|
+
Chef Provisioning has two major abstractions: the machine resource, and drivers.
|
80
|
+
|
81
|
+
### The `machine` resource
|
82
|
+
|
83
|
+
You declare what your machines do (recipes, tags, etc.) with the `machine` resource, the fundamental unit of Chef Provisioning. You will typically declare `machine` resources in a separate, OS/provisioning-independent file that declares the *topology* of your app--your machines and the recipes that will run on them.
|
84
|
+
|
85
|
+
The machine resources from the example [myapp::small](https://github.com/opscode/chef-provisioning/blob/master/cookbooks/myapp/recipes/small.rb) are pretty straightforward. Here's a copy/paste:
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
machine 'mario' do
|
89
|
+
recipe 'postgresql'
|
90
|
+
recipe 'mydb'
|
91
|
+
tag 'mydb_master'
|
92
|
+
end
|
93
|
+
|
94
|
+
num_webservers = 1
|
95
|
+
|
96
|
+
1.upto(num_webservers) do |i|
|
97
|
+
machine "luigi#{i}" do
|
98
|
+
recipe 'apache'
|
99
|
+
recipe 'mywebapp'
|
100
|
+
end
|
101
|
+
end
|
102
|
+
```
|
103
|
+
|
104
|
+
You will notice the dynamic nature of the number of web servers. It's all code, your imagination is the limit :)
|
105
|
+
|
106
|
+
### Drivers
|
107
|
+
|
108
|
+
Drivers handle the real work of getting those abstract definitions into real, physical form. They handle the following tasks, idempotently (you can run the resource again and again and it will only create the machine once--though it may notice things are wrong and fix them!):
|
109
|
+
|
110
|
+
* Acquiring machines from the cloud, creating containers or VMs, or grabbing bare metal
|
111
|
+
* Connecting to those machines via ssh, winrm, or other transports
|
112
|
+
* Bootstrapping chef onto the machines and converging the recipes you suggested
|
113
|
+
|
114
|
+
The driver API is separated out so that new drivers can be made with minimal effort (without having to rewrite ssh, tunneling, bootstrapping, and OS support). But to the user, they appear as a single thing, so that the machine acquisition can use its smarts to autodetect the other bits (transports, OS's, etc.).
|
115
|
+
|
116
|
+
Drivers 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.
|
117
|
+
|
118
|
+
Drivers each have their own repository. Current drivers:
|
119
|
+
|
120
|
+
**Cloud:**
|
121
|
+
- [FOG: EC2, DigitalOcean, OpenStack, etc.](https://github.com/opscode/chef-provisioning-fog)
|
122
|
+
|
123
|
+
**Virtualization:**
|
124
|
+
- [Vagrant: VirtualBox, VMWare Fusion, etc.](https://github.com/opscode/chef-provisioning-vagrant)
|
125
|
+
- [VSphere](https://github.com/RallySoftware-cookbooks/chef-provisioning-vsphere) (not yet up to date with 0.11)
|
126
|
+
|
127
|
+
**Containers:**
|
128
|
+
- [LXC](https://github.com/opscode/chef-provisioning-lxc) (not yet up to date with 0.11)
|
129
|
+
- [Docker](https://github.com/opscode/chef-provisioning-docker)
|
130
|
+
|
131
|
+
**Bare Metal:**
|
132
|
+
- [SSH (no PXE)](https://github.com/double-z/chef-provisioning-ssh) (not yet up to date with 0.11)
|
133
|
+
|
134
|
+
### Anatomy of a Recipe
|
135
|
+
|
136
|
+
chef-zero comes with a provisioner for Vagrant, an abstraction that covers VirtualBox, VMWare and other Virtual Machine drivers. In docs/examples, you can run this to try it:
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
export CHEF_DRIVER=vagrant
|
140
|
+
chef-client -z vagrant_linux.rb simple.rb
|
141
|
+
```
|
142
|
+
|
143
|
+
This is a chef-client run, which runs multiple **recipes.** Chef Provisioning is nothing but resources you put in recipes.
|
144
|
+
|
145
|
+
The driver is specified on the command line. Drivers are URLs. You could use `vagrant:~/vms` or `fog:AWS:default:us-east-1' as driver URLs. More information [here.](https://github.com/opscode/chef-provisioning/blob/master/docs/configuration.md#setting-the-driver-with-a-driver-url)
|
146
|
+
|
147
|
+
The `vagrant_linux.rb` recipe handles the physical specification of the machines and Vagrant box:
|
148
|
+
|
149
|
+
```ruby
|
150
|
+
require 'chef/provisioning_vagrant'
|
151
|
+
|
152
|
+
vagrant_box 'precise64' do
|
153
|
+
url 'http://files.vagrantup.com/precise64.box'
|
154
|
+
end
|
155
|
+
|
156
|
+
with_machine_options :vagrant_options => {
|
157
|
+
'vm.box' => 'precise64'
|
158
|
+
}
|
159
|
+
```
|
160
|
+
|
161
|
+
`require 'chef/provisioning_vagrant'` is how we bring in the `vagrant_box` resource.
|
162
|
+
|
163
|
+
`vagrant_box` makes sure a particular vagrant box exists, and lets you specify `machine_options` for things like port forwarding, OS definitions, and any other vagrant-isms.
|
164
|
+
|
165
|
+
Typically, you declare these in separate files from your machine resources. Chef Provisioning picks up the drivers and machine_options you have declared, and uses them to instantiate the machines you request. The actual machine definitions, in this case, are in `simple.rb`, and are generic--you could use them against Azure or EC2 as well:
|
166
|
+
|
167
|
+
```ruby
|
168
|
+
machine 'mario' do
|
169
|
+
tag 'itsame'
|
170
|
+
end
|
171
|
+
```
|
172
|
+
|
173
|
+
Other directives, like `recipe 'apache'`, help you set run lists and other information about the machine.
|
174
|
+
|
175
|
+
### Fog (EC2, Openstack and friends)
|
176
|
+
|
177
|
+
chef-provisioning also comes with a [Fog](http://fog.io/) provisioner that handles provisioning to Openstack, Rackspace, Amazon's EC2 and other cloud drivers. Before you begin, you will need to put your AWS credentials in ~/.aws/config in the format [mentioned in Option 1 here](http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#d0e726). There are other ways to specify your credentials, but this is the standard one for the Amazon CLI.
|
178
|
+
|
179
|
+
Once your credentials are in, basic usage looks like this:
|
180
|
+
|
181
|
+
```
|
182
|
+
export CHEF_DRIVER=fog:AWS
|
183
|
+
chef-client -z simple.rb
|
184
|
+
```
|
185
|
+
|
186
|
+
Other valid URLs include `fog:AWS:myprofilename` and `fog:AWS:profilename:us-west-2`.
|
187
|
+
|
188
|
+
Most Chef Provisioning drivers try hard to provide reasonable defaults so you can get started easily. Once you have specified your credentials, AMIs and other things are chosen for you.
|
189
|
+
|
190
|
+
You will usually want to create or input a custom key pair for bootstrap. To customize, specify keys and AMI and other options, you can make recipes like this:
|
191
|
+
|
192
|
+
```ruby
|
193
|
+
require 'chef/provisioning_fog'
|
194
|
+
|
195
|
+
fog_key_pair 'my_bootstrap_key'
|
196
|
+
|
197
|
+
with_machine_options :bootstrap_options => {
|
198
|
+
:key_name => 'my_bootstrap_key',
|
199
|
+
:image_id => 'ami-59a4a230',
|
200
|
+
:flavor_id => 't1.micro'
|
201
|
+
}
|
202
|
+
```
|
203
|
+
|
204
|
+
`fog_key_pair` creates a new key pair (if the files do not already exist) and uploads it to AWS (it will toss an error if the key pair already exists and does not match). By default, `fog_key_pair` will look for matching key files in .chef/keys, ~/.chef/keys and ~/.ssh. If it does not find one, it will place the key in `.chef/keys`. You can override this path in fog_key_pair, but if you do, you will want to modify `private_key_paths` in your configuration to match.
|
205
|
+
|
206
|
+
`with_machine_options` specifies machine_options that will be applied to any `machine` resources chef-client encounters.
|
207
|
+
|
208
|
+
You will notice that we are still using `simple.rb` here. Machine definitions are generally driver-independent. This is an important feature that allows you to spin up your clusters in different places to create staging, test or miniature dev environments.
|
209
|
+
|
210
|
+
### Pointing Boxes at Chef Servers
|
211
|
+
|
212
|
+
By default, Chef Provisioning will put your boxes on the same Chef server you started chef-client with (in the case of -z, that's a local chef-zero server). Sometimes you want to put your boxes on different servers. There are a couple of ways to do that:
|
213
|
+
|
214
|
+
```ruby
|
215
|
+
with_chef_local_server :chef_repo_path => '~/repo'
|
216
|
+
```
|
217
|
+
|
218
|
+
`with_chef_local_server` is a generic directive that creates a chef-zero server pointed at the given repository. nodes, clients, data bags, and all data will be stored here on your provisioner machine if you do this.
|
219
|
+
|
220
|
+
You can use `with_chef_server` instead if you want to point at OSS, Hosted or Enterprise Chef, and if you don't specify a Chef server at all, it will use the one you are running chef-client against. Keep in mind when using `with_chef_server` and running `chef-client -z` on your workstation that you will also need to set the client name and signing key for the chef server. If you've already got knife.rb set up, then something like this will correctly create a client for the chef server on instance using your knife.rb configuration:
|
221
|
+
|
222
|
+
```ruby
|
223
|
+
with_chef_server "https://chef-server.example.org",
|
224
|
+
:client_name => Chef::Config[:node_name],
|
225
|
+
:signing_key_filename => Chef::Config[:client_key]
|
226
|
+
```
|
227
|
+
|
228
|
+
**Note for Hosted/Enterprise Chef Servers**
|
229
|
+
|
230
|
+
Currently, you will need to add the 'clients' group to the 'admin' group in order for machine provisioning to work:
|
231
|
+
|
232
|
+
```
|
233
|
+
knife edit /groups/admin.json -e <editor>
|
234
|
+
```
|
235
|
+
Then add:
|
236
|
+
```
|
237
|
+
{
|
238
|
+
"users": [
|
239
|
+
"pivotal" # This is an internal superuser for Hosted/Enterprise Chef
|
240
|
+
],
|
241
|
+
"groups": [
|
242
|
+
"clients" # This is what you need to add
|
243
|
+
]
|
244
|
+
}
|
245
|
+
```
|
246
|
+
|
247
|
+
This can also be done through the Chef Server web UI (Administration tab > Groups > select admins Group > Add 'clients'
|
248
|
+
|
249
|
+
|
250
|
+
Kitchen
|
251
|
+
-------
|
252
|
+
|
253
|
+
Chef Provisioning 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.
|
254
|
+
|
255
|
+
Bugs and The Plan
|
256
|
+
-----------------
|
257
|
+
|
258
|
+
Please submit bugs, gripes and feature requests at [https://github.com/opscode/chef-provisioning/issues](https://twitter.com/jkeiser2), contact jkeiser on Twitter at @jkeiser2, email at [jkeiser@getchef.com](mailto:jkeiser@getchef.com)
|
259
|
+
|
260
|
+
To contribute, just make a PR in the appropriate repo--also, make sure you've [signed the Chef Contributor License Agreement](https://secure.echosign.com/public/hostedForm?formid=PJIF5694K6L) (quick couple of minutes online), since this is going into core Chef eventually. It takes some time to process, so if you've just done it, let me know in the PR :) If you already signed this for a Chef contribution, you don't need to do so again--if you're not sure, you can check for your name [here](https://wiki.opscode.com/display/chef/Approved+Contributors)!
|