vagrant-oneandone 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 +33 -0
- data/.rspec +2 -0
- data/.rubocop.yml +29 -0
- data/.travis.yml +16 -0
- data/Gemfile +12 -0
- data/LICENSE +201 -0
- data/README.md +275 -0
- data/Rakefile +33 -0
- data/box/README.md +13 -0
- data/box/Vagrantfile +7 -0
- data/box/dummy.box +0 -0
- data/box/metadata.json +3 -0
- data/examples/01_coreos_simple/Vagrantfile +12 -0
- data/examples/02_django_centos7_app/Vagrantfile +14 -0
- data/examples/03_ubuntu12.04_shell_provision/Vagrantfile +19 -0
- data/examples/04_parallel_servers/Vagrantfile +26 -0
- data/examples/05_debian8_docker_provision/Vagrantfile +17 -0
- data/lib/vagrant-oneandone.rb +26 -0
- data/lib/vagrant-oneandone/action.rb +163 -0
- data/lib/vagrant-oneandone/action/connect_1and1.rb +28 -0
- data/lib/vagrant-oneandone/action/create.rb +76 -0
- data/lib/vagrant-oneandone/action/destroy.rb +69 -0
- data/lib/vagrant-oneandone/action/get_state.rb +17 -0
- data/lib/vagrant-oneandone/action/power_off.rb +49 -0
- data/lib/vagrant-oneandone/action/power_on.rb +39 -0
- data/lib/vagrant-oneandone/action/read_ssh_info.rb +54 -0
- data/lib/vagrant-oneandone/action/read_state.rb +44 -0
- data/lib/vagrant-oneandone/action/reload.rb +48 -0
- data/lib/vagrant-oneandone/command/list_appliances.rb +38 -0
- data/lib/vagrant-oneandone/command/list_datacenters.rb +36 -0
- data/lib/vagrant-oneandone/command/list_firewalls.rb +32 -0
- data/lib/vagrant-oneandone/command/list_ips.rb +45 -0
- data/lib/vagrant-oneandone/command/list_load_balancers.rb +43 -0
- data/lib/vagrant-oneandone/command/list_monitor_policies.rb +32 -0
- data/lib/vagrant-oneandone/command/list_servers.rb +32 -0
- data/lib/vagrant-oneandone/command/list_sizes.rb +43 -0
- data/lib/vagrant-oneandone/command/main.rb +85 -0
- data/lib/vagrant-oneandone/command/utils.rb +31 -0
- data/lib/vagrant-oneandone/config.rb +65 -0
- data/lib/vagrant-oneandone/config_resolver.rb +97 -0
- data/lib/vagrant-oneandone/errors.rb +45 -0
- data/lib/vagrant-oneandone/plugin.rb +36 -0
- data/lib/vagrant-oneandone/provider.rb +41 -0
- data/lib/vagrant-oneandone/version.rb +5 -0
- data/locales/en.yml +124 -0
- data/vagrant-oneandone.gemspec +29 -0
- data/vagrant-spec.config.rb +9 -0
- metadata +189 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: b0f816f92435f56df953f1b43412d451e0c0f2db
|
4
|
+
data.tar.gz: a9494b78b7a70c8893ff1582171079184aa95641
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 62615f02cb118ba4bf9c0e362b9d1da1c2af3a5e1d50e2fa8ce632a26a5a91ffa7bb8842294dfc1fc55e4c791e404a269c8c1259cbede38f6790a355606f2e1e
|
7
|
+
data.tar.gz: e4b5275e321edcc79a234387d6572d633d0e11bedc2625ff53637410d2a0c9a788150738dde7c8b8ebb1effa6e74f820f6727bda1ac1a24716d58cc9e1d342b4
|
data/.gitignore
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
*.gem
|
2
|
+
Gemfile.lock
|
3
|
+
*.rbc
|
4
|
+
/.config
|
5
|
+
/coverage/
|
6
|
+
/InstalledFiles
|
7
|
+
/pkg/
|
8
|
+
/spec/reports/
|
9
|
+
/spec/examples.txt
|
10
|
+
/test/tmp/
|
11
|
+
/test/version_tmp/
|
12
|
+
/tmp/
|
13
|
+
.dat*
|
14
|
+
.repl_history
|
15
|
+
build/
|
16
|
+
|
17
|
+
# Vagrant
|
18
|
+
.vagrant
|
19
|
+
|
20
|
+
## Documentation cache and generated files:
|
21
|
+
/.yardoc/
|
22
|
+
/_yardoc/
|
23
|
+
/doc/
|
24
|
+
/rdoc/
|
25
|
+
|
26
|
+
## Environment normalization:
|
27
|
+
/.bundle/
|
28
|
+
/vendor/bundle
|
29
|
+
/lib/bundler/man/
|
30
|
+
|
31
|
+
# RVM gemset/ruby setting
|
32
|
+
.ruby-*
|
33
|
+
.rvmrc
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Metrics/AbcSize:
|
2
|
+
Enabled: false
|
3
|
+
|
4
|
+
Metrics/BlockNesting:
|
5
|
+
Max: 4
|
6
|
+
|
7
|
+
Metrics/CyclomaticComplexity:
|
8
|
+
Enabled: false
|
9
|
+
|
10
|
+
Metrics/LineLength:
|
11
|
+
Max: 120
|
12
|
+
|
13
|
+
Metrics/MethodLength:
|
14
|
+
Enabled: false
|
15
|
+
|
16
|
+
Metrics/ModuleLength:
|
17
|
+
Enabled: false
|
18
|
+
|
19
|
+
Metrics/PerceivedComplexity:
|
20
|
+
Enabled: false
|
21
|
+
|
22
|
+
Style/Documentation:
|
23
|
+
Enabled: false
|
24
|
+
|
25
|
+
Style/FileName:
|
26
|
+
Exclude:
|
27
|
+
- 'lib/vagrant-oneandone.rb'
|
28
|
+
- 'vagrant-spec.config.rb'
|
29
|
+
|
data/.travis.yml
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
language: ruby
|
2
|
+
|
3
|
+
cache: bundler
|
4
|
+
|
5
|
+
branches:
|
6
|
+
only:
|
7
|
+
- master
|
8
|
+
rvm:
|
9
|
+
- 2.2.5
|
10
|
+
|
11
|
+
before_install:
|
12
|
+
- rvm @global do gem uninstall bundler --all --force --executables
|
13
|
+
- gem uninstall bundler --all --force --executables
|
14
|
+
- gem install bundler -v 1.12.5
|
15
|
+
|
16
|
+
script: rake spec:unit
|
data/Gemfile
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
group :development do
|
4
|
+
# tag: 'v1.8.5'
|
5
|
+
gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
|
6
|
+
# ref: 9bba7e1228379c0a249a06ce76ba8ea7d276afbe
|
7
|
+
gem 'vagrant-spec', git: 'https://github.com/mitchellh/vagrant-spec.git'
|
8
|
+
end
|
9
|
+
|
10
|
+
group :plugins do
|
11
|
+
gem 'vagrant-oneandone', path: '.'
|
12
|
+
end
|
data/LICENSE
ADDED
@@ -0,0 +1,201 @@
|
|
1
|
+
Apache License
|
2
|
+
Version 2.0, January 2004
|
3
|
+
http://www.apache.org/licenses/
|
4
|
+
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
6
|
+
|
7
|
+
1. Definitions.
|
8
|
+
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
11
|
+
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
13
|
+
the copyright owner that is granting the License.
|
14
|
+
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
16
|
+
other entities that control, are controlled by, or are under common
|
17
|
+
control with that entity. For the purposes of this definition,
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
19
|
+
direction or management of such entity, whether by contract or
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
22
|
+
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
24
|
+
exercising permissions granted by this License.
|
25
|
+
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
27
|
+
including but not limited to software source code, documentation
|
28
|
+
source, and configuration files.
|
29
|
+
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
31
|
+
transformation or translation of a Source form, including but
|
32
|
+
not limited to compiled object code, generated documentation,
|
33
|
+
and conversions to other media types.
|
34
|
+
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
36
|
+
Object form, made available under the License, as indicated by a
|
37
|
+
copyright notice that is included in or attached to the work
|
38
|
+
(an example is provided in the Appendix below).
|
39
|
+
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
46
|
+
the Work and Derivative Works thereof.
|
47
|
+
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
49
|
+
the original version of the Work and any modifications or additions
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
61
|
+
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
64
|
+
subsequently incorporated within the Work.
|
65
|
+
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
72
|
+
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
78
|
+
where such license applies only to those patent claims licensable
|
79
|
+
by such Contributor that are necessarily infringed by their
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
82
|
+
institute patent litigation against any entity (including a
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
85
|
+
or contributory patent infringement, then any patent licenses
|
86
|
+
granted to You under this License for that Work shall terminate
|
87
|
+
as of the date such litigation is filed.
|
88
|
+
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
91
|
+
modifications, and in Source or Object form, provided that You
|
92
|
+
meet the following conditions:
|
93
|
+
|
94
|
+
(a) You must give any other recipients of the Work or
|
95
|
+
Derivative Works a copy of this License; and
|
96
|
+
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
98
|
+
stating that You changed the files; and
|
99
|
+
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
102
|
+
attribution notices from the Source form of the Work,
|
103
|
+
excluding those notices that do not pertain to any part of
|
104
|
+
the Derivative Works; and
|
105
|
+
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
108
|
+
include a readable copy of the attribution notices contained
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
111
|
+
of the following places: within a NOTICE text file distributed
|
112
|
+
as part of the Derivative Works; within the Source form or
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
114
|
+
within a display generated by the Derivative Works, if and
|
115
|
+
wherever such third-party notices normally appear. The contents
|
116
|
+
of the NOTICE file are for informational purposes only and
|
117
|
+
do not modify the License. You may add Your own attribution
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
120
|
+
that such additional attribution notices cannot be construed
|
121
|
+
as modifying the License.
|
122
|
+
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
124
|
+
may provide additional or different license terms and conditions
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
128
|
+
the conditions stated in this License.
|
129
|
+
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
133
|
+
this License, without any additional terms or conditions.
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
135
|
+
the terms of any separate license agreement you may have executed
|
136
|
+
with Licensor regarding such Contributions.
|
137
|
+
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
140
|
+
except as required for reasonable and customary use in describing the
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
142
|
+
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
152
|
+
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
158
|
+
incidental, or consequential damages of any character arising as a
|
159
|
+
result of this License or out of the use or inability to use the
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
162
|
+
other commercial damages or losses), even if such Contributor
|
163
|
+
has been advised of the possibility of such damages.
|
164
|
+
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
168
|
+
or other liability obligations and/or rights consistent with this
|
169
|
+
License. However, in accepting such obligations, You may act only
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
174
|
+
of your accepting any such warranty or additional liability.
|
175
|
+
|
176
|
+
END OF TERMS AND CONDITIONS
|
177
|
+
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
179
|
+
|
180
|
+
To apply the Apache License to your work, attach the following
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "{}"
|
182
|
+
replaced with your own identifying information. (Don't include
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
184
|
+
comment syntax for the file format. We also recommend that a
|
185
|
+
file or class name and description of purpose be included on the
|
186
|
+
same "printed page" as the copyright notice for easier
|
187
|
+
identification within third-party archives.
|
188
|
+
|
189
|
+
Copyright (c) 2016 1&1 Internet SE
|
190
|
+
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
192
|
+
you may not use this file except in compliance with the License.
|
193
|
+
You may obtain a copy of the License at
|
194
|
+
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
196
|
+
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
200
|
+
See the License for the specific language governing permissions and
|
201
|
+
limitations under the License.
|
data/README.md
ADDED
@@ -0,0 +1,275 @@
|
|
1
|
+
# Vagrant OneAndOne Cloud Provider
|
2
|
+
|
3
|
+
[![Build Status](https://travis-ci.org/1and1/oneandone-cloudserver-vagrant.svg?branch=master)](https://travis-ci.org/1and1/oneandone-cloudserver-vagrant)
|
4
|
+
|
5
|
+
## Table of Contents
|
6
|
+
|
7
|
+
* [Introduction](#introduction)
|
8
|
+
* [Features](#features)
|
9
|
+
* [Requirements](#requirements)
|
10
|
+
* [Usage](#usage)
|
11
|
+
* [Configuration](#configuration)
|
12
|
+
* [Supported Commands](#supported-commands)
|
13
|
+
* [Examples](#examples)
|
14
|
+
* [Development](#development)
|
15
|
+
|
16
|
+
|
17
|
+
## Introduction
|
18
|
+
|
19
|
+
This is a [Vagrant](http://www.vagrantup.com) plugin that adds a
|
20
|
+
1&1 provider to Vagrant, which allows Vagrant to control and provision
|
21
|
+
machines in the [1&1 Server Cloud](https://www.1and1.com/dynamic-cloud-server).
|
22
|
+
|
23
|
+
## Features
|
24
|
+
|
25
|
+
* Create and destroy servers.
|
26
|
+
* Start, stop and restart servers.
|
27
|
+
* Provision the servers with built-in Vagrant provisioners.
|
28
|
+
* SSH into the instances.
|
29
|
+
* Custom sub-commands within the Vagrant CLI to query 1&1 Server entities.
|
30
|
+
|
31
|
+
## Requirements
|
32
|
+
|
33
|
+
* Ruby 2.0 or higher
|
34
|
+
* [Vagrant 1.4+](http://www.vagrantup.com/downloads.html)
|
35
|
+
* [1&1](https://www.1and1.com/dynamic-cloud-server) API access key
|
36
|
+
* SSH (RSA) public/private key pair
|
37
|
+
|
38
|
+
**Note:** Public and private keys need to be stored on the same location.
|
39
|
+
|
40
|
+
## Usage
|
41
|
+
|
42
|
+
Install the plugin using the standard installation method, the Vagrant command-line interface:
|
43
|
+
|
44
|
+
```
|
45
|
+
vagrant plugin install vagrant-oneandone
|
46
|
+
```
|
47
|
+
|
48
|
+
Before we start using the plugin we must provider a custom [box](https://www.vagrantup.com/docs/boxes.html) for the 1&1
|
49
|
+
provider. Vagrant requires any provider to introduce its own [package format](https://www.vagrantup.com/docs/boxes/format.html)
|
50
|
+
for Vagrant environment.
|
51
|
+
|
52
|
+
You can find an example box and instructions how to create it in the [box directory](box/).
|
53
|
+
To use the `dummy.box`, add it to Vagrant:
|
54
|
+
|
55
|
+
```
|
56
|
+
vagrant box add dummy https://github.com/StackPointCloud/oneandone-cloudserver-vagrant/raw/master/box/dummy.box
|
57
|
+
```
|
58
|
+
|
59
|
+
Assuming you have a valid [Vagrantfile](https://www.vagrantup.com/docs/vagrantfile/)
|
60
|
+
in the same directory, initiate a machine creation, i.e., server deployment:
|
61
|
+
|
62
|
+
```
|
63
|
+
vagrant up --provider=oneandone
|
64
|
+
```
|
65
|
+
|
66
|
+
The following example shows a minimal Vagrantfile configuration for the 1&1 provider.
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
Vagrant.configure('2') do |config|
|
70
|
+
config.vm.box = 'dummy'
|
71
|
+
config.ssh.private_key_path = 'path/to/private/key'
|
72
|
+
|
73
|
+
config.vm.provider :oneandone do |server|
|
74
|
+
server.api_key = 'your api key'
|
75
|
+
server.name = 'my-server-name'
|
76
|
+
end
|
77
|
+
end
|
78
|
+
```
|
79
|
+
|
80
|
+
## Configuration
|
81
|
+
|
82
|
+
The 1&1 Vagrant provider exposes a few provider-specific configuration options:
|
83
|
+
|
84
|
+
* `api_key`: The API key for accessing 1&1 Cloud Server (required). Defaults to `ENV['ONEANDONE_API_KEY']`, if not provided.
|
85
|
+
* `name`: The server host name. Required, if Vagrant `config.vm.hostname` option is not specified. It has precedence over `hostname`, if both options are set.
|
86
|
+
* `fixed_size`: A fixed-instance size for the server (required). ID or name is supported. Defaults to `M`, if not provided.
|
87
|
+
* `appliance`: A server appliance for the server (required). ID or name (without spaces) is supported. Defaults to `ubuntu1404-64std`, if not provided.
|
88
|
+
* `datacenter`: A data center for the server (required). ID or country code is supported. Defaults to `US`, if not provided.
|
89
|
+
* `description`: The server description.
|
90
|
+
* `password`: The server's `root` user password.
|
91
|
+
* `ip`: An unassigned public IP address for the server. ID or IP address can be used.
|
92
|
+
* `firewall_id`: The ID of a firewall policy that is to be assigned to the server.
|
93
|
+
* `load_balancer_id`: The ID of a load balancer that is to be assigned to the server.
|
94
|
+
* `monitoring_policy_id`: The ID of a monitoring policy that is to be assigned to the server.
|
95
|
+
* `timeout`: The server deployment timeout in seconds. Defaults to `1800`, if not provided.
|
96
|
+
|
97
|
+
**Note:** Only Linux-based server appliances are supported in this version of the plugin.
|
98
|
+
|
99
|
+
## Supported Commands
|
100
|
+
|
101
|
+
The following Vagrant actions are currently supported with the provider:
|
102
|
+
|
103
|
+
- `vagrant up`: Creates or starts an existing server instance.
|
104
|
+
- `vagrant status`: Displays the server status (active, off, not created).
|
105
|
+
- `vagrant halt`: Stops the server instance. If `--force` option is specified, performs hardware-based shutdown.
|
106
|
+
- `vagrant ssh`: Connects to the server instance using the configured public/private keys. No insecure Vagrant key is supported.
|
107
|
+
- `vagrant ssh-config`: Displays the SSH configuration for the server instance.
|
108
|
+
- `vagrant provision`: Provisions the server with one or more.
|
109
|
+
- `vagrant reload`: Reboots the server instance. If `--force` option is specified, performs hardware-based reset.
|
110
|
+
- `vagrant destroy`: Destroys the server instance. If `--force` option is specified, deletes the server without asking for confirmation.
|
111
|
+
|
112
|
+
In addition to these, several custom commands are available to list 1&1 Cloud entities.
|
113
|
+
|
114
|
+
```
|
115
|
+
vagrant oneandone
|
116
|
+
Usage: vagrant oneandone <subcommand> [<api_key>]
|
117
|
+
|
118
|
+
Available subcommands:
|
119
|
+
appliances
|
120
|
+
datacenters
|
121
|
+
firewalls
|
122
|
+
ips
|
123
|
+
loadbalancers
|
124
|
+
monitors
|
125
|
+
servers
|
126
|
+
sizes
|
127
|
+
|
128
|
+
For help on any subcommand run `vagrant oneandone <subcommand> -h`
|
129
|
+
```
|
130
|
+
|
131
|
+
An example of a custom command output:
|
132
|
+
|
133
|
+
```
|
134
|
+
vagrant oneandone datacenters
|
135
|
+
+----------------------------------+------------------------------------------------------+--------------+
|
136
|
+
| ID | Location | Country Code |
|
137
|
+
+----------------------------------+------------------------------------------------------+--------------+
|
138
|
+
| 81DEF28500FBC2A973FC0C620DF5B721 | Spain | ES |
|
139
|
+
| 908DC2072407C94C8054610AD5A53B8C | United States of America | US |
|
140
|
+
| 4EFAD5836CE43ACA502FD5B99BEE44EF | Germany | DE |
|
141
|
+
| 5091F6D8CBFEF9C26ACE957C652D5D49 | United Kingdom of Great Britain and Northern Ireland | GB |
|
142
|
+
+----------------------------------+------------------------------------------------------+--------------+
|
143
|
+
```
|
144
|
+
|
145
|
+
## Examples
|
146
|
+
|
147
|
+
The Vagrantfile examples in this section can be found in the `examples` directory of this repository.
|
148
|
+
|
149
|
+
It is assumed that a valid API key is set in `$ONEANDONE_API_KEY` environment variable.
|
150
|
+
|
151
|
+
* A simple CoreOS server configuration:
|
152
|
+
```ruby
|
153
|
+
Vagrant.configure('2') do |config|
|
154
|
+
config.vm.box = 'dummy'
|
155
|
+
config.ssh.private_key_path = '~/.ssh/id_rsa'
|
156
|
+
|
157
|
+
config.vm.provider :oneandone do |server|
|
158
|
+
server.name = 'vagrant-coreos'
|
159
|
+
server.appliance = 'CoreOS_Stable_64std'
|
160
|
+
end
|
161
|
+
end
|
162
|
+
```
|
163
|
+
|
164
|
+
* Deploy a Django DB application server:
|
165
|
+
```ruby
|
166
|
+
Vagrant.configure('2') do |config|
|
167
|
+
config.vm.box = 'dummy'
|
168
|
+
config.ssh.private_key_path = '~/.ssh/id_rsa'
|
169
|
+
|
170
|
+
config.vm.provider :oneandone do |server|
|
171
|
+
server.name = 'django-db-server'
|
172
|
+
server.appliance = 'django'
|
173
|
+
server.datacenter = 'DE'
|
174
|
+
server.fixed_size = 'L'
|
175
|
+
end
|
176
|
+
end
|
177
|
+
```
|
178
|
+
|
179
|
+
* Run shell provisioning on an Ubuntu 12.04 instance:
|
180
|
+
```ruby
|
181
|
+
Vagrant.configure('2') do |config|
|
182
|
+
config.vm.hostname = 'ubuntu1204-server-example'
|
183
|
+
config.vm.box = 'dummy'
|
184
|
+
config.ssh.private_key_path = '~/.ssh/id_rsa'
|
185
|
+
config.ssh.pty = true
|
186
|
+
|
187
|
+
config.vm.provider :oneandone do |oneandone|
|
188
|
+
oneandone.appliance = 'ubuntu1204-64std'
|
189
|
+
oneandone.datacenter = 'ES'
|
190
|
+
oneandone.fixed_size = 'S'
|
191
|
+
end
|
192
|
+
|
193
|
+
config.vm.provision "shell" do |s|
|
194
|
+
s.inline = 'apt-get update && apt-get install -y'
|
195
|
+
end
|
196
|
+
end
|
197
|
+
```
|
198
|
+
|
199
|
+
* Create multiple servers in parallel:
|
200
|
+
```ruby
|
201
|
+
Vagrant.configure('2') do |config|
|
202
|
+
config.vm.box = 'dummy'
|
203
|
+
config.ssh.private_key_path = '~/.ssh/id_rsa'
|
204
|
+
|
205
|
+
config.vm.define :centos do |centos|
|
206
|
+
centos.ssh.pty = true
|
207
|
+
centos.vm.provider :oneandone do |vm|
|
208
|
+
vm.name = 'worker1'
|
209
|
+
vm.description = 'worker node 1'
|
210
|
+
vm.appliance = 'centos7-64std'
|
211
|
+
vm.datacenter = 'US'
|
212
|
+
end
|
213
|
+
end
|
214
|
+
|
215
|
+
config.vm.define :ubuntu do |ubuntu|
|
216
|
+
ubuntu.vm.provider :oneandone do |vm|
|
217
|
+
vm.name = 'worker2'
|
218
|
+
vm.description = 'worker node 2'
|
219
|
+
vm.appliance = 'ubuntu1604-64std'
|
220
|
+
vm.datacenter = 'US'
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
```
|
225
|
+
|
226
|
+
* Provision a Debian 8 server with Docker:
|
227
|
+
```ruby
|
228
|
+
Vagrant.configure('2') do |config|
|
229
|
+
config.vm.box = 'dummy'
|
230
|
+
config.ssh.private_key_path = '~/.ssh/id_rsa'
|
231
|
+
|
232
|
+
config.vm.provider :oneandone do |oneandone|
|
233
|
+
oneandone.name = 'debian8-docker'
|
234
|
+
oneandone.appliance = 'debian8-64std'
|
235
|
+
oneandone.datacenter = 'GB'
|
236
|
+
oneandone.fixed_size = 'XL'
|
237
|
+
end
|
238
|
+
|
239
|
+
config.vm.provision "docker" do |d|
|
240
|
+
end
|
241
|
+
end
|
242
|
+
```
|
243
|
+
|
244
|
+
## Development
|
245
|
+
|
246
|
+
While Ruby 2.0 might be sufficient to run the plugin within Vagrant, some of the
|
247
|
+
plugin dependencies may require a higher version of Ruby to install. Therefore,
|
248
|
+
Ruby 2.2.3 or higher is recommended for the plugin development.
|
249
|
+
|
250
|
+
Check out the repository and use [Bundler](http://bundler.io/) to install dependencies.
|
251
|
+
|
252
|
+
The current version of Vagrant (1.8.6 and 1.8.7.dev) requires Bundler version 1.12.5.
|
253
|
+
|
254
|
+
$ gem install bundler -v 1.12.5
|
255
|
+
|
256
|
+
Install the plugin dependency gems:
|
257
|
+
|
258
|
+
$ bundle install
|
259
|
+
|
260
|
+
Execute the unit test task:
|
261
|
+
|
262
|
+
$ rake spec:unit
|
263
|
+
|
264
|
+
`bundle exec vagrant <command>` enables you to test the plugin during the development.
|
265
|
+
|
266
|
+
Build the plugin gem for local installation and deployment to https://rubygems.org/:
|
267
|
+
|
268
|
+
$ rake build
|
269
|
+
|
270
|
+
Before you send a pull request, make sure you have successfully run the functional
|
271
|
+
tests as well.
|
272
|
+
|
273
|
+
$ rake spec:acceptance
|
274
|
+
|
275
|
+
Refer to [the test documentation](spec/doc/) for more information on the plugin testing.
|