vagrant-profitbricks 1.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -4
  3. data/README.md +326 -174
  4. data/Rakefile +4 -2
  5. data/Vagrantfile +18 -13
  6. data/example_box/Vagrantfile +9 -0
  7. data/example_box/profitbricks.box +0 -0
  8. data/lib/vagrant-profitbricks.rb +12 -11
  9. data/lib/vagrant-profitbricks/action.rb +79 -40
  10. data/lib/vagrant-profitbricks/action/connect_profitbricks.rb +14 -12
  11. data/lib/vagrant-profitbricks/action/create_server.rb +74 -67
  12. data/lib/vagrant-profitbricks/action/delete_server.rb +33 -13
  13. data/lib/vagrant-profitbricks/action/is_created.rb +3 -1
  14. data/lib/vagrant-profitbricks/action/list_flavors.rb +5 -3
  15. data/lib/vagrant-profitbricks/action/list_images.rb +6 -4
  16. data/lib/vagrant-profitbricks/action/message_already_created.rb +4 -2
  17. data/lib/vagrant-profitbricks/action/message_not_created.rb +4 -2
  18. data/lib/vagrant-profitbricks/action/read_ssh_info.rb +10 -16
  19. data/lib/vagrant-profitbricks/action/read_state.rb +19 -12
  20. data/lib/vagrant-profitbricks/action/reboot_server.rb +45 -0
  21. data/lib/vagrant-profitbricks/action/run_init_script.rb +5 -3
  22. data/lib/vagrant-profitbricks/action/start_server.rb +50 -0
  23. data/lib/vagrant-profitbricks/action/stop_server.rb +51 -0
  24. data/lib/vagrant-profitbricks/command/datacenters.rb +34 -0
  25. data/lib/vagrant-profitbricks/command/flavors.rb +19 -6
  26. data/lib/vagrant-profitbricks/command/images.rb +21 -20
  27. data/lib/vagrant-profitbricks/command/locations.rb +34 -0
  28. data/lib/vagrant-profitbricks/command/root.rb +28 -23
  29. data/lib/vagrant-profitbricks/command/servers.rb +7 -4
  30. data/lib/vagrant-profitbricks/command/snapshots.rb +34 -0
  31. data/lib/vagrant-profitbricks/command/utils.rb +27 -0
  32. data/lib/vagrant-profitbricks/config.rb +44 -39
  33. data/lib/vagrant-profitbricks/errors.rb +14 -5
  34. data/lib/vagrant-profitbricks/plugin.rb +13 -11
  35. data/lib/vagrant-profitbricks/provider.rb +8 -6
  36. data/lib/vagrant-profitbricks/version.rb +3 -1
  37. data/locales/en.yml +28 -7
  38. data/spec/spec_helper.rb +4 -2
  39. data/spec/vagrant-profitbricks/config_spec.rb +65 -96
  40. data/vagrant-profitbricks.gemspec +17 -14
  41. metadata +42 -47
  42. data/Appraisals +0 -35
  43. data/CHANGELOG.md +0 -3
  44. data/RELEASE.md +0 -15
  45. data/bootstrap.cmd +0 -16
  46. data/features/provision.feature +0 -36
  47. data/features/steps/sdk_steps.rb +0 -13
  48. data/features/steps/server_steps.rb +0 -25
  49. data/features/support/env.rb +0 -35
  50. data/features/support/fog_mock.rb +0 -17
  51. data/features/vagrant-profitbricks.feature +0 -66
  52. data/lib/vagrant-profitbricks/action/create_image.rb +0 -53
  53. data/lib/vagrant-profitbricks/action/list_keypairs.rb +0 -20
  54. data/lib/vagrant-profitbricks/action/list_networks.rb +0 -20
  55. data/lib/vagrant-profitbricks/action/list_servers.rb +0 -21
  56. data/lib/vagrant-profitbricks/command/create_image.rb +0 -21
  57. data/lib/vagrant-profitbricks/command/keypairs.rb +0 -21
  58. data/lib/vagrant-profitbricks/command/list_images.rb +0 -21
  59. data/lib/vagrant-profitbricks/command/networks.rb +0 -21
  60. data/spec/vagrant-profitbricks/actions/list_flavors_spec.rb +0 -48
  61. data/spec/vagrant-profitbricks/actions/list_images_spec.rb +0 -48
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c3f000a1380a564fccefc12c251179b1095a4e16
4
- data.tar.gz: e71772e76b43e0ff3438f51bb47067808e94d467
3
+ metadata.gz: 092e21f02ce19f5fbf581758cab5332eda8984f2
4
+ data.tar.gz: 7d5b8eedbfd563d71ce58d8a30029ebf5b6a802a
5
5
  SHA512:
6
- metadata.gz: b05fd364f07481880b0fabb81e7ba654460de4077579e2b2d531746b3d207e8843b7752e13dee5a791d4815a703870937f6d7cb601aa160513ab7e97119b7f81
7
- data.tar.gz: 3d6e241542522813a2f2213959804e381dd178c61d30d06c6585d8de7dcec9deac942f2e0aa3742e05e726b8ba70e8b925bf6b36d741c383d344176813a2273c
6
+ metadata.gz: 9980dc973eada92764d9ea1d1f7710efabebc677df9167a76bb40513426f82ccbec5209fb3bbe1ebf53f6e5660d405b745e038c70b9a42cf1dd6d6682e03330c
7
+ data.tar.gz: 51d5961921708eaf93c0d68e5e77e9ae005032da506fc5a8a091919f8b39b2af636cb0874c782cff3e1ee32d81cdf2e2d9392f07bccd05115cf1b19a8629e28e
data/Gemfile CHANGED
@@ -1,10 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'http://rubygems.org'
2
4
 
3
5
  # This group will not be installed on Travis
4
6
  group :development do
5
7
  gem 'pry'
6
- # My branch contains a fix for https://github.com/thoughtbot/appraisal/issues/76
7
- gem 'appraisal', '~> 1.0', git: 'http://github.com/malibeg/appraisal', branch: 'gemspec_in_group'
8
+ gem 'rubocop', '~>0.51.0', require: false
8
9
  end
9
10
 
10
11
  group :test do
@@ -12,7 +13,6 @@ group :test do
12
13
  end
13
14
 
14
15
  group :plugins do
15
- gem "vagrant", git: "http://github.com/mitchellh/vagrant.git", :branch => 'master'
16
+ gem 'vagrant', git: 'http://github.com/mitchellh/vagrant.git', branch: 'master'
16
17
  gemspec
17
18
  end
18
-
data/README.md CHANGED
@@ -1,268 +1,420 @@
1
- # WIP: Vagrant ProfitBricks Cloud Provider
1
+ # Vagrant Plugin
2
+
3
+ Version: vagrant-profitbricks v4.0.0
4
+
5
+ ## Table of Contents
6
+
7
+ * [Description](#description)
8
+ * [Getting Started](#getting-started)
9
+ * [Installation](#installation)
10
+ * [Usage](#usage)
11
+ * [Vagrant Actions](#vagrant-actions)
12
+ * [Create a Vagrant Machine](#create-a-vagrant-machine)
13
+ * [Add Vagrant Box](#add-vagrant-box)
14
+ * [SSH Into Vagrant Machine](#ssh-into-vagrant-machine)
15
+ * [Vagrant Provisioner](#vagrant-provisioner)
16
+ * [Stop Vagrant Machine](#stop-vagrant-machine)
17
+ * [Start Vagrant Machine](#start-vagrant-machine)
18
+ * [Reboot Vagrant Machine](#reboot-vagrant-machine)
19
+ * [Vagrant Commands](#vagrant-commands)
20
+ * [Datacenters](#datacenters)
21
+ * [Flavors](#flavors)
22
+ * [Images](#images)
23
+ * [Locations](#locations)
24
+ * [Snapshots](#snapshots)
25
+ * [Vagrantfile Reference](#vagrantfile-reference)
26
+ * [Examples](#examples)
27
+ * [Support](#support)
28
+ * [Testing](#testing)
29
+ * [Contributing](#contributing)
30
+
31
+ ## Description
32
+
33
+ Vagrant is a tool that allows users to automatically deploy and configure local and cloud infrastructure using a consistent, declarative configuration file. The ProfitBricks plugin for Vagrant leverages the Cloud API to deploy servers directly onto the ProfitBricks platform.
34
+
35
+ ## Getting Started
36
+
37
+ Before you begin you will need to have [signed-up](https://www.profitbricks.com/signup/) for a ProfitBricks account. The credentials you establish during sign-up will be used to authenticate against the [ProfitBricks Cloud API](https://devops.profitbricks.com/api/cloud/).
2
38
 
3
- This is a [Vagrant](http://www.vagrantup.com) 1.5+ plugin that adds a
4
- [ProfitBricks](https://devops.profitbricks.com) provider to Vagrant,
5
- allowing Vagrant to control and provision machines within the ProfitBricks
6
- cloud.
39
+ ## Installation
7
40
 
8
- **Note:** This plugin requires Vagrant 1.5+.
41
+ Vagrant must first be installed. Please review the [installation documentation](https://www.vagrantup.com/docs/installation/) for details on downloading and installing Vagrant.
9
42
 
10
- ## Features
43
+ Then install the ProfitBricks plugin using the standard Vagrant plugin installation method.
11
44
 
12
- * Boot ProfitBricks instances.
13
- * SSH into the instances.
14
- * COMING SOON: Provision the instances with any built-in Vagrant provisioner.
15
- * Sync folders with any built-in Vagrant synchronized folder plugin (e.g. `rsync`)
16
- * Create ProfitBricks images from a running Vagrant box
45
+ ```
46
+ $ vagrant plugin install vagrant-profitbricks
47
+ ```
17
48
 
18
- ## Installation
49
+ ## Overview
19
50
 
20
- Install using the standard Vagrant plugin installation methods.
51
+ A list of available operations can be accessed directly from the command line.
21
52
 
22
53
  ```
23
- $ vagrant plugin install vagrant-profitbricks
54
+ vagrant profitbricks -h
24
55
  ```
25
56
 
26
- ## Usage
57
+ ```
58
+ Usage: vagrant [options] <command> [<args>]
59
+
60
+ -v, --version Print the version and exit.
61
+ -h, --help Print this help.
62
+
63
+ Common commands:
64
+ box manages boxes: installation, removal, etc.
65
+ connect connect to a remotely shared Vagrant environment
66
+ destroy stops and deletes all traces of the vagrant machine
67
+ global-status outputs status Vagrant environments for this user
68
+ halt stops the vagrant machine
69
+ help shows the help for a subcommand
70
+ init initializes a new Vagrant environment by creating a Vagrantfile
71
+ login log in to HashiCorp's Vagrant Cloud
72
+ package packages a running vagrant environment into a box
73
+ plugin manages plugins: install, uninstall, update, etc.
74
+ port displays information about guest port mappings
75
+ powershell connects to machine via powershell remoting
76
+ provision provisions the vagrant machine
77
+ push deploys code in this environment to a configured destination
78
+ rdp connects to machine via RDP
79
+ reload restarts vagrant machine, loads new Vagrantfile configuration
80
+ resume resume a suspended vagrant machine
81
+ share share your Vagrant environment with anyone in the world
82
+ snapshot manages snapshots: saving, restoring, etc.
83
+ ssh connects to machine via SSH
84
+ ssh-config outputs OpenSSH valid configuration to connect to the machine
85
+ status outputs status of the vagrant machine
86
+ suspend suspends the machine
87
+ up starts and provisions the vagrant environment
88
+ validate validates the Vagrantfile
89
+ version prints current and latest Vagrant version
90
+
91
+ For help on any individual command run `vagrant COMMAND -h`
92
+
93
+ Additional subcommands are available, but are either more advanced
94
+ or not commonly used. To see all subcommands, run the command
95
+ `vagrant list-commands`.
96
+ ```
97
+
98
+ If you want to retrieve list of plugin specific subcommands then run:
27
99
 
28
- Once the plugin is installed, you use it with `vagrant up` by specifying
29
- the `profitbricks` provider:
30
100
  ```
31
- $ vagrant up --provider=profitbricks
101
+ vagrant profitbricks
32
102
  ```
33
103
 
34
- You'll need a Vagrantfile in order to properly create/configure remote servers. You can generate a sample
35
- Vagrantfile with `vagrant init`. Here's an example with ProfitBricks configuration:
104
+ ```
105
+ Usage: vagrant profitbricks <subcommand> [<args>]
36
106
 
37
- ```ruby
38
- Vagrant.configure("2") do |config|
39
- # The box is optional in newer versions of Vagrant
40
- # config.vm.box = "dummy"
107
+ Available subcommands:
108
+ datacenters
109
+ flavors
110
+ images
111
+ locations
112
+ snapshots
41
113
 
42
- config.vm.provider :profitbricks do |rs|
43
- rs.username = "YOUR PB USERNAME"
44
- rs.password = "YOUR PB PASSWORD"
45
- rs.flavor = /Small/
46
- rs.image = /Ubuntu/
47
- rs.datacenter_id = /DC_Ge/
48
- rs.profitbricks_volume_size = 20
49
- end
114
+ For help on any individual subcommand run `vagrant profitbricks <subcommand> -h`
115
+ ```
116
+
117
+ You will need a `Vagrantfile` in order to properly create and configure remote servers. You can generate a sample
118
+ `Vagrantfile` with `vagrant init`. Here is an example of the ProfitBricks configuration:
119
+
120
+ ```
121
+ config.ssh.private_key_path = '/path/to/.ssh/id_rsa'
122
+
123
+ config.vm.provider :profitbricks do |profitbricks|
124
+ profitbricks.username = ENV['PROFITBRICKS_USERNAME']
125
+ profitbricks.password = ENV['PROFITBRICKS_PASSWORD']
126
+ profitbricks.profitbricks_url = 'https://api.profitbricks.com/cloudapi/v4/'
127
+ profitbricks.datacenter_id = 'f98e9d49-e33b-4d59-9ac3-484f7f749b78'
128
+ profitbricks.location = 'de/fkb'
129
+ profitbricks.image_alias = 'ubuntu:latest'
130
+ profitbricks.cores = 4
131
+ profitbricks.profitbricks_ram = 4096
132
+ profitbricks.image_password = 'secretpassword123'
133
+ # Allows SSH authentication (Works with ProfitBricks supplied Linux images)
134
+ profitbricks.public_ssh_keys = [File.read('/path/to/.ssh/id_rsa.pub')]
50
135
  end
51
136
  ```
52
137
 
53
- You may be required to use a box, depending on your version of Vagrant. If necessary you can
54
- add the "dummy" box with the command:
138
+ ## Vagrant Actions
139
+
140
+ Actions are Vagrant actions that allow interaction with Vagrant managed machines.
141
+
142
+ ### Create a Vagrant Machine
143
+
144
+ Once the plugin is installed and `Vagrantfile` configured properly, you bring build a new machine with `vagrant up`:
145
+
146
+ ```
147
+ $ vagrant up
148
+ ```
149
+
150
+ ### Add Vagrant Box
151
+
152
+ You may be required to use a box depending on your version of Vagrant. If necessary, you can add the "dummy" box with the command:
153
+
55
154
  ```
56
155
  $ vagrant box add dummy https://github.com/profitbricks/vagrant-profitbricks/raw/master/dummy.box
57
156
  ```
58
- Then uncomment the line containing `config.vm.box = "dummy"`.
59
157
 
158
+ Then add a line containing `config.vm.box = "dummy"` to the `Vagrantfile`.
60
159
 
61
- Once the server is created a confirmation email is received with your credentials. Also, the password can be set inside the config section with the option admin_password. In both cases it is required that you change
62
- the password upon first logon. After server creation the user can login with:
160
+ ### SSH Into Vagrant Machine
161
+
162
+ The user can log into the machine via SSH after server creation:
63
163
 
64
164
  ```
65
165
  $ vagrant ssh
66
166
  ```
67
167
 
68
- Once the password is changed it is posible to provision synced_folders with
168
+ ### Vagrant Provisioner
169
+
170
+ Any Vagrant [provisioner](https://www.vagrantup.com/docs/provisioning/) can be run on the Vagrant managed machine.
171
+
172
+ A simple shell provisioner can be can be added to the `Vagrantfile` similar to the following.
173
+
174
+ ```
175
+ config.vm.provision 'shell' do |s|
176
+ s.inline = 'apt-get update && apt-get install -y'
177
+ end
178
+ ```
179
+
180
+ Then run the provisioner:
181
+
69
182
  ```
70
183
  $ vagrant provision
71
184
  ```
72
185
 
186
+ ### Stop Vagrant Machine
73
187
 
188
+ In order to stop a Vagrant managed machine:
74
189
 
75
- ### CentOS / RHEL / Fedora
190
+ ```
191
+ vagrant halt
192
+ ```
76
193
 
77
- The default configuration of the RHEL family of Linux distributions requires a tty in order to run sudo. Vagrant does not connect with a tty by default, so you may experience the error:
78
- > sudo: sorry, you must have a tty to run sudo
194
+ ### Start Vagrant Machine
79
195
 
80
- You can tell Vagrant it should use a pseudo-terminal (pty) to get around this issue with the option:
81
- ```ruby
82
- config.ssh.pty = true
196
+ To start a Vagrant managed machine:
197
+
198
+ ```
199
+ vagrant up
83
200
  ```
84
201
 
85
- However, Vagrant does not always work well with the pty. In particular, rsync may not work. So we recommend
86
- using this configuration for a workaround which will reconfigure the server so a tty is not required to run sudo:
202
+ ### Reboot Vagrant Machine
87
203
 
88
- The following settings show an example of how you can workaround the issue:
89
- ```ruby
90
- Vagrant.configure("2") do |config|
91
- config.vm.box = "dummy"
92
- config.ssh.pty = true
204
+ To reboot a Vagrant managed machine:
93
205
 
94
- config.vm.provider :profitbricks do |rs|
95
- rs.username = "YOUR USERNAME"
96
- rs.password = "YOUR PASSWORD"
97
- rs.profitbricks_ram = 1024
98
- rs.profitbricks_cores = 1
99
- rs.image = /^CentOS-7/
100
- rs.datacenter_id = /DC_US/
101
- end
102
- end
206
+ ```
207
+ vagrant reload
103
208
  ```
104
209
 
105
- ### Windows
210
+ ## Vagrant Commands
106
211
 
107
- Windows servers can be created with this provider; however, Profitbricks images do not have the WinRM service started or an SSH server pre-installed. To take full advantage of Vagrant, you need to enable WinRM to use the `vagrant rdp` command to launch Remote Desktop. You can consult the vagrant documentation on how to enable WinRM on created server
108
- [WINRM CONFIGURATION](http://docs.vagrantup.com/v2/boxes/base.html)
212
+ Commands are plugin specific subcommands which allow users to retrieve a list of ProfitBricks resources.
109
213
 
214
+ To get list of available subcommands run:
110
215
 
111
- The following settings show how to setup box to enable RDP:
112
- ```ruby
113
- Vagrant.configure("2") do |config|
114
- config.vm.box = "dummy"
115
- config.vm.communicator = "winrm"
116
- config.vm.provider :profitbricks do |rs|
117
- rs.username = "YOUR USERNAME"
118
- rs.password = "YOUR PASSWORD"
119
- rs.flavor = /Meduim/
120
- rs.image = /^windows-2012-r2/
121
- rs.profitbricks_volume_size = 30
122
- rs.datacenter_id = /DC_US/
123
- end
124
- end
216
+ ```
217
+ vagrant profitbricks
125
218
  ```
126
219
 
127
- ### Parallel, multi-machine setup
220
+ Currently the following resources are available to view.
128
221
 
129
- You can define multiple machines in a single Vagrant file, for example:
222
+ * datacenters
223
+ * flavors
224
+ * images
225
+ * locations
226
+ * snapshots
130
227
 
131
- ```ruby
132
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
133
- # All Vagrant configuration is done here. The most common configuration
134
- # options are documented and commented below. For a complete reference,
135
- # please see the online documentation at vagrantup.com.
228
+ ### Datacenters
136
229
 
137
- # Every Vagrant virtual environment requires a box to build off of.
138
- config.vm.box = "dummy"
230
+ To retrieve list of available ProfitBricks Virtual Data Center run:
139
231
 
140
- config.vm.define :ubuntu do |ubuntu|
141
- ubuntu.vm.provider :profitbricks do |rs|
142
- rs.username = ENV['PB_USERNAME']
143
- rs.admin_password = ENV['VAGRANT_ADMIN_PASSWORD']
144
- rs.password = ENV['PB_PASSWORD']
145
- rs.flavor = /Micro/
146
- rs.image = /Ubuntu/
147
- rs.datacenter_id = /DC_US/
148
- end
149
- end
232
+ ```
233
+ vagrant profitbricks datacenters
234
+ ```
235
+
236
+ ```
237
+ +--------------------------------------+--------------------------+
238
+ | ID | Name |
239
+ +--------------------------------------+--------------------------+
240
+ | f98e9d49-e33b-4d59-9ac3-484f7f749b78 | Vagrant Example |
241
+ +--------------------------------------+--------------------------+
242
+ ```
243
+
244
+ ### Flavors
245
+
246
+ To retrieve list of available flavors:
247
+
248
+ ```
249
+ vagrant profitbricks flavors
250
+ ```
150
251
 
151
- config.vm.define :centos do |centos|
152
- centos.ssh.pty = true
153
- centos.vm.provider :profitbricks do |rs|
154
- rs.username = ENV['PB_USERNAME']
155
- rs.admin_password = ENV['VAGRANT_ADMIN_PASSWORD']
156
- rs.password = ENV['PB_PASSWORD']
157
- rs.flavor = /Micro/
158
- rs.image = /^CentOS/ # Don't match OnMetal - CentOS
159
- rs.datacenter_id = /DC_US/
160
- end
161
- end
162
- end
252
+ ```
253
+ +--------------------------------------+-------------------------+
254
+ | ID | Name |
255
+ +--------------------------------------+-------------------------+
256
+ | 0052db40-f1dd-4ecf-a711-5980081b7059 | Extra Large |
257
+ | 00db4c8f-5e83-49b0-a70b-ac4aad786163 | Micro |
258
+ | 1d22436d-d958-4151-b144-43a8e180c4c4 | Memory Intensive Large |
259
+ | 45c28f8b-6a67-4f69-8c94-231d371da2b6 | Memory Intensive Medium |
260
+ | 8b2b835d-be09-48cf-aae2-7e35aafe92d6 | Memory Intensive Small |
261
+ | a5a4389f-54b6-4f47-b6e8-1c5c55976b94 | Large |
262
+ | b37d000e-b347-4592-b572-df13ef8f68e1 | Medium |
263
+ | dc64957b-be9d-431e-91cd-9e217f94d3de | Small |
264
+ +--------------------------------------+-------------------------+
163
265
  ```
164
266
 
165
- You than can then launch them all with `vagrant up --provider profitbricks`, or a specific server
166
- with `vagrant up --provider profitbricks <name>`.
267
+ ### Images
167
268
 
168
- Vagrant will create all machines simultaneously when you have a multi-machine setup. If you want to
169
- create them one at a time or have any trouble, you can use the `--no-parallel` option.
269
+ To list all available ProfitBricks images:
170
270
 
171
- ## Custom Commands
271
+ ```
272
+ vagrant profitbricks images
273
+ ```
172
274
 
173
- The plugin includes several ProfitBricks-specific vagrant commands. You can get the
174
- list of available commands with `vagrant profitbricks -h`.
275
+ ```
276
+ +--------------------------------------+-------------------------------------------+----------+
277
+ | ID | Name | Location |
278
+ +--------------------------------------+-------------------------------------------+----------+
279
+ | 19556107-46b5-11e7-9645-525400f64d8d | grml64-full_2017.05.iso | de/fkb |
280
+ ...
281
+ ...
282
+ | 3b53e0bd-84d2-11e6-9d61-52540005ab80 | windows-2008-r2-server-setup.iso | us/las |
283
+ | 6261e8bb-84a6-11e6-9d61-52540005ab80 | windows-2012-r2-server-setup.iso | de/fra |
284
+ | 6d00c53d-76b3-11e7-98fa-525400f64d8d | Fedora-Server-netinst-x86_64-26-1.5.iso | us/las |
285
+ +--------------------------------------+-------------------------------------------+----------+
286
+ ```
175
287
 
176
- ### Flavors / Images
288
+ ### Locations
177
289
 
178
- You can list all available images with the command:
290
+ A list of all ProfitBricks locations is available:
179
291
 
180
292
  ```
181
- $ vagrant profitbricks images
293
+ vagrant profitbricks locations
182
294
  ```
183
295
 
184
296
  ```
185
- $ vagrant profitbricks flavors
297
+ +--------+-----------+
298
+ | ID | Name |
299
+ +--------+-----------+
300
+ | de/fkb | karlsruhe |
301
+ | de/fra | frankfurt |
302
+ | us/ewr | newark |
303
+ | us/las | lasvegas |
304
+ +--------+-----------+
186
305
  ```
187
306
 
188
- If you have a multi-machine setup than this will show the images/flavors for each machine. This seems
189
- a bit repetitive, but since machines can be configured for different locations or even accounts they may
190
- have a different set of available images or flavors. You can also get the list for a specific machine by specifying its name as an argument:
307
+ ### Snapshots
308
+
309
+ To retrieve list of all snapshots within user account you can use this subcommand:
191
310
 
192
311
  ```
193
- $ vagrant profitbricks images <name>
194
- $ vagrant profitbricks flavors <name>
312
+ vagrant profitbricks snapshots
195
313
  ```
196
314
 
197
- These commands will connect to ProfitBricks using the settings associated with the machine and query the location to get the list of available flavors, images, networks and servers.
315
+ ```
316
+ +--------------------------------------+-----------------------------------+
317
+ | ID | Name |
318
+ +--------------------------------------+-----------------------------------+
319
+ | 1e946713-3fec-464d-9fd3-bfc5345f273e | snapshot1 |
320
+ | 8571fda2-57c6-4b73-b827-88cc7e3f7638 | snapshot2 |
321
+ | ad225f22-f154-4c12-aa55-1ec9026c494d | snapshot3 |
322
+ +--------------------------------------+-----------------------------------+
323
+ ```
198
324
 
199
- ## Configuration
325
+ ## Vagrantfile Reference
200
326
 
201
- This provider exposes quite a few provider-specific configuration options:
327
+ This provider exposes some provider-specific configuration options:
202
328
 
203
329
  | NAME| DESCRIPTION |
204
330
  |---|---|
205
- | datacenter_id | Datacenter Id or name or regular expression that matches the datacenter name. |
206
- | username | The username with which to access ProfitBricks. |
207
- | password | The API password for accessing ProfitBricks. |
208
- | admin_password | Root user password that will be used for first login. |
209
- | flavor | The server flavor to boot. This can be a string matching the exact ID or name of the server, or this can be a regular expression to partially match some server flavor. Flavors are listed [here](#flavors). As an alternative to using flavor names, one can specify the amount of ram in MB and number of cores with `profitbricks_ram` and `profitbricks_cores`. |
210
- | profitbricks_volume_size | The size of the volume in GB. |
211
- | volume_type | Disk volume type (SSD or HDD). Will default to SSD if not specified |
212
- | volume_licence_type | The licence type of the volume. Options: LINUX, WINDOWS, UNKNOWN, OTHER. You will need to provide either the `image` or the `volume_licence_type` parameters. `volume_licence_type` is required, but if `image` is supplied, it is already set and cannot be changed. |
213
- | volume_availability_zone | The storage availability zone assigned to the volume. Valid values: AUTO, ZONE_1, ZONE_2, or ZONE_3. This only applies to HDD volumes. Leave blank or set to AUTO when provisioning SSD volumes. Will default to AUTO if not specified. |
331
+ | datacenter_id | Virtual Data Center ID where machines will be managed. |
332
+ | username | Your ProfitBricks username. |
333
+ | password | Your ProfitBricks password. |
334
+ | flavor | A predefined server [flavor](#flavor) to use. This can be a string matching the exact UUID or name of the server. Or this can be a regular expression to partially match a server flavor name. |
335
+ | cores | The number of server cores to allocate. This is as an alternative to a flavor. |
336
+ | ram | The amount of server memory in MB to allocate. This is as an alternative to a flavor. |
337
+ | volume_size | The size of the volume in GB. |
338
+ | volume_type | Disk volume type (SSD or HDD). Defaults to **SSD** if not specified. |
339
+ | volume_licence_type | The licence type of the volume. Options: LINUX, WINDOWS, UNKNOWN, OTHER. You will need to provide either the `image` or the `volume_licence_type` option. |
340
+ | volume_availability_zone | The storage availability zone assigned to the volume. Valid values: AUTO, ZONE_1, ZONE_2, or ZONE_3. This only applies to HDD volumes. Leave blank or set to AUTO when provisioning SSD volumes. Will default to **AUTO** if not specified. |
214
341
  | image | The server image to boot. This can be a string matching the exact ID or name of the image or this can be a regular expression to partially match some image. |
215
- | image_password | One-time password is set on the Image for the appropriate account. This field may only be set in creation requests. When reading, it always returns null. Password has to contain 8-50 characters. Only these characters are allowed: [abcdefghjkmnpqrstuvxABCDEFGHJKLMNPQRSTUVX23456789] |
216
- | volume_ssh_keys | SSH keys to allow access to the volume via SSH |
217
- | profitbricks_url | The compute_url to hit. This is good for custom endpoints. |
218
- | server_name | The name of the server within ProfitBricks Cloud. This defaults to the name of the Vagrant machine (via `config.vm.define`), but can be overridden with this. |
219
- | location | Specify location for datacenter if one needs to be created, default value is 'us/las' |
220
- | cpu_family | Sets the CPU type. "AMD_OPTERON" or "INTEL_XEON". Defaults to "AMD_OPTERON". |
221
- | lan_id | The LAN ID the network interface (NIC) will sit on. If the LAN ID does not exist it will be created. |
222
- | nat | Indicates the private IP address has outbound access to the public internet. Defaults to 'false'. |
223
-
224
- These can be set like typical provider-specific configurations:
225
-
226
- ```ruby
227
- Vagrant.configure("2") do |config|
228
- # ... other stuff
229
-
230
- config.vm.provider :profitbricks do |rs|
231
- rs.username = "profitbricks_user"
232
- rs.api_key = "profitbricks_password"
342
+ | image_alias | The server image to boot. This has to be a string matching the exact name of the image_alias for e.g. `ubuntu:latest`, `coreos:latest` |
343
+ | image_password | One-time password is set on the image for the appropriate administrative account. This field may only be set on creation requests. When reading, it always returns null. Password has to contain 8-50 alphanumeric characters. |
344
+ | public_ssh_keys | Public SSH keys to allow server authentication. |
345
+ | profitbricks_url | Allows the ProfitBricks Cloud API URL to be overridden. |
346
+ | server_name | The server name defaults to the name of the Vagrant machine (via `config.vm.define`), but can be overridden with this option. |
347
+ | location | Specify location for the datacenter if one needs to be created. Defaults to **us/las**. |
348
+ | cpu_family | Sets the CPU type to "AMD_OPTERON" or "INTEL_XEON". Defaults to **AMD_OPTERON**. |
349
+ | lan_id | The LAN ID that the network interface (NIC) will connect to. If the LAN ID does not exist it will be created. |
350
+ | nat | Indicates the private IP address has outbound access to the public internet. Defaults to **false**. |
351
+
352
+ ---
353
+
354
+ ## Examples
355
+
356
+ If you wish to create multiple Vagrant machines using the ProfitBricks plugin, you can add the following to your `Vagrantfile`:
357
+
358
+ ```
359
+ Vagrant.configure('2') do |config|
360
+
361
+ config.ssh.private_key_path = '/path/to/.ssh/id_rsa'
362
+ public_ssh_keys = [ File.read('/path/to/.ssh/id_rsa.pub') ]
363
+
364
+ config.vm.define :node1 do |node|
365
+ node.vm.provider :profitbricks do |pb|
366
+ pb.datacenter_id = '186d27a5-cda0-44fb-b852-18add4d1a1f5'
367
+ pb.username = ENV['PROFITBRICKS_USERNAME']
368
+ pb.password = ENV['PROFITBRICKS_PASSWORD']
369
+ pb.public_ssh_keys = public_ssh_keys
370
+ pb.cores = 2
371
+ pb.ram = 4096
372
+ pb.image_alias = 'ubuntu:latest'
373
+ end
374
+ end
375
+
376
+ config.vm.define :node2 do |node|
377
+ node.ssh.pty = true
378
+ node.vm.provider :profitbricks do |pb|
379
+ pb.datacenter_id = '186d27a5-cda0-44fb-b852-18add4d1a1f5'
380
+ pb.username = ENV['PROFITBRICKS_USERNAME']
381
+ pb.password = ENV['PROFITBRICKS_PASSWORD']
382
+ pb.public_ssh_keys = public_ssh_keys
383
+ pb.flavor = /Micro/
384
+ pb.image_alias = 'centos:latest'
385
+ end
233
386
  end
234
387
  end
235
388
  ```
236
389
 
237
- You can find a more complete list the documentation for the [Config class](http://www.rubydoc.info/gems/vagrant-profitbricks/VagrantPlugins/ProfitBricks/Config).
390
+ This `Vagrantfile` will create two Vagrant machines named `ubuntu` and `centos`.
238
391
 
239
- ### Networks
392
+ ## Support
240
393
 
241
- Networking features in the form of `config.vm.network` are not
242
- supported with `vagrant-profitbricks`, currently. If any of these are
243
- specified, Vagrant will emit a warning, but will otherwise boot
244
- the ProfitBricks server.
394
+ * A guide and reference documentation can be found in the repo docs/ directory.
395
+ * [ProfitBricks REST API](https://devops.profitbricks.com/api/rest/) documentation.
396
+ * Ask a question or discuss at [ProfitBricks DevOps Central](https://devops.profitbricks.com/community).
397
+ * Report an [issue here](hhttps://github.com/profitbricks/vagrant-profitbricks/issues).
245
398
 
246
- ## Development
399
+ ## Testing
247
400
 
248
- To work on the `vagrant-profitbricks` plugin, clone this repository out, and use
249
- [Bundler](http://gembundler.com) to get the dependencies:
401
+ To work on the `vagrant-profitbricks` plugin, clone this repository and use
402
+ [Bundler](http://gembundler.com) to fetch the dependencies:
250
403
 
251
404
  ```
252
- $ bundle
405
+ $ bundle install
253
406
  ```
254
407
 
255
- Once you have the dependencies, verify the unit tests pass with `rake`:
408
+ Once you have the dependencies, verify the unit tests pass with:
256
409
 
257
410
  ```
258
- $ bundle exec rake
411
+ $ rspec spec/
259
412
  ```
260
413
 
261
- If those pass, you're ready to start developing the plugin. You can test
262
- the plugin without installing it into your Vagrant environment by just
263
- creating a `Vagrantfile` in the top level of this directory (it is gitignored)
264
- that uses it and use bundler to execute Vagrant:
414
+ ## Contributing
265
415
 
266
- ```
267
- $ bundle exec vagrant up --provider=profitbricks
268
- ```
416
+ 1. Fork it ( https://github.com/[my-github-username]/vagrant-profitbricks/fork )
417
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
418
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
419
+ 4. Push to the branch (`git push origin my-new-feature`)
420
+ 5. Create a new Pull Request