vagrant-softlayer 0.3.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +16 -16
- data/CHANGELOG.md +61 -49
- data/QUICKSTART.md +380 -376
- data/README.md +258 -256
- data/contrib/vagrant-softlayer-boxes +418 -416
- data/contrib/vagrant-softlayer-vlans +339 -329
- data/lib/vagrant-softlayer/action/create_instance.rb +74 -74
- data/lib/vagrant-softlayer/action/setup_softlayer.rb +39 -39
- data/lib/vagrant-softlayer/action/update_dns.rb +94 -94
- data/lib/vagrant-softlayer/action/wait_for_provision.rb +40 -40
- data/lib/vagrant-softlayer/action/wait_for_rebuild.rb +38 -36
- data/lib/vagrant-softlayer/config.rb +282 -268
- data/lib/vagrant-softlayer/util/load_balancer.rb +96 -103
- data/lib/vagrant-softlayer/util/network.rb +75 -75
- data/lib/vagrant-softlayer/util/warden.rb +38 -38
- data/lib/vagrant-softlayer/version.rb +5 -5
- data/spec/vagrant-softlayer/config_spec.rb +271 -267
- data/vagrant-softlayer.gemspec +55 -55
- metadata +4 -4
data/README.md
CHANGED
@@ -1,256 +1,258 @@
|
|
1
|
-
# Vagrant SoftLayer Provider
|
2
|
-
|
3
|
-
<span class="badges">
|
4
|
-
[![Gem Version](https://badge.fury.io/rb/vagrant-softlayer.png)](http://badge.fury.io/rb/vagrant-softlayer)
|
5
|
-
[![Code Climate](https://codeclimate.com/github/audiolize/vagrant-softlayer.png)](https://codeclimate.com/github/audiolize/vagrant-softlayer)
|
6
|
-
</span>
|
7
|
-
|
8
|
-
This is a [Vagrant](http://www.vagrantup.com) plugin that adds a [SoftLayer](http://www.softlayer.com)
|
9
|
-
provider to Vagrant, allowing Vagrant to control and provision SoftLayer CCI instances.
|
10
|
-
|
11
|
-
**NOTE:** This plugin work with Vagrant 1.3+, altough Vagrant 1.4+ is strongly advised.
|
12
|
-
|
13
|
-
## Features
|
14
|
-
|
15
|
-
* Basic lifecycle (boot, halt, reboot, suspend, resume) of SoftLayer CCI instances.
|
16
|
-
* OS reload on a CCI (`vagrant rebuild`).
|
17
|
-
* SSH into the instances.
|
18
|
-
* Provision the instances with any built-in Vagrant provisioner.
|
19
|
-
* Minimal synced folder support via `rsync`.
|
20
|
-
|
21
|
-
## Installation
|
22
|
-
|
23
|
-
> **NOTE**
|
24
|
-
>
|
25
|
-
> If you're using Vagrant 1.3, you need to [Set the SSL_CERT_FILE environment variable](https://github.com/audiolize/vagrant-softlayer/wiki/The-SSL_CERT_FILE-environment-variable) first.
|
26
|
-
|
27
|
-
Installation is performed in the prescribed manner for Vagrant 1.1+ plugins.
|
28
|
-
After installing, `vagrant up` and specify the `softlayer` provider. An example is
|
29
|
-
shown below.
|
30
|
-
|
31
|
-
```
|
32
|
-
$ vagrant plugin install vagrant-softlayer
|
33
|
-
...
|
34
|
-
$ vagrant up --provider=softlayer
|
35
|
-
...
|
36
|
-
```
|
37
|
-
|
38
|
-
Of course prior to doing this, you'll need to obtain an SoftLayer-compatible
|
39
|
-
box file for Vagrant.
|
40
|
-
|
41
|
-
## Box File Format
|
42
|
-
|
43
|
-
Every provider in Vagrant must introduce a custom box format. This
|
44
|
-
provider introduces `softlayer` boxes. You can view an example box in
|
45
|
-
the `example_box/` directory. That directory also contains instructions
|
46
|
-
on how to build a box.
|
47
|
-
|
48
|
-
The box format is basically just the required `metadata.json` file
|
49
|
-
along with a `Vagrantfile` that does default settings for the
|
50
|
-
provider-specific configuration for this provider.
|
51
|
-
|
52
|
-
## Configuration
|
53
|
-
|
54
|
-
This provider exposes quite a few provider-specific configuration options:
|
55
|
-
|
56
|
-
### Authentication
|
57
|
-
|
58
|
-
Parameter | Description | Default | Required
|
59
|
-
-------------- | ------------------------------------ | ---------------------------------- | --------
|
60
|
-
`api_key` | The API key for accessing SoftLayer | | yes
|
61
|
-
`endpoint_url` | The endpoint SoftLayer API url | SoftLayer::API_PUBLIC_ENDPOINT | yes
|
62
|
-
`username` | The username for accessing SoftLayer | | yes
|
63
|
-
|
64
|
-
> **NOTE**
|
65
|
-
>
|
66
|
-
> In place of the API key and username you can use environment variables, respectively `SL_API_KEY` and `SL_USERNAME`.
|
67
|
-
|
68
|
-
### DNS Management
|
69
|
-
|
70
|
-
If the DNS zone of the configured domain is hosted by SoftLayer, you can automatically manage it.
|
71
|
-
|
72
|
-
Parameter | Description | Default | Required
|
73
|
-
------------ | ------------------------------------- | ------- | --------
|
74
|
-
`manage_dns` | Add/remove A record on create/destroy | false | no
|
75
|
-
|
76
|
-
### Join Local Load Balancers
|
77
|
-
|
78
|
-
See [Join load balancers](https://github.com/audiolize/vagrant-softlayer/wiki/Join-load-balancers).
|
79
|
-
|
80
|
-
### Instance Configuration
|
81
|
-
|
82
|
-
Parameter | Description | Default | Required
|
83
|
-
------------------ | -----------------------------------------------------------| ----------------| --------
|
84
|
-
`datacenter` | Datacenter shortname | First available | no
|
85
|
-
`dedicated` | Allocate a dedicated CCI (non-shared host) | false | no
|
86
|
-
`disk_capacity` | The capacity of each disk | | no **
|
87
|
-
`domain` | The domain of the instance | | yes
|
88
|
-
`force_private_ip` | Use private IP for communication even if public IP is set | false | no
|
89
|
-
`hostname` | The hostname of the instance | | yes *
|
90
|
-
`hourly_billing` | Hourly billing type (false for monthly) | true | no
|
91
|
-
`image_guid` | The global identifier for the compute or flex image to use | | no **
|
92
|
-
`local_disk` | Use a local disk (false for SAN) | true | no
|
93
|
-
`max_memory` | The amount of RAM of the instance in Mb | 1024 | no
|
94
|
-
`network_speed` | Network port speed in Mbps | 10 | no
|
95
|
-
`operating_system` | The instance operating system identifier | UBUNTU_LATEST | no **
|
96
|
-
`post_install` | URI of Post-install script to download | | no
|
97
|
-
`private_only` | Only create access to the private network | false | no
|
98
|
-
`ssh_key` | ID or label of the SSH key(s) to provision | | yes
|
99
|
-
`start_cpus` | The number of processors of the instance | 1 | no
|
100
|
-
`user_data` | User defined metadata string | | no
|
101
|
-
`vlan_private` | The ID, name or qualified name of the private VLAN | Auto-generated | no
|
102
|
-
`vlan_public` | The ID, name or qualified name of the public VLAN | Auto-generated | no
|
103
|
-
|
104
|
-
\* The `hostname` could be specified either using `config.vm.hostname` or the provider parameter.
|
105
|
-
|
106
|
-
\** When defining the instance you can either specify an `image_guid` or `operating_system` with optional `disk_capacity`.
|
107
|
-
|
108
|
-
### Timeouts
|
109
|
-
|
110
|
-
Parameter | Description | Default | Required
|
111
|
-
------------------- | ------------------------------------------| ----------------| --------
|
112
|
-
`
|
113
|
-
`
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
sl.
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
the
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
Vagrant
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
Multiple SSH keys
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
sl.
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
* `
|
216
|
-
* `
|
217
|
-
* `
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
```
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
```
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
```
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
```
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
1
|
+
# Vagrant SoftLayer Provider
|
2
|
+
|
3
|
+
<span class="badges">
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/vagrant-softlayer.png)](http://badge.fury.io/rb/vagrant-softlayer)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/audiolize/vagrant-softlayer.png)](https://codeclimate.com/github/audiolize/vagrant-softlayer)
|
6
|
+
</span>
|
7
|
+
|
8
|
+
This is a [Vagrant](http://www.vagrantup.com) plugin that adds a [SoftLayer](http://www.softlayer.com)
|
9
|
+
provider to Vagrant, allowing Vagrant to control and provision SoftLayer CCI instances.
|
10
|
+
|
11
|
+
**NOTE:** This plugin work with Vagrant 1.3+, altough Vagrant 1.4+ is strongly advised.
|
12
|
+
|
13
|
+
## Features
|
14
|
+
|
15
|
+
* Basic lifecycle (boot, halt, reboot, suspend, resume) of SoftLayer CCI instances.
|
16
|
+
* OS reload on a CCI (`vagrant rebuild`).
|
17
|
+
* SSH into the instances.
|
18
|
+
* Provision the instances with any built-in Vagrant provisioner.
|
19
|
+
* Minimal synced folder support via `rsync`.
|
20
|
+
|
21
|
+
## Installation
|
22
|
+
|
23
|
+
> **NOTE**
|
24
|
+
>
|
25
|
+
> If you're using Vagrant 1.3, you need to [Set the SSL_CERT_FILE environment variable](https://github.com/audiolize/vagrant-softlayer/wiki/The-SSL_CERT_FILE-environment-variable) first.
|
26
|
+
|
27
|
+
Installation is performed in the prescribed manner for Vagrant 1.1+ plugins.
|
28
|
+
After installing, `vagrant up` and specify the `softlayer` provider. An example is
|
29
|
+
shown below.
|
30
|
+
|
31
|
+
```
|
32
|
+
$ vagrant plugin install vagrant-softlayer
|
33
|
+
...
|
34
|
+
$ vagrant up --provider=softlayer
|
35
|
+
...
|
36
|
+
```
|
37
|
+
|
38
|
+
Of course prior to doing this, you'll need to obtain an SoftLayer-compatible
|
39
|
+
box file for Vagrant.
|
40
|
+
|
41
|
+
## Box File Format
|
42
|
+
|
43
|
+
Every provider in Vagrant must introduce a custom box format. This
|
44
|
+
provider introduces `softlayer` boxes. You can view an example box in
|
45
|
+
the `example_box/` directory. That directory also contains instructions
|
46
|
+
on how to build a box.
|
47
|
+
|
48
|
+
The box format is basically just the required `metadata.json` file
|
49
|
+
along with a `Vagrantfile` that does default settings for the
|
50
|
+
provider-specific configuration for this provider.
|
51
|
+
|
52
|
+
## Configuration
|
53
|
+
|
54
|
+
This provider exposes quite a few provider-specific configuration options:
|
55
|
+
|
56
|
+
### Authentication
|
57
|
+
|
58
|
+
Parameter | Description | Default | Required
|
59
|
+
-------------- | ------------------------------------ | ---------------------------------- | --------
|
60
|
+
`api_key` | The API key for accessing SoftLayer | | yes
|
61
|
+
`endpoint_url` | The endpoint SoftLayer API url | SoftLayer::API_PUBLIC_ENDPOINT | yes
|
62
|
+
`username` | The username for accessing SoftLayer | | yes
|
63
|
+
|
64
|
+
> **NOTE**
|
65
|
+
>
|
66
|
+
> In place of the API key and username you can use environment variables, respectively `SL_API_KEY` and `SL_USERNAME`.
|
67
|
+
|
68
|
+
### DNS Management
|
69
|
+
|
70
|
+
If the DNS zone of the configured domain is hosted by SoftLayer, you can automatically manage it.
|
71
|
+
|
72
|
+
Parameter | Description | Default | Required
|
73
|
+
------------ | ------------------------------------- | ------- | --------
|
74
|
+
`manage_dns` | Add/remove A record on create/destroy | false | no
|
75
|
+
|
76
|
+
### Join Local Load Balancers
|
77
|
+
|
78
|
+
See [Join load balancers](https://github.com/audiolize/vagrant-softlayer/wiki/Join-load-balancers).
|
79
|
+
|
80
|
+
### Instance Configuration
|
81
|
+
|
82
|
+
Parameter | Description | Default | Required
|
83
|
+
------------------ | -----------------------------------------------------------| ----------------| --------
|
84
|
+
`datacenter` | Datacenter shortname | First available | no
|
85
|
+
`dedicated` | Allocate a dedicated CCI (non-shared host) | false | no
|
86
|
+
`disk_capacity` | The capacity of each disk | | no **
|
87
|
+
`domain` | The domain of the instance | | yes
|
88
|
+
`force_private_ip` | Use private IP for communication even if public IP is set | false | no
|
89
|
+
`hostname` | The hostname of the instance | | yes *
|
90
|
+
`hourly_billing` | Hourly billing type (false for monthly) | true | no
|
91
|
+
`image_guid` | The global identifier for the compute or flex image to use | | no **
|
92
|
+
`local_disk` | Use a local disk (false for SAN) | true | no
|
93
|
+
`max_memory` | The amount of RAM of the instance in Mb | 1024 | no
|
94
|
+
`network_speed` | Network port speed in Mbps | 10 | no
|
95
|
+
`operating_system` | The instance operating system identifier | UBUNTU_LATEST | no **
|
96
|
+
`post_install` | URI of Post-install script to download | | no
|
97
|
+
`private_only` | Only create access to the private network | false | no
|
98
|
+
`ssh_key` | ID or label of the SSH key(s) to provision | | yes
|
99
|
+
`start_cpus` | The number of processors of the instance | 1 | no
|
100
|
+
`user_data` | User defined metadata string | | no
|
101
|
+
`vlan_private` | The ID, name or qualified name of the private VLAN | Auto-generated | no
|
102
|
+
`vlan_public` | The ID, name or qualified name of the public VLAN | Auto-generated | no
|
103
|
+
|
104
|
+
\* The `hostname` could be specified either using `config.vm.hostname` or the provider parameter.
|
105
|
+
|
106
|
+
\** When defining the instance you can either specify an `image_guid` or `operating_system` with optional `disk_capacity`.
|
107
|
+
|
108
|
+
### Timeouts/Waits
|
109
|
+
|
110
|
+
Parameter | Description | Default | Required
|
111
|
+
------------------- | ------------------------------------------| ----------------| --------
|
112
|
+
`api_timeout` | SoftLayer API call timeout in seconds | 60 | no
|
113
|
+
`provision_timeout` | Provisioning wait timeout in seconds | 1200 | no
|
114
|
+
`rebuild_timeout` | Rebuild wait timeout in seconds | 1200 | no
|
115
|
+
`transaction_wait` | Wait for order transactions to complete | true | no
|
116
|
+
|
117
|
+
These can be set like typical provider-specific configuration:
|
118
|
+
|
119
|
+
```
|
120
|
+
Vagrant.configure("2") do |config|
|
121
|
+
# ... other stuff
|
122
|
+
|
123
|
+
config.vm.provider :softlayer do |sl|
|
124
|
+
sl.api_key = "foo"
|
125
|
+
sl.username = "bar"
|
126
|
+
sl.ssh_key = "Vagrant insecure key"
|
127
|
+
end
|
128
|
+
end
|
129
|
+
```
|
130
|
+
|
131
|
+
## OS Reload
|
132
|
+
|
133
|
+
Reload of an instance's operating system is performed with the `vagrant rebuild` command.
|
134
|
+
The primary disk of the instance will be formatted and a fresh copy of the underlying OS
|
135
|
+
will be applied. Note that only `ssh_key` and `post_install` parameter will be read
|
136
|
+
during rebuild, all the other parameters will be ignored. Provisioners will always run
|
137
|
+
after rebuild.
|
138
|
+
|
139
|
+
## Synced Folders
|
140
|
+
|
141
|
+
There is minimal support for synced folders. Upon `vagrant up`,
|
142
|
+
`vagrant reload`, and `vagrant provision`, the SoftLayer provider will use
|
143
|
+
`rsync` (if available) to uni-directionally sync the folder to
|
144
|
+
the remote machine over SSH.
|
145
|
+
|
146
|
+
This is good enough for all built-in Vagrant provisioners (shell, ansible,
|
147
|
+
chef, and puppet) to work!
|
148
|
+
|
149
|
+
## Other Examples
|
150
|
+
|
151
|
+
### Multiple disks
|
152
|
+
|
153
|
+
The `disk_capacity` parameter accepts an hash with the following structure:
|
154
|
+
|
155
|
+
```
|
156
|
+
{
|
157
|
+
disk_id => disk_size,
|
158
|
+
disk_id => disk_size,
|
159
|
+
...
|
160
|
+
}
|
161
|
+
```
|
162
|
+
|
163
|
+
Disk ID 1 is reserved is reserved for swap space, in the following example two disks
|
164
|
+
of 25Gb and 100Gb will be provisioned:
|
165
|
+
|
166
|
+
```
|
167
|
+
Vagrant.configure("2") do |config|
|
168
|
+
# ... other stuff
|
169
|
+
|
170
|
+
config.vm.provider :softlayer do |sl, override|
|
171
|
+
# ... other stuff
|
172
|
+
|
173
|
+
sl.disk_capacity = { 0 => 25, 2 => 100 }
|
174
|
+
end
|
175
|
+
end
|
176
|
+
```
|
177
|
+
|
178
|
+
### Override SSH Username
|
179
|
+
|
180
|
+
If you're running Vagrant with an user different from root, probably you need
|
181
|
+
to override the username used for ssh connection. You can do it using the standard
|
182
|
+
Vagrant syntax:
|
183
|
+
|
184
|
+
```
|
185
|
+
Vagrant.configure("2") do |config|
|
186
|
+
# ... other stuff
|
187
|
+
|
188
|
+
config.vm.provider :softlayer do |sl, override|
|
189
|
+
# ... other stuff
|
190
|
+
|
191
|
+
override.ssh.username = "root"
|
192
|
+
end
|
193
|
+
end
|
194
|
+
```
|
195
|
+
|
196
|
+
### Multiple SSH keys
|
197
|
+
|
198
|
+
Multiple SSH keys to be provisioned could be specified using an array:
|
199
|
+
|
200
|
+
```
|
201
|
+
Vagrant.configure("2") do |config|
|
202
|
+
# ... other stuff
|
203
|
+
|
204
|
+
config.vm.provider :softlayer do |sl|
|
205
|
+
sl.api_key = "foo"
|
206
|
+
sl.username = "bar"
|
207
|
+
# ssh_keys is just an alias of ssh_key
|
208
|
+
sl.ssh_keys = ["Vagrant insecure key", "My personal key"]
|
209
|
+
end
|
210
|
+
end
|
211
|
+
```
|
212
|
+
|
213
|
+
Also, a bunch of aliases for the `ssh_key` parameter are provided for better semantic:
|
214
|
+
|
215
|
+
* `ssh_keys`
|
216
|
+
* `ssh_key_id`
|
217
|
+
* `ssh_key_ids`
|
218
|
+
* `ssh_key_name`
|
219
|
+
* `ssh_key_names`
|
220
|
+
|
221
|
+
## Quick Start Guide
|
222
|
+
|
223
|
+
For those new to Vagrant, see the [Quick Start Guide](https://github.com/audiolize/vagrant-softlayer/blob/master/QUICKSTART.md).
|
224
|
+
|
225
|
+
## Development
|
226
|
+
|
227
|
+
To work on the `vagrant-softlayer` plugin, clone this repository out, and use
|
228
|
+
[Bundler](http://gembundler.com) to get the dependencies:
|
229
|
+
|
230
|
+
```
|
231
|
+
$ bundle
|
232
|
+
```
|
233
|
+
|
234
|
+
Once you have the dependencies, verify the unit tests pass with `rake`:
|
235
|
+
|
236
|
+
```
|
237
|
+
$ bundle exec rake
|
238
|
+
```
|
239
|
+
|
240
|
+
If those pass, you're ready to start developing the plugin. You can test
|
241
|
+
the plugin without installing it into your Vagrant environment by just
|
242
|
+
creating a `Vagrantfile` in the top level of this directory (it is gitignored)
|
243
|
+
and add the following line to your `Vagrantfile`:
|
244
|
+
|
245
|
+
```
|
246
|
+
Vagrant.require_plugin "vagrant-softlayer"
|
247
|
+
```
|
248
|
+
|
249
|
+
Use bundler to execute Vagrant:
|
250
|
+
|
251
|
+
```
|
252
|
+
$ bundle exec vagrant up --provider=softlayer
|
253
|
+
```
|
254
|
+
|
255
|
+
## Credits
|
256
|
+
|
257
|
+
Emiliano Ticci (@emyl)
|
258
|
+
Julio Lajara (@ju2wheels)
|