vagrant-profitbricks 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +25 -0
- data/Appraisals +35 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +18 -0
- data/LICENSE +202 -0
- data/README.md +268 -0
- data/RELEASE.md +15 -0
- data/Rakefile +21 -0
- data/Vagrantfile +30 -0
- data/bootstrap.cmd +16 -0
- data/dummy.box +36 -0
- data/example_box/README.md +13 -0
- data/example_box/metadata.json +3 -0
- data/features/provision.feature +36 -0
- data/features/steps/sdk_steps.rb +13 -0
- data/features/steps/server_steps.rb +25 -0
- data/features/support/env.rb +35 -0
- data/features/support/fog_mock.rb +17 -0
- data/features/vagrant-profitbricks.feature +66 -0
- data/lib/vagrant-profitbricks.rb +53 -0
- data/lib/vagrant-profitbricks/action.rb +166 -0
- data/lib/vagrant-profitbricks/action/connect_profitbricks.rb +39 -0
- data/lib/vagrant-profitbricks/action/create_image.rb +53 -0
- data/lib/vagrant-profitbricks/action/create_server.rb +194 -0
- data/lib/vagrant-profitbricks/action/delete_server.rb +43 -0
- data/lib/vagrant-profitbricks/action/is_created.rb +16 -0
- data/lib/vagrant-profitbricks/action/list_flavors.rb +20 -0
- data/lib/vagrant-profitbricks/action/list_images.rb +20 -0
- data/lib/vagrant-profitbricks/action/list_keypairs.rb +20 -0
- data/lib/vagrant-profitbricks/action/list_networks.rb +20 -0
- data/lib/vagrant-profitbricks/action/list_servers.rb +21 -0
- data/lib/vagrant-profitbricks/action/message_already_created.rb +16 -0
- data/lib/vagrant-profitbricks/action/message_not_created.rb +16 -0
- data/lib/vagrant-profitbricks/action/read_ssh_info.rb +49 -0
- data/lib/vagrant-profitbricks/action/read_state.rb +39 -0
- data/lib/vagrant-profitbricks/action/run_init_script.rb +28 -0
- data/lib/vagrant-profitbricks/command/create_image.rb +21 -0
- data/lib/vagrant-profitbricks/command/flavors.rb +21 -0
- data/lib/vagrant-profitbricks/command/images.rb +33 -0
- data/lib/vagrant-profitbricks/command/keypairs.rb +21 -0
- data/lib/vagrant-profitbricks/command/list_images.rb +21 -0
- data/lib/vagrant-profitbricks/command/networks.rb +21 -0
- data/lib/vagrant-profitbricks/command/root.rb +79 -0
- data/lib/vagrant-profitbricks/command/servers.rb +21 -0
- data/lib/vagrant-profitbricks/config.rb +152 -0
- data/lib/vagrant-profitbricks/errors.rb +39 -0
- data/lib/vagrant-profitbricks/plugin.rb +44 -0
- data/lib/vagrant-profitbricks/provider.rb +50 -0
- data/lib/vagrant-profitbricks/version.rb +5 -0
- data/locales/en.yml +124 -0
- data/spec/spec_helper.rb +20 -0
- data/spec/vagrant-profitbricks/actions/list_flavors_spec.rb +48 -0
- data/spec/vagrant-profitbricks/actions/list_images_spec.rb +48 -0
- data/spec/vagrant-profitbricks/config_spec.rb +150 -0
- data/vagrant-profitbricks.gemspec +25 -0
- metadata +164 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: c3f000a1380a564fccefc12c251179b1095a4e16
|
4
|
+
data.tar.gz: e71772e76b43e0ff3438f51bb47067808e94d467
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b05fd364f07481880b0fabb81e7ba654460de4077579e2b2d531746b3d207e8843b7752e13dee5a791d4815a703870937f6d7cb601aa160513ab7e97119b7f81
|
7
|
+
data.tar.gz: 3d6e241542522813a2f2213959804e381dd178c61d30d06c6585d8de7dcec9deac942f2e0aa3742e05e726b8ba70e8b925bf6b36d741c383d344176813a2273c
|
data/.gitignore
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
.idea/
|
2
|
+
.vagrant
|
3
|
+
*.gem
|
4
|
+
*.rbc
|
5
|
+
/.config
|
6
|
+
/coverage/
|
7
|
+
/InstalledFiles
|
8
|
+
/pkg/
|
9
|
+
/spec/reports/
|
10
|
+
/test/tmp/
|
11
|
+
/test/version_tmp/
|
12
|
+
/tmp/
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
/.yardoc/
|
17
|
+
/_yardoc/
|
18
|
+
/doc/
|
19
|
+
/rdoc/
|
20
|
+
/.bundle/
|
21
|
+
/vendor/bundle
|
22
|
+
/lib/bundler/man/
|
23
|
+
Gemfile.lock
|
24
|
+
gemfiles/*.lock
|
25
|
+
.rvmrc
|
data/Appraisals
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# Note: You may need to use bundler 1.5.2 to run `appraisal install`
|
2
|
+
appraise "vagrant-1.7" do
|
3
|
+
group :plugins do
|
4
|
+
gem 'bundler', '>= 1.5.2', '< 1.8.0'
|
5
|
+
gem "vagrant", :git => 'https://github.com/mitchellh/vagrant', :tag => 'v1.7.1'
|
6
|
+
end
|
7
|
+
end
|
8
|
+
|
9
|
+
appraise "vagrant-1.6" do
|
10
|
+
gem 'bundler', '>= 1.5.2', '< 1.7.0'
|
11
|
+
group :plugins do
|
12
|
+
gem "vagrant", :git => 'https://github.com/mitchellh/vagrant', :tag => 'v1.6.5'
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
appraise "vagrant-1.5" do
|
17
|
+
gem 'bundler', '= 1.5.2'
|
18
|
+
group :plugins do
|
19
|
+
gem "vagrant", :git => 'https://github.com/mitchellh/vagrant', :tag => 'v1.5.4'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Oldest supported
|
24
|
+
appraise "vagrant-1.5.0" do
|
25
|
+
gem 'bundler', '= 1.5.2'
|
26
|
+
group :plugins do
|
27
|
+
gem "vagrant", :git => 'https://github.com/mitchellh/vagrant', :tag => 'v1.5.4'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
appraise "windows-wip" do
|
32
|
+
group :plugins do
|
33
|
+
gem "vagrant", :git => 'https://github.com/maxlinc/vagrant', :branch => 'winrm-1.3'
|
34
|
+
end
|
35
|
+
end
|
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
source 'http://rubygems.org'
|
2
|
+
|
3
|
+
# This group will not be installed on Travis
|
4
|
+
group :development do
|
5
|
+
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
|
+
end
|
9
|
+
|
10
|
+
group :test do
|
11
|
+
gem 'coveralls', require: false
|
12
|
+
end
|
13
|
+
|
14
|
+
group :plugins do
|
15
|
+
gem "vagrant", git: "http://github.com/mitchellh/vagrant.git", :branch => 'master'
|
16
|
+
gemspec
|
17
|
+
end
|
18
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,202 @@
|
|
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 2015 ProfitBricks GmbH
|
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.
|
202
|
+
|
data/README.md
ADDED
@@ -0,0 +1,268 @@
|
|
1
|
+
# WIP: Vagrant ProfitBricks Cloud Provider
|
2
|
+
|
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.
|
7
|
+
|
8
|
+
**Note:** This plugin requires Vagrant 1.5+.
|
9
|
+
|
10
|
+
## Features
|
11
|
+
|
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
|
17
|
+
|
18
|
+
## Installation
|
19
|
+
|
20
|
+
Install using the standard Vagrant plugin installation methods.
|
21
|
+
|
22
|
+
```
|
23
|
+
$ vagrant plugin install vagrant-profitbricks
|
24
|
+
```
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
Once the plugin is installed, you use it with `vagrant up` by specifying
|
29
|
+
the `profitbricks` provider:
|
30
|
+
```
|
31
|
+
$ vagrant up --provider=profitbricks
|
32
|
+
```
|
33
|
+
|
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:
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
Vagrant.configure("2") do |config|
|
39
|
+
# The box is optional in newer versions of Vagrant
|
40
|
+
# config.vm.box = "dummy"
|
41
|
+
|
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
|
50
|
+
end
|
51
|
+
```
|
52
|
+
|
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:
|
55
|
+
```
|
56
|
+
$ vagrant box add dummy https://github.com/profitbricks/vagrant-profitbricks/raw/master/dummy.box
|
57
|
+
```
|
58
|
+
Then uncomment the line containing `config.vm.box = "dummy"`.
|
59
|
+
|
60
|
+
|
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:
|
63
|
+
|
64
|
+
```
|
65
|
+
$ vagrant ssh
|
66
|
+
```
|
67
|
+
|
68
|
+
Once the password is changed it is posible to provision synced_folders with
|
69
|
+
```
|
70
|
+
$ vagrant provision
|
71
|
+
```
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
### CentOS / RHEL / Fedora
|
76
|
+
|
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
|
79
|
+
|
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
|
83
|
+
```
|
84
|
+
|
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:
|
87
|
+
|
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
|
93
|
+
|
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
|
103
|
+
```
|
104
|
+
|
105
|
+
### Windows
|
106
|
+
|
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)
|
109
|
+
|
110
|
+
|
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
|
125
|
+
```
|
126
|
+
|
127
|
+
### Parallel, multi-machine setup
|
128
|
+
|
129
|
+
You can define multiple machines in a single Vagrant file, for example:
|
130
|
+
|
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.
|
136
|
+
|
137
|
+
# Every Vagrant virtual environment requires a box to build off of.
|
138
|
+
config.vm.box = "dummy"
|
139
|
+
|
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
|
150
|
+
|
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
|
163
|
+
```
|
164
|
+
|
165
|
+
You than can then launch them all with `vagrant up --provider profitbricks`, or a specific server
|
166
|
+
with `vagrant up --provider profitbricks <name>`.
|
167
|
+
|
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.
|
170
|
+
|
171
|
+
## Custom Commands
|
172
|
+
|
173
|
+
The plugin includes several ProfitBricks-specific vagrant commands. You can get the
|
174
|
+
list of available commands with `vagrant profitbricks -h`.
|
175
|
+
|
176
|
+
### Flavors / Images
|
177
|
+
|
178
|
+
You can list all available images with the command:
|
179
|
+
|
180
|
+
```
|
181
|
+
$ vagrant profitbricks images
|
182
|
+
```
|
183
|
+
|
184
|
+
```
|
185
|
+
$ vagrant profitbricks flavors
|
186
|
+
```
|
187
|
+
|
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:
|
191
|
+
|
192
|
+
```
|
193
|
+
$ vagrant profitbricks images <name>
|
194
|
+
$ vagrant profitbricks flavors <name>
|
195
|
+
```
|
196
|
+
|
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.
|
198
|
+
|
199
|
+
## Configuration
|
200
|
+
|
201
|
+
This provider exposes quite a few provider-specific configuration options:
|
202
|
+
|
203
|
+
| NAME| DESCRIPTION |
|
204
|
+
|---|---|
|
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. |
|
214
|
+
| 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"
|
233
|
+
end
|
234
|
+
end
|
235
|
+
```
|
236
|
+
|
237
|
+
You can find a more complete list the documentation for the [Config class](http://www.rubydoc.info/gems/vagrant-profitbricks/VagrantPlugins/ProfitBricks/Config).
|
238
|
+
|
239
|
+
### Networks
|
240
|
+
|
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.
|
245
|
+
|
246
|
+
## Development
|
247
|
+
|
248
|
+
To work on the `vagrant-profitbricks` plugin, clone this repository out, and use
|
249
|
+
[Bundler](http://gembundler.com) to get the dependencies:
|
250
|
+
|
251
|
+
```
|
252
|
+
$ bundle
|
253
|
+
```
|
254
|
+
|
255
|
+
Once you have the dependencies, verify the unit tests pass with `rake`:
|
256
|
+
|
257
|
+
```
|
258
|
+
$ bundle exec rake
|
259
|
+
```
|
260
|
+
|
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:
|
265
|
+
|
266
|
+
```
|
267
|
+
$ bundle exec vagrant up --provider=profitbricks
|
268
|
+
```
|