chef-provisioning-fog 0.26.1 → 0.26.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +29 -8
  3. data/Rakefile +23 -12
  4. data/chef-provisioning-fog.gemspec +24 -27
  5. data/lib/chef/provider/fog_key_pair.rb +49 -53
  6. data/lib/chef/provider/scaleway_volume.rb +46 -48
  7. data/lib/chef/provisioning/driver_init/fog.rb +1 -1
  8. data/lib/chef/provisioning/fog_driver/driver.rb +646 -653
  9. data/lib/chef/provisioning/fog_driver/providers/aws.rb +411 -422
  10. data/lib/chef/provisioning/fog_driver/providers/aws/credentials.rb +88 -90
  11. data/lib/chef/provisioning/fog_driver/providers/cloudstack.rb +32 -34
  12. data/lib/chef/provisioning/fog_driver/providers/digitalocean.rb +98 -100
  13. data/lib/chef/provisioning/fog_driver/providers/google.rb +27 -34
  14. data/lib/chef/provisioning/fog_driver/providers/joyent.rb +53 -55
  15. data/lib/chef/provisioning/fog_driver/providers/openstack.rb +139 -146
  16. data/lib/chef/provisioning/fog_driver/providers/rackspace.rb +40 -44
  17. data/lib/chef/provisioning/fog_driver/providers/scaleway.rb +183 -189
  18. data/lib/chef/provisioning/fog_driver/providers/softlayer.rb +61 -64
  19. data/lib/chef/provisioning/fog_driver/providers/vcair.rb +72 -78
  20. data/lib/chef/provisioning/fog_driver/providers/xenserver.rb +56 -69
  21. data/lib/chef/provisioning/fog_driver/recipe_dsl.rb +11 -12
  22. data/lib/chef/provisioning/fog_driver/version.rb +1 -1
  23. data/lib/chef/resource/fog_key_pair.rb +8 -8
  24. data/lib/chef/resource/scaleway_volume.rb +8 -8
  25. data/spec/spec_helper.rb +7 -7
  26. data/spec/support/chef/provisioning/fog_driver/providers/testdriver.rb +3 -3
  27. data/spec/unit/chef/provisioning/fog_driver/driver_spec.rb +39 -38
  28. data/spec/unit/fog_driver_spec.rb +6 -8
  29. data/spec/unit/providers/aws/credentials_spec.rb +10 -10
  30. data/spec/unit/providers/rackspace_spec.rb +5 -6
  31. data/spec/unit/providers/scaleway_spec.rb +9 -9
  32. data/spec/unit/providers/softlayer.rb +7 -7
  33. metadata +6 -36
  34. data/README.md +0 -357
@@ -1,10 +1,9 @@
1
- require 'spec_helper'
2
- require 'chef/provisioning/fog_driver/providers/testdriver'
1
+ require "spec_helper"
2
+ require "chef/provisioning/fog_driver/providers/testdriver"
3
3
 
4
4
  describe Chef::Provisioning::FogDriver do
5
-
6
5
  describe ".from_url" do
7
- subject { Chef::Provisioning::FogDriver::Driver.from_provider('TestDriver', {}) }
6
+ subject { Chef::Provisioning::FogDriver::Driver.from_provider("TestDriver", {}) }
8
7
 
9
8
  it "should return the correct class" do
10
9
  expect(subject).to be_an_instance_of Chef::Provisioning::FogDriver::Providers::TestDriver
@@ -12,20 +11,19 @@ describe Chef::Provisioning::FogDriver do
12
11
 
13
12
  it "should call the target compute_options_for" do
14
13
  expect(Chef::Provisioning::FogDriver::Providers::TestDriver).to receive(:compute_options_for)
15
- .with('TestDriver', anything, {}).and_return([{}, 'test']).twice
14
+ .with("TestDriver", anything, {}).and_return([{}, "test"]).twice
16
15
  subject
17
16
  end
18
-
19
17
  end
20
18
 
21
19
  describe "when creating a new class" do
22
20
  it "should return the correct class" do
23
- test = Chef::Provisioning::FogDriver::Driver.new('fog:TestDriver:foo', {})
21
+ test = Chef::Provisioning::FogDriver::Driver.new("fog:TestDriver:foo", {})
24
22
  expect(test).to be_an_instance_of Chef::Provisioning::FogDriver::Providers::TestDriver
25
23
  end
26
24
 
27
25
  it "should populate config" do
28
- test = Chef::Provisioning::FogDriver::Driver.new('fog:TestDriver:foo', {test: "chef_provisioning"})
26
+ test = Chef::Provisioning::FogDriver::Driver.new("fog:TestDriver:foo", test: "chef_provisioning")
29
27
  expect(test.config[:test]).to eq "chef_provisioning"
30
28
  end
31
29
  end
@@ -1,24 +1,24 @@
1
- require 'chef/provisioning/fog_driver/providers/aws/credentials'
1
+ require "chef/provisioning/fog_driver/providers/aws/credentials"
2
2
 
3
3
  describe Chef::Provisioning::FogDriver::Providers::AWS::Credentials do
4
4
  let(:credentials) { Chef::Provisioning::FogDriver::Providers::AWS::Credentials.new }
5
5
 
6
6
  describe "#load_inis" do
7
- let(:aws_credentials_ini_file) { File.join(File.expand_path('../../../../support', __FILE__), 'aws/ini-file.ini') }
7
+ let(:aws_credentials_ini_file) { File.join(File.expand_path("../../../support", __dir__), "aws/ini-file.ini") }
8
8
 
9
9
  before do
10
10
  credentials.load_inis(aws_credentials_ini_file)
11
11
  end
12
12
 
13
13
  it "should load a default profile" do
14
- expect(credentials['default']).to include(:aws_access_key_id)
14
+ expect(credentials["default"]).to include(:aws_access_key_id)
15
15
  end
16
16
 
17
17
  it "should load the correct values" do
18
- expect(credentials['default'][:aws_access_key_id]).to eq 12345
19
- expect(credentials['default'][:aws_secret_access_key]).to eq "abcde"
20
- expect(credentials['default'][:region]).to eq "us-east-1"
21
- expect(credentials['default'][:aws_session_token]).to eq "mysecret"
18
+ expect(credentials["default"][:aws_access_key_id]).to eq 12_345
19
+ expect(credentials["default"][:aws_secret_access_key]).to eq "abcde"
20
+ expect(credentials["default"][:region]).to eq "us-east-1"
21
+ expect(credentials["default"][:aws_session_token]).to eq "mysecret"
22
22
  end
23
23
 
24
24
  it "should load several profiles" do
@@ -27,17 +27,17 @@ describe Chef::Provisioning::FogDriver::Providers::AWS::Credentials do
27
27
  end
28
28
 
29
29
  describe "#load_csv" do
30
- let(:aws_credentials_csv_file) { File.join(File.expand_path('../../../../support', __FILE__), 'aws/config-file.csv') }
30
+ let(:aws_credentials_csv_file) { File.join(File.expand_path("../../../support", __dir__), "aws/config-file.csv") }
31
31
  before do
32
32
  credentials.load_csv(aws_credentials_csv_file)
33
33
  end
34
34
 
35
35
  it "should load a single profile" do
36
- expect(credentials['test']).to include(:aws_access_key_id)
36
+ expect(credentials["test"]).to include(:aws_access_key_id)
37
37
  end
38
38
 
39
39
  it "should load the correct values" do
40
- expect(credentials['test'][:aws_access_key_id]).to eq "67890"
40
+ expect(credentials["test"][:aws_access_key_id]).to eq "67890"
41
41
  end
42
42
 
43
43
  it "should load several profiles" do
@@ -1,12 +1,12 @@
1
- require 'spec_helper'
2
- require 'chef/provisioning/fog_driver/providers/rackspace'
1
+ require "spec_helper"
2
+ require "chef/provisioning/fog_driver/providers/rackspace"
3
3
 
4
4
  describe Chef::Provisioning::FogDriver::Providers::Rackspace do
5
5
  subject do
6
6
  Chef::Provisioning::FogDriver::Driver.from_provider(
7
- 'Rackspace', driver_options: { compute_options: {
8
- rackspace_username: 'test_username', rackspace_api_key: 'test_api_key'}
9
- }
7
+ "Rackspace", driver_options: { compute_options: {
8
+ rackspace_username: "test_username", rackspace_api_key: "test_api_key"
9
+ } }
10
10
  )
11
11
  end
12
12
 
@@ -18,5 +18,4 @@ describe Chef::Provisioning::FogDriver::Providers::Rackspace do
18
18
  pending unless Fog.mock?
19
19
  expect(subject.compute).to be_an_instance_of Fog::Compute::RackspaceV2::Mock
20
20
  end
21
-
22
21
  end
@@ -1,13 +1,13 @@
1
- require 'spec_helper'
2
- require 'chef/provisioning/fog_driver/providers/scaleway'
1
+ require "spec_helper"
2
+ require "chef/provisioning/fog_driver/providers/scaleway"
3
3
 
4
4
  describe Chef::Provisioning::FogDriver::Providers::Scaleway do
5
5
  subject do
6
6
  Chef::Provisioning::FogDriver::Driver.from_provider(
7
- 'Scaleway', driver_options: { compute_options: {
8
- scaleway_organization: 'org',
9
- scaleway_token: 'key'}
10
- }
7
+ "Scaleway", driver_options: { compute_options: {
8
+ scaleway_organization: "org",
9
+ scaleway_token: "key"
10
+ } }
11
11
  )
12
12
  end
13
13
 
@@ -20,9 +20,9 @@ describe Chef::Provisioning::FogDriver::Providers::Scaleway do
20
20
  expect(subject.compute).to be_an_instance_of Fog::Scaleway::Compute::Mock
21
21
  end
22
22
 
23
- describe '#creator' do
24
- it 'returns the organization' do
25
- expect(subject.creator).to eq 'org'
23
+ describe "#creator" do
24
+ it "returns the organization" do
25
+ expect(subject.creator).to eq "org"
26
26
  end
27
27
  end
28
28
  end
@@ -1,13 +1,14 @@
1
- require 'spec_helper'
2
- require 'chef/provisioning/fog_driver/providers/softlayer'
1
+ require "spec_helper"
2
+ require "chef/provisioning/fog_driver/providers/softlayer"
3
3
 
4
4
  describe Chef::Provisioning::FogDriver::Providers::SoftLayer do
5
5
  subject do
6
6
  Chef::Provisioning::FogDriver::Driver.from_provider(
7
- 'SoftLayer',
8
- driver_options: {
9
- compute_options: {
10
- softlayer_username: 'test_username', softlayer_api_key: 'test_api_key'}
7
+ "SoftLayer",
8
+ driver_options: {
9
+ compute_options: {
10
+ softlayer_username: "test_username", softlayer_api_key: "test_api_key"
11
+ }
11
12
  }
12
13
  )
13
14
  end
@@ -21,4 +22,3 @@ describe Chef::Provisioning::FogDriver::Providers::SoftLayer do
21
22
  expect(subject.compute).to be_an_instance_of Fog::Compute::Softlayer::Mock
22
23
  end
23
24
  end
24
-
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chef-provisioning-fog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.26.1
4
+ version: 0.26.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
@@ -12,7 +12,7 @@ authors:
12
12
  autorequire:
13
13
  bindir: bin
14
14
  cert_chain: []
15
- date: 2018-04-24 00:00:00.000000000 Z
15
+ date: 2018-12-10 00:00:00.000000000 Z
16
16
  dependencies:
17
17
  - !ruby/object:Gem::Dependency
18
18
  name: chef-provisioning
@@ -180,34 +180,6 @@ dependencies:
180
180
  - - ">="
181
181
  - !ruby/object:Gem::Version
182
182
  version: '0'
183
- - !ruby/object:Gem::Dependency
184
- name: rspec
185
- requirement: !ruby/object:Gem::Requirement
186
- requirements:
187
- - - ">="
188
- - !ruby/object:Gem::Version
189
- version: '0'
190
- type: :development
191
- prerelease: false
192
- version_requirements: !ruby/object:Gem::Requirement
193
- requirements:
194
- - - ">="
195
- - !ruby/object:Gem::Version
196
- version: '0'
197
- - !ruby/object:Gem::Dependency
198
- name: rake
199
- requirement: !ruby/object:Gem::Requirement
200
- requirements:
201
- - - ">="
202
- - !ruby/object:Gem::Version
203
- version: '0'
204
- type: :development
205
- prerelease: false
206
- version_requirements: !ruby/object:Gem::Requirement
207
- requirements:
208
- - - ">="
209
- - !ruby/object:Gem::Version
210
- version: '0'
211
183
  description: Driver for creating Fog instances in Chef Provisioning.
212
184
  email:
213
185
  - john@johnkeiser.com
@@ -217,13 +189,10 @@ email:
217
189
  - jj@chef.io
218
190
  executables: []
219
191
  extensions: []
220
- extra_rdoc_files:
221
- - README.md
222
- - LICENSE
192
+ extra_rdoc_files: []
223
193
  files:
224
194
  - Gemfile
225
195
  - LICENSE
226
- - README.md
227
196
  - Rakefile
228
197
  - chef-provisioning-fog.gemspec
229
198
  - lib/chef/provider/fog_key_pair.rb
@@ -257,7 +226,8 @@ files:
257
226
  - spec/unit/providers/scaleway_spec.rb
258
227
  - spec/unit/providers/softlayer.rb
259
228
  homepage: https://github.com/chef/chef-provisioning-fog
260
- licenses: []
229
+ licenses:
230
+ - Apache-2.0
261
231
  metadata: {}
262
232
  post_install_message:
263
233
  rdoc_options: []
@@ -267,7 +237,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
267
237
  requirements:
268
238
  - - ">="
269
239
  - !ruby/object:Gem::Version
270
- version: '0'
240
+ version: 2.1.9
271
241
  required_rubygems_version: !ruby/object:Gem::Requirement
272
242
  requirements:
273
243
  - - ">="
data/README.md DELETED
@@ -1,357 +0,0 @@
1
- # chef-provisioning-fog
2
-
3
- [![Gem Version](https://img.shields.io/gem/v/chef-provisioning-fog.svg)][gem]
4
- [![Build Status](https://travis-ci.org/chef/chef-provisioning-fog.svg?branch=master)][travis]
5
- [![Dependency Status](https://img.shields.io/gemnasium/chef/chef-provisioning-fog.svg)][gemnasium]
6
-
7
- This is the Fog driver for Chef Provisioning. It provides Amazon EC2, DigitalOcean, Google Compute Engine, IBM Softlayer, Joyent, OpenStack, Rackspace, vCloud Air and XenServer functionality.
8
-
9
- ## Documentation
10
-
11
- These are the primary documents to help learn about using Provisioning and creating Provisioning drivers:
12
-
13
- * [Chef Docs](https://docs.chef.io/provisioning.html)
14
- * [Frequently Asked Questions](https://github.com/chef/chef-provisioning/blob/master/docs/faq.md)
15
- * [Configuration](https://github.com/chef/chef-provisioning/blob/master/docs/configuration.md#configuring-and-using-provisioning-drivers)
16
- * [Writing Drivers](https://github.com/chef/chef-provisioning/blob/master/docs/building_drivers.md#writing-drivers)
17
- * [Embedding](https://github.com/chef/chef-provisioning/blob/master/docs/embedding.md)
18
- * [Providers](https://github.com/chef/chef-provisioning/blob/master/docs/providers)
19
-
20
- ## chef-provisioning-fog Usage and Examples
21
-
22
- **A note about key pairs** - The key name used in `fog_key_pair` must be the same as the filename of the local key to be used. If the key does not exist in one of `private_key_paths` (which you can set in `knife.rb` or in a `client.rb`) it will be created.
23
-
24
- ### Amazon EC2
25
-
26
- NOTE: Using chef-provisioning-fog for AWS is discouraged and new users should use `chef-provisioning-aws`. To use chef-provisioning-fog the `fog-aws` gem must be installed
27
- by hand (it is not list a dependency of this gem any more). ChefDK users should `chef gem install fog-aws`.
28
-
29
-
30
- You'll need to update your `knife.rb` to work:
31
-
32
- You need one of the following for the driver:
33
- ```
34
- fog:AWS:<account_id>:<region>
35
- fog:AWS:<profile_name>
36
- fog:AWS:<profile_name>:<region>
37
- ```
38
-
39
- For example:
40
-
41
- ```ruby
42
- driver 'fog:AWS:<account_id>:<region>'
43
- driver_options :compute_options => {
44
- :aws_access_key_id => 'YOUR-ACCESS-KEY-ID',
45
- :aws_secret_access_key => 'YOUR-SECRET-ACCESS-KEY',
46
- :region => 'THE-REGION-YOU-WANT-TO-PROVISION-IN'
47
- }
48
- ```
49
-
50
- For a full example see [examples/aws/simple.rb](examples/aws/simple.rb).
51
-
52
-
53
- ### DigitalOcean
54
-
55
- Update your `knife.rb` to contain your DigitalOcean API token and the driver:
56
-
57
- ```ruby
58
- driver 'fog:DigitalOcean'
59
- driver_options :compute_options => {
60
- :digitalocean_token => 'token'
61
- }
62
- ```
63
-
64
- [fog](http://fog.io) 1.38.0 (Newest release) has an issue with DigitalOcean. If
65
- you want to use DigitalOcean and `chef-provisioning-fog` you need to down grade
66
- your fog gem.
67
-
68
- ```shell
69
- $ gem install fog --version 1.37.0
70
- Successfully installed fog-1.37.0
71
- Parsing documentation for fog-1.37.0
72
- $ gem uninstall fog
73
-
74
- Select gem to uninstall:
75
- 1. fog-1.37.0
76
- 2. fog-1.38.0
77
- 3. All versions
78
- > 2
79
- Successfully uninstalled fog-1.38.0
80
- $
81
- ```
82
-
83
- For a full example see [examples/digitalocean/simple.rb](examples/digitalocean/simple.rb).
84
-
85
- ### Google Compute Engine
86
-
87
- NOTE: currently `fog-google` is broken against the current `google-api-client` client. The dependency on fog-google has
88
- been removed until this is fixed upstream. Users will likely need to use a Gemfile and pin manually to a working version
89
- of fog, fog-google and google-api-client. It is unlikely that it will work successfully with ChefDK with no Gemfile
90
-
91
- You'll need to update your `knife.rb` to work:
92
-
93
- ```ruby
94
- driver 'fog:Google'
95
- driver_options :compute_options => {
96
- :provider => 'google',
97
- :google_project => 'YOUR-PROJECT-ID', # the name will work here
98
- :google_client_email => 'YOUR-SERVICE-ACCOUNT-EMAIL',
99
- :google_key_location => 'YOUR-SERVICE-P12-KEY-FILE-FULL-PATH.p12'
100
- }
101
-
102
- ```
103
-
104
- In order to get the `YOUR-SERVICE-P12-KEY-FILE.p12` you need to set up a Service
105
- account. This is located at `Home > Permissions > Service Accounts` and you'll
106
- need to create a new one to get a new key. After that place it some place such
107
- as `~/.chef/` so chef-provisioning-fog can find it. Your `google_client_email`
108
- would be something like: `<UNIQUE_NAME>@<PROJECT>.iam.gserviceaccount.com`.
109
-
110
- For a full simple example see [examples/google/simple.rb](examples/google/simple.rb).
111
-
112
- For an example that shows a different `:disk_type` see
113
- [examples/google/simple_different_disk.rb](examples/google/simple_different_disk.rb).
114
-
115
- ### IBM SoftLayer
116
-
117
- You'll need to update your `knife.rb` to work with this also:
118
-
119
- ```ruby
120
- driver 'fog:SoftLayer'
121
- driver_options :compute_options => {
122
- :provider => 'softlayer',
123
- :softlayer_username => 'username',
124
- :softlayer_api_key => 'api_key',
125
- :softlayer_default_domain => 'example.com',
126
- }
127
-
128
- ```
129
-
130
- Once you or your administrator has created a SoftLayer account you can manage
131
- your API key at https://control.softlayer.com/account/users
132
-
133
- `:bootstrap_options => {:key_name => 'label'}` is looked up by_label; make sure
134
- you have a public key created on control portal at
135
- https://control.softlayer.com/devices/sshkeys with a matching label.
136
-
137
- NOTE: the SoftLayer driver injects a custom post provisioning script that
138
- ensures some packages needed by chef-provisioning-fog to install chef are
139
- present (e.g. sudo). The injected script will call your :postInstallScriptUri
140
- if you define one. The driver will wait until the injected script is done. The
141
- driver and script communicate using userMetadata so you cannot use metadata.
142
-
143
- For a full example see [examples/softlayer/simple.rb](examples/softlayer/simple.rb).
144
-
145
- ### Joyent
146
-
147
- You'll need to update your `knife.rb` to work:
148
-
149
- ```ruby
150
- driver 'fog:Joyent'
151
- driver_options :compute_options => {
152
- :joyent_username => 'YOUR-JOYENT-LOGIN',
153
- :joyent_password => 'YOUR-JOYENT-PASSWORD',
154
- :joyent_keyname => 'THE-SSH-KEY-YOUVE-UPLOADED',
155
- :joyent_version => '7.3.0', # if you are using the joyent public cloud
156
- :joyent_keyfile => 'YOUR-PRIVATE-SSH-KEY-LOCATION' # Such as '/Users/jasghar/.ssh/id_rsa'
157
- }
158
- ```
159
-
160
- Tested this with the [Joyent Public Cloud](https://docs.joyent.com/public-cloud). For the package names, use the
161
- GUI to find the name(s) that you want to use. This is also required to figure out the Image UUID, there doesn't seem to be an
162
- effective way of doing this without the GUI.
163
-
164
- For a more in-depth usage of this driver to use with either Private or Public Joyent cloud, checkout [this blog post][joyent_howto] by mhicks from [#smartos][freenode_smartos] on freenode.
165
-
166
- For a infrastructure container example see [examples/joyent/infrastructure.rb](examples/joyent/infrastructure.rb).
167
-
168
-
169
- ### OpenStack
170
-
171
- You'll need to update your `knife.rb` to work:
172
-
173
- ```ruby
174
- driver 'fog:OpenStack'
175
- driver_options :compute_options => {
176
- :openstack_auth_url => 'http://YOUROPENSTACK-CLOUD:5000/v2.0/tokens',
177
- :openstack_username => 'YOUR-USERNAME',
178
- :openstack_api_key => 'YOUR-PASSWORD',
179
- :openstack_tenant => 'YOUR-TENANT-ID-NAME'
180
- }
181
- ```
182
-
183
- For a full example see [examples/openstack/simple.rb](examples/openstack/simple.rb).
184
-
185
- ### Rackspace
186
-
187
- For this example, you must configure `knife.rb` with your credentials and a region to operate on. This example is [also available as a Github repo](https://github.com/martinb3/chef-provisioning-rackspace-example).
188
-
189
- You must configure some credentials and region in a `knife.rb` file like so:
190
- ```ruby
191
- driver 'fog:Rackspace'
192
- driver_options :compute_options => {
193
- :rackspace_username => 'MY-RACKSPACE-USERr',
194
- :rackspace_api_key => 'API-KEY-FOR-USER',
195
- :rackspace_region => 'dfw' # could be 'org', 'iad', 'hkg', etc
196
- }
197
- ```
198
-
199
- For a full example see [examples/rackspace/simple.rb](examples/rackspace/simple.rb).
200
-
201
- ### vCloud Air
202
-
203
- NOTE: The `fog` mega-gem has been removed as a direct dependency of `chef-provisioning-fog`. Since support
204
- for vcair is only in the `fog` gem and fog does not supply any "meta-gem" for vcair specifically, that means
205
- that the `fog` gem must be manually installed. ChefDK users should manually `chef gem install fog`.
206
-
207
- Docs TODO.
208
-
209
- ### XenServer
210
-
211
- You should configure XenServer driver with your credentials:
212
-
213
- ```ruby
214
- with_driver "fog:XenServer:<XEN-SERVER-IP/NAME>", compute_options: {
215
- xenserver_username: 'MY-XEN-USER',
216
- xenserver_password: 'MY-XEN-PASSWORD',
217
- xenserver_defaults: {
218
- 'template' => 'ubuntu-14.04'
219
- }
220
- }
221
- ```
222
-
223
- For a full example see [examples/xenserver/simple.rb](examples/xenserver/simple.rb).
224
-
225
- ### Scaleway
226
-
227
- You should configure the driver with your credentials or :
228
-
229
- ``` ruby
230
- with_driver "fog:Scaleway:Your-Organisation-UUID:region", compute_options: {
231
- scalewat_token: 'your-api-token',
232
- }
233
- ```
234
-
235
- or just use the fog configuration (~/.fog):
236
-
237
- ``` ruby
238
- with_driver 'fog:Scaleway'
239
- ```
240
-
241
- For full examples, see [examples/scaleway](examples/scaleway).
242
-
243
- ### Cleaning up
244
-
245
- ```ruby
246
- require 'chef/provisioning'
247
-
248
- machine_batch do
249
- machines search(:node, '*:*').map { |n| n.name }
250
- action :destroy
251
- end
252
- ```
253
-
254
- When you are done with the examples, run this to clean up:
255
-
256
- ```
257
- $ chef-client -z destroy_all.rb
258
- ```
259
-
260
- ## What Is Chef Provisioning?
261
-
262
- Chef Provisioning has two major abstractions: the machine resource, and drivers.
263
-
264
- ### The `machine` resource
265
-
266
- 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.
267
-
268
- 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, it'll create a database machine then one web server.
269
-
270
- ```ruby
271
- machine 'mario' do
272
- recipe 'postgresql'
273
- recipe 'mydb'
274
- tag 'mydb_master'
275
- end
276
-
277
- num_webservers = 1
278
-
279
- 1.upto(num_webservers) do |i|
280
- machine "luigi#{i}" do
281
- recipe 'apache'
282
- recipe 'mywebapp'
283
- end
284
- end
285
- ```
286
-
287
- You will notice the dynamic nature of the number of web servers. It's all code, your imagination is the limit :)
288
-
289
- ### Drivers
290
-
291
- 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!):
292
-
293
- * Acquiring machines from the cloud, creating containers or VMs, or grabbing bare metal
294
- * Connecting to those machines via ssh, winrm, or other transports
295
- * Bootstrapping chef onto the machines and converging the recipes you suggested
296
-
297
- 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.).
298
-
299
- 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.
300
-
301
- ### Tuning Timeouts
302
-
303
- `chef-provisioning-fog` interacts with your cloud provider's endpoint. Most of
304
- the time, default timeouts for the following would be sufficient.
305
-
306
- #### Fog `connection_options`
307
-
308
- Modify the defaults if your Fog endpoint takes awhile to send/receive API requests. Normally, if you see `Excon` timeouts you should tune these [parameters](https://github.com/excon/excon/blob/75d85a7e304cbd1c9dc3c7c40c6de5a995f5cd04/lib/excon/constants.rb#L110-L139).
309
-
310
- ```ruby
311
- with_driver 'fog:foo',
312
- :compute_options => {
313
- :connection_options => {
314
- # set connection to persist (default is false)
315
- :persistent => true,
316
- # set longer connect_timeout (default is 60 seconds)
317
- :connect_timeout => 360,
318
- # set longer read_timeout (default is 60 seconds)
319
- :read_timeout => 360,
320
- # set longer write_timeout (default is 60 seconds)
321
- :write_timeout => 360,
322
- }
323
- }
324
- ```
325
- #### `machine_option` timeouts
326
-
327
- Modify these timeouts if you need Chef to wait a bit of time to allow for the machine to be ready.
328
-
329
- ```ruby
330
- with_machine_options({
331
- # set longer to wait for the instance to boot to ssh (defaults to 180)
332
- :create_timeout => 360,
333
- # set longer to wait for the instance to start (defaults to 180)
334
- :start_timeout => 360,
335
- # set longer to wait for ssh to be available if the instance is detected up (defaults to 20)
336
- :ssh_timeout => 360
337
- })
338
- ```
339
-
340
- #### Chef Client `convergence_options`
341
-
342
- Modify this if your chef client convergences take awhile.
343
-
344
- ```ruby
345
- with_machine_options({
346
- :convergence_options => {
347
- # set longer if you need more time to converge (default: 2 hours)
348
- :chef_client_timeout => 120*60
349
- }
350
- })
351
- ```
352
-
353
- [gem]: https://rubygems.org/gems/chef-provisioning-fog
354
- [travis]: https://travis-ci.org/chef/chef-provisioning-fog
355
- [gemnasium]: https://gemnasium.com/chef/chef-provisioning-fog
356
- [joyent_howto]: https://numericillustration.wordpress.com/2015/12/04/using-chef-provisioner-with-the-joyent-smart-data-center/
357
- [freenode_smartos]: http://webchat.freenode.net/?randomnick=1&channels=smartos&prompt=1