chef-provisioning 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +899 -885
  3. data/Gemfile +17 -17
  4. data/LICENSE +201 -201
  5. data/README.md +312 -312
  6. data/Rakefile +55 -55
  7. data/chef-provisioning.gemspec +38 -38
  8. data/lib/chef/provider/load_balancer.rb +75 -75
  9. data/lib/chef/provider/machine.rb +219 -219
  10. data/lib/chef/provider/machine_batch.rb +224 -224
  11. data/lib/chef/provider/machine_execute.rb +36 -35
  12. data/lib/chef/provider/machine_file.rb +55 -55
  13. data/lib/chef/provider/machine_image.rb +105 -105
  14. data/lib/chef/provisioning.rb +110 -110
  15. data/lib/chef/provisioning/action_handler.rb +68 -68
  16. data/lib/chef/provisioning/add_prefix_action_handler.rb +35 -35
  17. data/lib/chef/provisioning/chef_managed_entry_store.rb +128 -128
  18. data/lib/chef/provisioning/chef_provider_action_handler.rb +74 -74
  19. data/lib/chef/provisioning/chef_run_data.rb +132 -132
  20. data/lib/chef/provisioning/convergence_strategy.rb +28 -28
  21. data/lib/chef/provisioning/convergence_strategy/ignore_convergence_failure.rb +54 -54
  22. data/lib/chef/provisioning/convergence_strategy/install_cached.rb +188 -188
  23. data/lib/chef/provisioning/convergence_strategy/install_msi.rb +71 -71
  24. data/lib/chef/provisioning/convergence_strategy/install_sh.rb +71 -71
  25. data/lib/chef/provisioning/convergence_strategy/no_converge.rb +35 -35
  26. data/lib/chef/provisioning/convergence_strategy/precreate_chef_objects.rb +255 -255
  27. data/lib/chef/provisioning/driver.rb +323 -323
  28. data/lib/chef/provisioning/load_balancer_spec.rb +14 -14
  29. data/lib/chef/provisioning/machine.rb +112 -112
  30. data/lib/chef/provisioning/machine/basic_machine.rb +84 -84
  31. data/lib/chef/provisioning/machine/unix_machine.rb +288 -288
  32. data/lib/chef/provisioning/machine/windows_machine.rb +108 -108
  33. data/lib/chef/provisioning/machine_image_spec.rb +34 -34
  34. data/lib/chef/provisioning/machine_spec.rb +58 -58
  35. data/lib/chef/provisioning/managed_entry.rb +121 -121
  36. data/lib/chef/provisioning/managed_entry_store.rb +136 -136
  37. data/lib/chef/provisioning/recipe_dsl.rb +99 -99
  38. data/lib/chef/provisioning/rspec.rb +27 -27
  39. data/lib/chef/provisioning/transport.rb +100 -100
  40. data/lib/chef/provisioning/transport/ssh.rb +403 -403
  41. data/lib/chef/provisioning/transport/winrm.rb +144 -156
  42. data/lib/chef/provisioning/version.rb +5 -5
  43. data/lib/chef/resource/chef_data_bag_resource.rb +146 -146
  44. data/lib/chef/resource/load_balancer.rb +57 -57
  45. data/lib/chef/resource/machine.rb +128 -128
  46. data/lib/chef/resource/machine_batch.rb +78 -78
  47. data/lib/chef/resource/machine_execute.rb +30 -29
  48. data/lib/chef/resource/machine_file.rb +34 -34
  49. data/lib/chef/resource/machine_image.rb +35 -35
  50. data/lib/chef_metal.rb +1 -1
  51. data/spec/chef/provisioning/convergence_strategy/ignore_convergence_failure_spec.rb +86 -86
  52. data/spec/spec_helper.rb +27 -27
  53. metadata +5 -5
data/Gemfile CHANGED
@@ -1,17 +1,17 @@
1
- source "https://rubygems.org"
2
- gemspec
3
-
4
- #gem 'mixlib-install', path: '../mixlib-install'
5
- #gem 'net-ssh', :path => '../net-ssh'
6
- #gem 'chef', :path => '../chef'
7
- #gem 'ohai', :path => '../ohai'
8
- #gem 'cheffish', :path => '../cheffish' # :git => 'https://github.com/jkeiser/cheffish.git'
9
- #gem 'chef-provisioning-vagrant', :path => '../chef-provisioning-vagrant'
10
- #gem 'chef-provisioning-fog', :path => '../chef-provisioning-fog'
11
- #gem 'chef-provisioning-aws', :path => '../chef-provisioning-aws'
12
- #gem 'chef-zero', :path => '../chef-zero'
13
- group :development do
14
- # gem "berkshelf", github: "berkshelf/berkshelf"
15
- # TODO we depend on the master branch until chef/chef is released
16
- gem "chef", github: "chef/chef", branch: "master"
17
- end
1
+ source "https://rubygems.org"
2
+ gemspec
3
+
4
+ #gem 'mixlib-install', path: '../mixlib-install'
5
+ #gem 'net-ssh', :path => '../net-ssh'
6
+ #gem 'chef', :path => '../chef'
7
+ #gem 'ohai', :path => '../ohai'
8
+ #gem 'cheffish', :path => '../cheffish' # :git => 'https://github.com/jkeiser/cheffish.git'
9
+ #gem 'chef-provisioning-vagrant', :path => '../chef-provisioning-vagrant'
10
+ #gem 'chef-provisioning-fog', :path => '../chef-provisioning-fog'
11
+ #gem 'chef-provisioning-aws', :path => '../chef-provisioning-aws'
12
+ #gem 'chef-zero', :path => '../chef-zero'
13
+ group :development do
14
+ # gem "berkshelf", github: "berkshelf/berkshelf"
15
+ # TODO we depend on the master branch until chef/chef is released
16
+ gem "chef", github: "chef/chef", branch: "master"
17
+ end
data/LICENSE CHANGED
@@ -1,201 +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.
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 CHANGED
@@ -1,312 +1,312 @@
1
- Chef Provisioning
2
- ==========
3
- [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/chef/chef-provisioning?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
- [![Stories in Ready](https://badge.waffle.io/chef/chef-provisioning.png?label=ready&title=Ready)](https://waffle.io/chef/chef-provisioning)
5
- [![Status](https://travis-ci.org/chef/chef-provisioning.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning)
6
- [![Gem Version](https://badge.fury.io/rb/chef-provisioning.svg)](http://badge.fury.io/rb/chef-provisioning)
7
-
8
- Driver build status:
9
-
10
- AWS | Azure | Docker | Fog | ssh | Vagrant
11
- ---- | ---- | ---- | ---- | ---- | ----
12
- [![Status](https://travis-ci.org/chef/chef-provisioning-aws.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-aws)| [![Status](https://travis-ci.org/chef/chef-provisioning-azure.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-azure) | [![Status](https://travis-ci.org/chef/chef-provisioning-docker.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-docker) | [![Status](https://travis-ci.org/chef/chef-provisioning-fog.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-fog) | [![Status](https://travis-ci.org/chef/chef-provisioning-ssh.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-ssh) | [![Status](https://travis-ci.org/chef/chef-provisioning-vagrant.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-vagrant)
13
- [![Gem Version](https://badge.fury.io/rb/chef-provisioning-aws.svg)](http://badge.fury.io/rb/chef-provisioning-aws) | [![Gem Version](https://badge.fury.io/rb/chef-provisioning-azure.svg)](http://badge.fury.io/rb/chef-provisioning-azure) | [![Gem Version](https://badge.fury.io/rb/chef-provisioning-docker.svg)](http://badge.fury.io/rb/chef-provisioning-docker) | [![Gem Version](https://badge.fury.io/rb/chef-provisioning-fog.svg)](http://badge.fury.io/rb/chef-provisioning-fog) | [![Gem Version](https://badge.fury.io/rb/chef-provisioning-ssh.svg)](http://badge.fury.io/rb/chef-provisioning-ssh) | [![Gem Version](https://badge.fury.io/rb/chef-provisioning-vagrant.svg)](http://badge.fury.io/rb/chef-provisioning-vagrant)
14
- 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!
15
-
16
- Documentation
17
- -------------
18
-
19
- These are the primary documents to help learn about using Provisioning and creating Provisioning drivers:
20
-
21
- * [Chef Docs](https://docs.chef.io/provisioning.html)
22
- * [Frequently Asked Questions](https://github.com/chef/chef-provisioning/blob/master/docs/faq.md)
23
- * [Configuration](https://github.com/chef/chef-provisioning/blob/master/docs/configuration.md#configuring-and-using-provisioning-drivers)
24
- * [Writing Drivers](https://github.com/chef/chef-provisioning/blob/master/docs/building_drivers.md#writing-drivers)
25
- * [Embedding](https://github.com/chef/chef-provisioning/blob/master/docs/embedding.md)
26
- * [Providers](https://github.com/chef/chef-provisioning/blob/master/docs/providers)
27
-
28
- Media
29
- -----
30
- [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-metal).
31
-
32
- Date | Blog
33
- -----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------
34
- 2014-12-15 | [Using Chef Provisioning to Build Chef Server](https://www.chef.io/blog/2014/12/15/sysadvent-day-14-using-chef-provisioning-to-build-chef-server/)
35
- 2014-11-12 | [Chef Launches Policy-Based Provisioning](https://www.chef.io/blog/2014/11/12/chef-launches-policy-based-provisioning/)
36
- 2014-11-12 | [Chef Provisioning: Infrastructure As Code](https://www.chef.io/blog/2014/11/12/chef-provisioning-infrastructure-as-code/)
37
- 2014-06-03 | [machine_batch and parallelization](https://github.com/chef/chef-provisioning/blob/master/docs/blogs/2012-05-28-machine_batch.html.markdown#chef-provisioning-parallelization)
38
- 2014-06-03 | [Chef Provisioning, Configuration and Drivers](https://github.com/chef/chef-provisioning/blob/master/docs/blogs/2012-05-22-new-driver-interface.html.markdown#chef-provisioning-configuration-and-drivers)
39
- 2014-03-04 | [Chef Metal 0.2: Overview](http://www.chef.io/blog/2014/03/04/chef-metal-0-2-release/) - this is a pretty good overview (though dated).
40
- 2013-12-20 | [Chef Metal Alpha](http://www.chef.io/blog/2013/12/20/chef-metal-alpha/)
41
-
42
- Try It Out
43
- ----------
44
-
45
- You can try out Chef Provisioning in many different flavors.
46
-
47
- ### Vagrant
48
-
49
- To give it a spin, install Vagrant and VirtualBox and try this from the `chef-provisioning/docs/examples` directory:
50
-
51
- ```
52
- gem install chef-provisioning chef-provisioning-vagrant
53
- export CHEF_DRIVER=vagrant
54
- export VAGRANT_DEFAULT_PROVIDER=virtualbox
55
- chef-client -z vagrant_linux.rb simple.rb
56
- ```
57
-
58
- 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!).
59
-
60
- ### AWS
61
-
62
- If you have an AWS account, you can spin up a machine there like this:
63
-
64
- ```
65
- gem install chef-provisioning chef-provisioning-aws
66
- export CHEF_DRIVER=aws
67
- chef-client -z simple.rb
68
- ```
69
-
70
- This will create two linux boxes in the AWS account referenced by your default profile in `~/.aws/config` (or your environment variables).
71
-
72
- ### DigitalOcean
73
-
74
- If you are on DigitalOcean and using the `tugboat` gem, you can do this:
75
-
76
- ```
77
- gem install chef-provisioning chef-provisioning-fog
78
- export CHEF_DRIVER=fog:DigitalOcean
79
- chef-client -z simple.rb
80
- ```
81
-
82
- If you aren't using the `tugboat` gem, you can put `driver` and `driver_options` into your `.chef/knife.rb` file.
83
-
84
- This will use your tugboat settings to create whatever sort of instance you normally create.
85
-
86
- ### Cleaning up
87
-
88
- When you are done with the examples, run this to clean up:
89
-
90
- ```
91
- chef-client -z destroy_all.rb
92
- ```
93
-
94
- What Is Chef Provisioning?
95
- -------------------
96
-
97
- Chef Provisioning has two major abstractions: the machine resource, and drivers.
98
-
99
- ### The `machine` resource
100
-
101
- 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.
102
-
103
- The machine resources from the [cluster.rb example](https://github.com/chef/chef-provisioning/blob/master/docs/examples/cluster.rb) are pretty straightforward. Here's a copy/paste:
104
-
105
- ```ruby
106
- # Database!
107
- machine 'mario' do
108
- recipe 'postgresql'
109
- recipe 'mydb'
110
- tag 'mydb_master'
111
- end
112
-
113
- num_webservers = 1
114
-
115
- # Web servers!
116
- 1.upto(num_webservers) do |i|
117
- machine "luigi#{i}" do
118
- recipe 'apache'
119
- recipe 'mywebapp'
120
- end
121
- end
122
- ```
123
-
124
- You will notice the dynamic nature of the number of web servers. It's all code, your imagination is the limit :)
125
-
126
- ### Drivers
127
-
128
- 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!):
129
-
130
- * Acquiring machines from the cloud, creating containers or VMs, or grabbing bare metal
131
- * Connecting to those machines via ssh, winrm, or other transports
132
- * Bootstrapping chef onto the machines and converging the recipes you suggested
133
-
134
- 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.).
135
-
136
- 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.
137
-
138
- Drivers each have their own repository. Current drivers:
139
-
140
- **Cloud:**
141
- - [AWS](https://github.com/chef/chef-provisioning-aws)
142
- - [Azure](https://github.com/chef/chef-provisioning-azure)
143
- - [FOG: EC2, DigitalOcean, OpenStack, etc.](https://github.com/chef/chef-provisioning-fog)
144
-
145
- **Virtualization:**
146
- - [Vagrant: VirtualBox, VMWare Fusion, etc.](https://github.com/chef/chef-provisioning-vagrant)
147
- - [VSphere](https://github.com/CenturyLinkCloud/chef-provisioning-vsphere)
148
-
149
- **Containers:**
150
- - [Docker](https://github.com/chef/chef-provisioning-docker)
151
-
152
- **Bare Metal:**
153
- - [OpenCrowbar](https://github.com/newgoliath/chef-provisioning-crowbar) OpenCrowbar controls your real metal. It discovers, inventories, configs RAID & BIOS and networks, and installs your OS. [OpenCrowbar website](http://www.opencrowbar.org) [OpenCrowbar github](https://github.com/opencrowbar/core)
154
- - [SSH (no PXE)](https://github.com/double-z/chef-metal-ssh) (not yet up to date with 0.11)
155
-
156
- **Seeking Maintainers:**
157
- These repositories are not actively maintained and are seeking maintainers.
158
- - [LXC](https://github.com/chef/chef-provisioning-lxc)
159
- - [Hanlon](https://github.com/chef/chef-provisioning-hanlon)
160
-
161
- ### Machine options
162
-
163
- You can pass machine options that will be used by `machine`, `machine_batch` and `machine_image` to
164
- configure the machine:
165
-
166
- ```ruby
167
- with_machine_options({
168
- convergence_options: {
169
- chef_version: "12.4.1",
170
- prerelease: "false",
171
- chef_client_timeout: 120*60, # Default: 2 hours
172
- chef_config: "log_level :debug\\n", # String containing additional text to inject into client.rb
173
- chef_server: "http://my.chef.server/", # TODO could conflict with https://github.com/chef/chef-provisioning#pointing-boxes-at-chef-servers
174
- bootstrap_proxy: "http://localhost:1234",
175
- bootstrap_no_proxy: "localhost, *.example.com, my.chef.server",
176
- ssl_verify_mode: :verify_peer,
177
- client_rb_path: "/etc/chef/client.rb", # <- DEFAULT, overwrite if necessary
178
- client_pem_path: "/etc/chef/client.pem", # <- DEFAULT, overwrite if necessary
179
- allow_overwrite_keys: false, # If there is an existing client.pem this needs to be true to overwrite it
180
- private_key_options: {}, # TODO ????? Something to do with creating node object
181
- source_key: "", # ?????
182
- source_key_pass_phrase: "", # ?????
183
- source_key_path: "", # ?????
184
- public_key_path: "", # ?????
185
- public_key_format: "", # ?????
186
- admin: "", # ?????
187
- validator: "", # ?????
188
- ohai_hints: { :ec2 => { :key => :value } }, # Map from hint file name to file contents, this would create /etc/chef/ohai/hints/ec2.json,
189
- ignore_failure: [1, 5..10, SomeSpecificError], # If true don't let a convergence failure on provisioned machine stop the provisioning workstation converge. Can also provide a single exit code to ignore (no array) or `true` to ignore all RuntimeErrors
190
- # The following are only available for Linux machines
191
- install_sh_url: "https://www.chef.io/chef/install.sh", # <- DEFAULT, overwrite if necessary
192
- install_sh_path: "/tmp/chef-install.sh", # <- DEFAULT, overwrite if necessary
193
- install_sh_arguments: "-P chef-dk", # Additional commands to pass to install.sh
194
- # The following are only available for Windows machines
195
- install_msi_url: "foo://bar.com"
196
- },
197
- ssh_username: "ubuntu", # Username to use for ssh and WinRM
198
- ssh_gateway: "user@gateway", # SSH gateway configuration
199
- ssh_options: { # a list of options to Net::SSH.start
200
- :auth_methods => [ 'publickey' ], # DEFAULT
201
- :keys_only => true, # DEFAULT
202
- :host_key_alias => "#{instance.id}.AWS", # DEFAULT
203
- :key_data => nil, # use key from ssh-agent instead of a local file; remember to ssh-add your keys!
204
- :forward_agent => true, # you may want your ssh-agent to be available on your provisioned machines
205
- :remote_forwards => [
206
- # Give remote host access to squid proxy on provisioning node
207
- {:remote_port => 3128, :local_host => 'localhost', :local_port => 3128,},
208
- # Give remote host access to private git server
209
- {:remote_port => 2222, :local_host => 'git.example.com', :local_port => 22,},
210
- ],
211
- # You can send net-ssh log info to the Chef::Log if you are having
212
- # trouble with ssh.
213
- :logger => Chef::Log,
214
- # If you use :logger => Chef::Log and :verbose then your :verbose setting
215
- # will override the global Chef::Config. Probably don't want to do this:
216
- #:verbose => :warn,
217
- }
218
- })
219
- ```
220
-
221
- This options hash can be supplied to either `with_machine_options` or directly into the `machine_options`
222
- attribute.
223
-
224
- Individual drivers will often add their own driver specific config. For example, AWS expects a `:bootstrap_options` hash at the same level as `:convergence_options`.
225
-
226
- ### Anatomy of a Recipe
227
-
228
- 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:
229
-
230
- ```ruby
231
- export CHEF_DRIVER=vagrant
232
- export VAGRANT_DEFAULT_PROVIDER=virtualbox
233
- chef-client -z vagrant_linux.rb simple.rb
234
- ```
235
-
236
- To use with VMWare, simply update the prior example to read ```export VAGRANT_DEFAULT_PROVIDER=vmware_fusion```
237
-
238
- This is a chef-client run, which runs multiple **recipes.** Chef Provisioning is nothing but resources you put in recipes.
239
-
240
- 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/chef/chef-provisioning/blob/master/docs/configuration.md#setting-the-driver-with-a-driver-url)
241
-
242
- The `vagrant_linux.rb` recipe handles the physical specification of the machines and Vagrant box:
243
-
244
- ```ruby
245
- require 'chef/provisioning/vagrant_driver'
246
-
247
- vagrant_box 'precise64' do
248
- url 'http://files.vagrantup.com/precise64.box'
249
- end
250
-
251
- with_machine_options :vagrant_options => {
252
- 'vm.box' => 'precise64'
253
- }
254
- ```
255
-
256
- `require 'chef/provisioning/vagrant_driver'` is how we bring in the `vagrant_box` resource.
257
-
258
- `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.
259
-
260
- 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:
261
-
262
- ```ruby
263
- machine 'mario' do
264
- tag 'itsame'
265
- end
266
- ```
267
-
268
- Other directives, like `recipe 'apache'`, help you set run lists and other information about the machine.
269
-
270
- ### Pointing Boxes at Chef Servers
271
-
272
- 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:
273
-
274
- ```ruby
275
- with_chef_local_server :chef_repo_path => '~/repo'
276
- ```
277
-
278
- `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.
279
-
280
- 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 in the provisioning recipe will correctly create a client for the chef server on instance using your knife.rb configuration:
281
-
282
- ```ruby
283
- with_chef_server "https://chef-server.example.org",
284
- :client_name => Chef::Config[:node_name],
285
- :signing_key_filename => Chef::Config[:client_key]
286
- ```
287
-
288
- Finally, you can specify a Chef Server for an individual machine by using the `chef_server` attribute. This attribute takes the same additional options (`:client_name`, `:signing_key_filename`) that `with_chef_server` does.
289
-
290
- ```ruby
291
- machine 'mario' do
292
- chef_server :chef_server_url => "https://chef-server.example.org"
293
- end
294
- ```
295
-
296
- Kitchen
297
- -------
298
-
299
- 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.
300
-
301
-
302
- Fixing conflict with chef-zero 3.2.1 and ~> 4.0
303
- -----------------------------------------------
304
-
305
- If you run into the error `Unable to activate cheffish-1.0.0, because chef-zero-3.2.1 conflicts with chef-zero (~> 4.0)` you'll need to update the version of the chef gem included in the ChefDK. Follow the instructions @ [https://github.com/fnichol/chefdk-update-app](https://github.com/fnichol/chefdk-update-app) and update chef to ~>12.2.1
306
-
307
- Bugs and The Plan
308
- -----------------
309
-
310
- Please submit bugs, gripes and feature requests at [https://github.com/chef/chef-provisioning/issues](https://github.com/chef/chef-provisioning/issues), contact John Keiser on Twitter at [@jkeiser2](https://twitter.com/jkeiser2), email at [jkeiser@chef.io](mailto:jkeiser@chef.io)
311
-
312
- To contribute, just make a PR in the appropriate repo--also, make sure you've [signed the Chef Contributor License Agreement](https://supermarket.chef.io) (through your Chef Supermarket profile), since this is going into core Chef eventually. 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://supermarket.chef.io/contributors) or if you signed up long ago check the [old list](https://github.com/chef/chef/blob/master/CLA_ARCHIVE.md)!
1
+ Chef Provisioning
2
+ ==========
3
+ [![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/chef/chef-provisioning?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
4
+ [![Stories in Ready](https://badge.waffle.io/chef/chef-provisioning.png?label=ready&title=Ready)](https://waffle.io/chef/chef-provisioning)
5
+ [![Status](https://travis-ci.org/chef/chef-provisioning.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning)
6
+ [![Gem Version](https://badge.fury.io/rb/chef-provisioning.svg)](http://badge.fury.io/rb/chef-provisioning)
7
+
8
+ Driver build status:
9
+
10
+ AWS | Azure | Docker | Fog | ssh | Vagrant
11
+ ---- | ---- | ---- | ---- | ---- | ----
12
+ [![Status](https://travis-ci.org/chef/chef-provisioning-aws.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-aws)| [![Status](https://travis-ci.org/chef/chef-provisioning-azure.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-azure) | [![Status](https://travis-ci.org/chef/chef-provisioning-docker.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-docker) | [![Status](https://travis-ci.org/chef/chef-provisioning-fog.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-fog) | [![Status](https://travis-ci.org/chef/chef-provisioning-ssh.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-ssh) | [![Status](https://travis-ci.org/chef/chef-provisioning-vagrant.svg?branch=master)](https://travis-ci.org/chef/chef-provisioning-vagrant)
13
+ [![Gem Version](https://badge.fury.io/rb/chef-provisioning-aws.svg)](http://badge.fury.io/rb/chef-provisioning-aws) | [![Gem Version](https://badge.fury.io/rb/chef-provisioning-azure.svg)](http://badge.fury.io/rb/chef-provisioning-azure) | [![Gem Version](https://badge.fury.io/rb/chef-provisioning-docker.svg)](http://badge.fury.io/rb/chef-provisioning-docker) | [![Gem Version](https://badge.fury.io/rb/chef-provisioning-fog.svg)](http://badge.fury.io/rb/chef-provisioning-fog) | [![Gem Version](https://badge.fury.io/rb/chef-provisioning-ssh.svg)](http://badge.fury.io/rb/chef-provisioning-ssh) | [![Gem Version](https://badge.fury.io/rb/chef-provisioning-vagrant.svg)](http://badge.fury.io/rb/chef-provisioning-vagrant)
14
+ 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!
15
+
16
+ Documentation
17
+ -------------
18
+
19
+ These are the primary documents to help learn about using Provisioning and creating Provisioning drivers:
20
+
21
+ * [Chef Docs](https://docs.chef.io/provisioning.html)
22
+ * [Frequently Asked Questions](https://github.com/chef/chef-provisioning/blob/master/docs/faq.md)
23
+ * [Configuration](https://github.com/chef/chef-provisioning/blob/master/docs/configuration.md#configuring-and-using-provisioning-drivers)
24
+ * [Writing Drivers](https://github.com/chef/chef-provisioning/blob/master/docs/building_drivers.md#writing-drivers)
25
+ * [Embedding](https://github.com/chef/chef-provisioning/blob/master/docs/embedding.md)
26
+ * [Providers](https://github.com/chef/chef-provisioning/blob/master/docs/providers)
27
+
28
+ Media
29
+ -----
30
+ [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-metal).
31
+
32
+ Date | Blog
33
+ -----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------
34
+ 2014-12-15 | [Using Chef Provisioning to Build Chef Server](https://www.chef.io/blog/2014/12/15/sysadvent-day-14-using-chef-provisioning-to-build-chef-server/)
35
+ 2014-11-12 | [Chef Launches Policy-Based Provisioning](https://www.chef.io/blog/2014/11/12/chef-launches-policy-based-provisioning/)
36
+ 2014-11-12 | [Chef Provisioning: Infrastructure As Code](https://www.chef.io/blog/2014/11/12/chef-provisioning-infrastructure-as-code/)
37
+ 2014-06-03 | [machine_batch and parallelization](https://github.com/chef/chef-provisioning/blob/master/docs/blogs/2012-05-28-machine_batch.html.markdown#chef-provisioning-parallelization)
38
+ 2014-06-03 | [Chef Provisioning, Configuration and Drivers](https://github.com/chef/chef-provisioning/blob/master/docs/blogs/2012-05-22-new-driver-interface.html.markdown#chef-provisioning-configuration-and-drivers)
39
+ 2014-03-04 | [Chef Metal 0.2: Overview](http://www.chef.io/blog/2014/03/04/chef-metal-0-2-release/) - this is a pretty good overview (though dated).
40
+ 2013-12-20 | [Chef Metal Alpha](http://www.chef.io/blog/2013/12/20/chef-metal-alpha/)
41
+
42
+ Try It Out
43
+ ----------
44
+
45
+ You can try out Chef Provisioning in many different flavors.
46
+
47
+ ### Vagrant
48
+
49
+ To give it a spin, install Vagrant and VirtualBox and try this from the `chef-provisioning/docs/examples` directory:
50
+
51
+ ```
52
+ gem install chef-provisioning chef-provisioning-vagrant
53
+ export CHEF_DRIVER=vagrant
54
+ export VAGRANT_DEFAULT_PROVIDER=virtualbox
55
+ chef-client -z vagrant_linux.rb simple.rb
56
+ ```
57
+
58
+ 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!).
59
+
60
+ ### AWS
61
+
62
+ If you have an AWS account, you can spin up a machine there like this:
63
+
64
+ ```
65
+ gem install chef-provisioning chef-provisioning-aws
66
+ export CHEF_DRIVER=aws
67
+ chef-client -z simple.rb
68
+ ```
69
+
70
+ This will create two linux boxes in the AWS account referenced by your default profile in `~/.aws/config` (or your environment variables).
71
+
72
+ ### DigitalOcean
73
+
74
+ If you are on DigitalOcean and using the `tugboat` gem, you can do this:
75
+
76
+ ```
77
+ gem install chef-provisioning chef-provisioning-fog
78
+ export CHEF_DRIVER=fog:DigitalOcean
79
+ chef-client -z simple.rb
80
+ ```
81
+
82
+ If you aren't using the `tugboat` gem, you can put `driver` and `driver_options` into your `.chef/knife.rb` file.
83
+
84
+ This will use your tugboat settings to create whatever sort of instance you normally create.
85
+
86
+ ### Cleaning up
87
+
88
+ When you are done with the examples, run this to clean up:
89
+
90
+ ```
91
+ chef-client -z destroy_all.rb
92
+ ```
93
+
94
+ What Is Chef Provisioning?
95
+ -------------------
96
+
97
+ Chef Provisioning has two major abstractions: the machine resource, and drivers.
98
+
99
+ ### The `machine` resource
100
+
101
+ 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.
102
+
103
+ The machine resources from the [cluster.rb example](https://github.com/chef/chef-provisioning/blob/master/docs/examples/cluster.rb) are pretty straightforward. Here's a copy/paste:
104
+
105
+ ```ruby
106
+ # Database!
107
+ machine 'mario' do
108
+ recipe 'postgresql'
109
+ recipe 'mydb'
110
+ tag 'mydb_master'
111
+ end
112
+
113
+ num_webservers = 1
114
+
115
+ # Web servers!
116
+ 1.upto(num_webservers) do |i|
117
+ machine "luigi#{i}" do
118
+ recipe 'apache'
119
+ recipe 'mywebapp'
120
+ end
121
+ end
122
+ ```
123
+
124
+ You will notice the dynamic nature of the number of web servers. It's all code, your imagination is the limit :)
125
+
126
+ ### Drivers
127
+
128
+ 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!):
129
+
130
+ * Acquiring machines from the cloud, creating containers or VMs, or grabbing bare metal
131
+ * Connecting to those machines via ssh, winrm, or other transports
132
+ * Bootstrapping chef onto the machines and converging the recipes you suggested
133
+
134
+ 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.).
135
+
136
+ 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.
137
+
138
+ Drivers each have their own repository. Current drivers:
139
+
140
+ **Cloud:**
141
+ - [AWS](https://github.com/chef/chef-provisioning-aws)
142
+ - [Azure](https://github.com/chef/chef-provisioning-azure)
143
+ - [FOG: EC2, DigitalOcean, OpenStack, etc.](https://github.com/chef/chef-provisioning-fog)
144
+
145
+ **Virtualization:**
146
+ - [Vagrant: VirtualBox, VMWare Fusion, etc.](https://github.com/chef/chef-provisioning-vagrant)
147
+ - [VSphere](https://github.com/CenturyLinkCloud/chef-provisioning-vsphere)
148
+
149
+ **Containers:**
150
+ - [Docker](https://github.com/chef/chef-provisioning-docker)
151
+
152
+ **Bare Metal:**
153
+ - [OpenCrowbar](https://github.com/newgoliath/chef-provisioning-crowbar) OpenCrowbar controls your real metal. It discovers, inventories, configs RAID & BIOS and networks, and installs your OS. [OpenCrowbar website](http://www.opencrowbar.org) [OpenCrowbar github](https://github.com/opencrowbar/core)
154
+ - [SSH (no PXE)](https://github.com/double-z/chef-metal-ssh) (not yet up to date with 0.11)
155
+
156
+ **Seeking Maintainers:**
157
+ These repositories are not actively maintained and are seeking maintainers.
158
+ - [LXC](https://github.com/chef/chef-provisioning-lxc)
159
+ - [Hanlon](https://github.com/chef/chef-provisioning-hanlon)
160
+
161
+ ### Machine options
162
+
163
+ You can pass machine options that will be used by `machine`, `machine_batch` and `machine_image` to
164
+ configure the machine:
165
+
166
+ ```ruby
167
+ with_machine_options({
168
+ convergence_options: {
169
+ chef_version: "12.4.1",
170
+ prerelease: "false",
171
+ chef_client_timeout: 120*60, # Default: 2 hours
172
+ chef_config: "log_level :debug\\n", # String containing additional text to inject into client.rb
173
+ chef_server: "http://my.chef.server/", # TODO could conflict with https://github.com/chef/chef-provisioning#pointing-boxes-at-chef-servers
174
+ bootstrap_proxy: "http://localhost:1234",
175
+ bootstrap_no_proxy: "localhost, *.example.com, my.chef.server",
176
+ ssl_verify_mode: :verify_peer,
177
+ client_rb_path: "/etc/chef/client.rb", # <- DEFAULT, overwrite if necessary
178
+ client_pem_path: "/etc/chef/client.pem", # <- DEFAULT, overwrite if necessary
179
+ allow_overwrite_keys: false, # If there is an existing client.pem this needs to be true to overwrite it
180
+ private_key_options: {}, # TODO ????? Something to do with creating node object
181
+ source_key: "", # ?????
182
+ source_key_pass_phrase: "", # ?????
183
+ source_key_path: "", # ?????
184
+ public_key_path: "", # ?????
185
+ public_key_format: "", # ?????
186
+ admin: "", # ?????
187
+ validator: "", # ?????
188
+ ohai_hints: { :ec2 => { :key => :value } }, # Map from hint file name to file contents, this would create /etc/chef/ohai/hints/ec2.json,
189
+ ignore_failure: [1, 5..10, SomeSpecificError], # If true don't let a convergence failure on provisioned machine stop the provisioning workstation converge. Can also provide a single exit code to ignore (no array) or `true` to ignore all RuntimeErrors
190
+ # The following are only available for Linux machines
191
+ install_sh_url: "https://www.chef.io/chef/install.sh", # <- DEFAULT, overwrite if necessary
192
+ install_sh_path: "/tmp/chef-install.sh", # <- DEFAULT, overwrite if necessary
193
+ install_sh_arguments: "-P chef-dk", # Additional commands to pass to install.sh
194
+ # The following are only available for Windows machines
195
+ install_msi_url: "foo://bar.com"
196
+ },
197
+ ssh_username: "ubuntu", # Username to use for ssh and WinRM
198
+ ssh_gateway: "user@gateway", # SSH gateway configuration
199
+ ssh_options: { # a list of options to Net::SSH.start
200
+ :auth_methods => [ 'publickey' ], # DEFAULT
201
+ :keys_only => true, # DEFAULT
202
+ :host_key_alias => "#{instance.id}.AWS", # DEFAULT
203
+ :key_data => nil, # use key from ssh-agent instead of a local file; remember to ssh-add your keys!
204
+ :forward_agent => true, # you may want your ssh-agent to be available on your provisioned machines
205
+ :remote_forwards => [
206
+ # Give remote host access to squid proxy on provisioning node
207
+ {:remote_port => 3128, :local_host => 'localhost', :local_port => 3128,},
208
+ # Give remote host access to private git server
209
+ {:remote_port => 2222, :local_host => 'git.example.com', :local_port => 22,},
210
+ ],
211
+ # You can send net-ssh log info to the Chef::Log if you are having
212
+ # trouble with ssh.
213
+ :logger => Chef::Log,
214
+ # If you use :logger => Chef::Log and :verbose then your :verbose setting
215
+ # will override the global Chef::Config. Probably don't want to do this:
216
+ #:verbose => :warn,
217
+ }
218
+ })
219
+ ```
220
+
221
+ This options hash can be supplied to either `with_machine_options` or directly into the `machine_options`
222
+ attribute.
223
+
224
+ Individual drivers will often add their own driver specific config. For example, AWS expects a `:bootstrap_options` hash at the same level as `:convergence_options`.
225
+
226
+ ### Anatomy of a Recipe
227
+
228
+ 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:
229
+
230
+ ```ruby
231
+ export CHEF_DRIVER=vagrant
232
+ export VAGRANT_DEFAULT_PROVIDER=virtualbox
233
+ chef-client -z vagrant_linux.rb simple.rb
234
+ ```
235
+
236
+ To use with VMWare, simply update the prior example to read ```export VAGRANT_DEFAULT_PROVIDER=vmware_fusion```
237
+
238
+ This is a chef-client run, which runs multiple **recipes.** Chef Provisioning is nothing but resources you put in recipes.
239
+
240
+ 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/chef/chef-provisioning/blob/master/docs/configuration.md#setting-the-driver-with-a-driver-url)
241
+
242
+ The `vagrant_linux.rb` recipe handles the physical specification of the machines and Vagrant box:
243
+
244
+ ```ruby
245
+ require 'chef/provisioning/vagrant_driver'
246
+
247
+ vagrant_box 'precise64' do
248
+ url 'http://files.vagrantup.com/precise64.box'
249
+ end
250
+
251
+ with_machine_options :vagrant_options => {
252
+ 'vm.box' => 'precise64'
253
+ }
254
+ ```
255
+
256
+ `require 'chef/provisioning/vagrant_driver'` is how we bring in the `vagrant_box` resource.
257
+
258
+ `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.
259
+
260
+ 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:
261
+
262
+ ```ruby
263
+ machine 'mario' do
264
+ tag 'itsame'
265
+ end
266
+ ```
267
+
268
+ Other directives, like `recipe 'apache'`, help you set run lists and other information about the machine.
269
+
270
+ ### Pointing Boxes at Chef Servers
271
+
272
+ 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:
273
+
274
+ ```ruby
275
+ with_chef_local_server :chef_repo_path => '~/repo'
276
+ ```
277
+
278
+ `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.
279
+
280
+ 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 in the provisioning recipe will correctly create a client for the chef server on instance using your knife.rb configuration:
281
+
282
+ ```ruby
283
+ with_chef_server "https://chef-server.example.org",
284
+ :client_name => Chef::Config[:node_name],
285
+ :signing_key_filename => Chef::Config[:client_key]
286
+ ```
287
+
288
+ Finally, you can specify a Chef Server for an individual machine by using the `chef_server` attribute. This attribute takes the same additional options (`:client_name`, `:signing_key_filename`) that `with_chef_server` does.
289
+
290
+ ```ruby
291
+ machine 'mario' do
292
+ chef_server :chef_server_url => "https://chef-server.example.org"
293
+ end
294
+ ```
295
+
296
+ Kitchen
297
+ -------
298
+
299
+ 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.
300
+
301
+
302
+ Fixing conflict with chef-zero 3.2.1 and ~> 4.0
303
+ -----------------------------------------------
304
+
305
+ If you run into the error `Unable to activate cheffish-1.0.0, because chef-zero-3.2.1 conflicts with chef-zero (~> 4.0)` you'll need to update the version of the chef gem included in the ChefDK. Follow the instructions @ [https://github.com/fnichol/chefdk-update-app](https://github.com/fnichol/chefdk-update-app) and update chef to ~>12.2.1
306
+
307
+ Bugs and The Plan
308
+ -----------------
309
+
310
+ Please submit bugs, gripes and feature requests at [https://github.com/chef/chef-provisioning/issues](https://github.com/chef/chef-provisioning/issues), contact John Keiser on Twitter at [@jkeiser2](https://twitter.com/jkeiser2), email at [jkeiser@chef.io](mailto:jkeiser@chef.io)
311
+
312
+ To contribute, just make a PR in the appropriate repo--also, make sure you've [signed the Chef Contributor License Agreement](https://supermarket.chef.io) (through your Chef Supermarket profile), since this is going into core Chef eventually. 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://supermarket.chef.io/contributors) or if you signed up long ago check the [old list](https://github.com/chef/chef/blob/master/CLA_ARCHIVE.md)!