vagrant-arubacloud 0.0.7 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8e6b7725f11d8c19a1af3c69ce82dedd843be142a6e552904a4d56003e2e38a5
4
- data.tar.gz: 2570807111ff45ddb24c37690fc72a3fa8d5dd339fe69730dd41bf9a890b780c
3
+ metadata.gz: 7c8a6eaf04b628decee3667641f3cfdd980a523a19e16c1c67186ec3e96d5c91
4
+ data.tar.gz: f2416738f3588dcf75f6d19faa2c1eef73504c087144adb313d5010c0eb7ab48
5
5
  SHA512:
6
- metadata.gz: 5074fab4bee51512dde7fb82df4ca08b4a8473bf11c09c23c040a7d5578cf7f1e4123f48229a2db0e418db4fdf1f8a7718d0c304318dd88b80e36cc572004ee5
7
- data.tar.gz: 40869a4a436bdb3855509c88c892ae623fd059ad6eb521782be370457df697000054ba0169766ba5f4dae99c524a73a6197df32d17c3d432ca8fa3b58890e2a2
6
+ metadata.gz: f4c4a6e601ab032685d527816330bf3b952cef4807e1e3756086c5375f8e469c17960fd13b3269caaeebf96f1cbb360d72886816908f48c87134083f6f1e3f08
7
+ data.tar.gz: 259cb7a6bfd638ed3e91d59c559c68d039ac177496bdf1935ab65507258abc50ddfedb3ebc32de38fc781751da0dd86edb79a91f78acb8bf6d3a8f0546b1f22c
@@ -1,36 +1,36 @@
1
- <a name="0.0.7"></a>
2
- ## [0.0.7] (2018-03-07)
3
-
4
- #### Bug Fixes
5
-
6
- * Fix missing **'ip address'** when row display VM with hypervisor 'pro' ( *'vagrant arubacloud servers'* )
7
-
8
- #### Documentation
9
-
10
- * changes in README.md
11
-
12
-
13
- <a name="0.0.6"></a>
14
- ## [0.0.6] (2018-03-06)
15
-
16
- #### Documentation
17
-
18
- * correct License info
19
-
20
-
21
- <a name="0.0.5"></a>
22
- ## [0.0.5] (2018-03-06)
23
-
24
- #### Features
25
-
26
- * added command **'snapshot'** *create*, *delete*, *restore*, *list* methods
27
- * changed command **vagrant arubacloud servers** :now output *'DC*, *'Id'* , *'status description'* .
28
- * parameter **admin_password** ( in :arubacloud section) is removed and replaced by the directive **'nodename'.ssh.password** in vagrant config section.
29
- * added command **reload** as *power off* ( it's a 'shutdown ' and not 'power-off' forced) and *power on*
30
- * after vagrant command *'up'* or *'reload'*, is executed a **synced_folder**
31
- * changed option **package_id** (in :arubacloud section) : valid values now are : *'small'*, *'medium'*, *'large'*, *'extra large'* ;
32
- * added new parameter **endpoint** (in :arubacloud section) to define DataCenter Aruba can be used for the defined VM in Vagrantfile (
33
- this parameter replaces *'nodename'.url* )
34
- * changed the use of **url** parameter (in :arubacloud section) : should only be used when a new 'dc?' not yet included in this plugin ( override the *'nodename'.endpoint* value ).
35
- * added **[dc.]** (name of DataCenter) in output for command : *'up'*, *'reload'* , *'halt'*, *'arubacloud servers/templates'*, *'destroy'*, *'snapshot'*.
36
-
1
+ <a name="0.0.7"></a>
2
+ ## [0.0.7] (2018-03-07)
3
+
4
+ #### Bug Fixes
5
+
6
+ * Fix missing **'ip address'** when row display VM with hypervisor 'pro' ( *'vagrant arubacloud servers'* )
7
+
8
+ #### Documentation
9
+
10
+ * changes in README.md
11
+
12
+
13
+ <a name="0.0.6"></a>
14
+ ## [0.0.6] (2018-03-06)
15
+
16
+ #### Documentation
17
+
18
+ * correct License info
19
+
20
+
21
+ <a name="0.0.5"></a>
22
+ ## [0.0.5] (2018-03-06)
23
+
24
+ #### Features
25
+
26
+ * added command **'snapshot'** *create*, *delete*, *restore*, *list* methods
27
+ * changed command **vagrant arubacloud servers** :now output *'DC*, *'Id'* , *'status description'* .
28
+ * parameter **admin_password** ( in :arubacloud section) is removed and replaced by the directive **'nodename'.ssh.password** in vagrant config section.
29
+ * added command **reload** as *power off* ( it's a 'shutdown ' and not 'power-off' forced) and *power on*
30
+ * after vagrant command *'up'* or *'reload'*, is executed a **synced_folder**
31
+ * changed option **package_id** (in :arubacloud section) : valid values now are : *'small'*, *'medium'*, *'large'*, *'extra large'* ;
32
+ * added new parameter **endpoint** (in :arubacloud section) to define DataCenter Aruba can be used for the defined VM in Vagrantfile (
33
+ this parameter replaces *'nodename'.url* )
34
+ * changed the use of **url** parameter (in :arubacloud section) : should only be used when a new 'dc?' not yet included in this plugin ( override the *'nodename'.endpoint* value ).
35
+ * added **[dc.]** (name of DataCenter) in output for command : *'up'*, *'reload'* , *'halt'*, *'arubacloud servers/templates'*, *'destroy'*, *'snapshot'*.
36
+
data/Gemfile CHANGED
@@ -1,12 +1,12 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in vagrant-vagrant-arubacloud.gemspec
4
- gemspec
5
-
6
- group :development do
7
- gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
8
- end
9
-
10
- #group :plugins do
11
- # gem 'vagrant-arubacloud', path: '.'
12
- #end
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in vagrant-arubacloud.gemspec
4
+ gemspec
5
+
6
+ group :development do
7
+ gem 'vagrant', git: 'https://github.com/mitchellh/vagrant.git'
8
+ end
9
+
10
+ #group :plugins do
11
+ # gem 'vagrant-arubacloud', path: '.'
12
+ #end
@@ -1,22 +1,22 @@
1
- Copyright (c) 2018 Aruba S.p.a.
2
-
3
- MIT License
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining
6
- a copy of this software and associated documentation files (the
7
- "Software"), to deal in the Software without restriction, including
8
- without limitation the rights to use, copy, modify, merge, publish,
9
- distribute, sublicense, and/or sell copies of the Software, and to
10
- permit persons to whom the Software is furnished to do so, subject to
11
- the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be
14
- included in all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2018 Aruba S.p.a.
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -1,954 +1,954 @@
1
- # Vagrant ArubaCloud Provider
2
-
3
-
4
-
5
- ## Table of Contents
6
-
7
- * [Overview](#overview)
8
- * [Features](#features)
9
- * [Installation](#installation)
10
- * [Available commands and parameters](#available-commands-and-parameters)
11
- * [Obsolete options](#obsolete-options)
12
- * [Quick start](#quickstart)
13
- * [Example Usage](#example-usage)
14
- * [List Templates available](#list-templates-available)
15
- * [Create and Start VM](#create-and-start-vm)
16
- * [View VM from web](#view-vm-from-web)
17
- * [Reload VM](#reload-vm)
18
- * [Provision in VM](#provision-in-vm)
19
- * [Destroy VM](#destroy-vm)
20
- * [Snapshot VM](#snapshot-vm)
21
- * [Create](#create)
22
- * [List](#list)
23
- * [Restore](#restore)
24
- * [Delete](#delete)
25
- * [View VM running in my Arubacloud](#view-vm-running-in-my-arubacloud)
26
- * [Appendix](#appendix)
27
- * [Example Vagrantfile to list arubacloud servers templates](#example-vagrantfile-to-list-arubacloud-servers-templates)
28
- * [Example Vagrantfile type smart basic](#example-vagrantfile-type-smart-basic)
29
- * [Example Vagrantfile type smart with syncing and provision example](#example-vagrantfile-type-smart-with-syncing-and-provision-example)
30
- * [Example Vagrantfile type pro](#example-vagrantfile-type-pro)
31
- * [Example multi machine](#example-multi-machine)
32
- * [Commands](#commands)
33
- * [Vagrantfile](#vagrantfile)
34
- * [Vagrant option supported and not](#vagrant-option-supported-and-not)
35
- * [Error messages](#error-messages)
36
- * [Development](#development)
37
- * [License](#license)
38
-
39
-
40
- ## Overview
41
-
42
-
43
- This is a [Vagrant](http://www.vagrantup.com) plugin that adds ArubaCloud provider
44
- to Vagrant, allowing Vagrant to control and provision machine in ArubaCloud IaaS Service.
45
-
46
- ## Features
47
- * Boot ArubaCloud instances.
48
- * SSH into instances.
49
- * Provision the instances with any built-in Vagrant provisioner.
50
- * Specify which datacenter you want to use with a simple prefix.
51
- * Configure multi machine architecture (an example of configuration is provided)
52
-
53
-
54
- ## Installation
55
- Install using standard `vagrant plugin install` method, since the gem is published in
56
- [central RubyGemsrepository](https://rubygems.org/gems/vagrant-arubacloud)
57
-
58
- ```
59
- $ vagrant plugin install vagrant-arubacloud
60
- ```
61
-
62
-
63
-
64
- ## Available commands and parameters
65
-
66
-
67
- - the command **vagrant arubacloud servers** show for each server found :
68
- * DC (DataCenter), the 'id' of the server, the description of the status(run, stop ... etc).
69
- * the name of the node is highlighted to see if it has been defined in Vagrantfile.
70
-
71
- - the command **vagrant reload** execute a simple
72
- *power off* ( it's a 'shutdown' and not 'power-off' forced)
73
- *power on*
74
-
75
- - the command **vagrant snapshot** execute a snapshot of server:
76
-
77
-
78
- | Type| Command | description | status server |
79
- | --- | --- | --- | --- |
80
- | `create` | *vagrant snapshot -t create -n 'server_name'* | create a snapshot of vm | running |
81
- | `delete` | *vagrant snapshot -t delete -n 'server_name'* | delete snapshot of vm | any |
82
- | `restore` | *vagrant snapshot -t restore -n 'server_name'* | restore vm from snapshot | power off |
83
- | `list` | *vagrant snapshot -t list -n 'server_name'* | list info relate snapshot of vm | any |
84
-
85
- *Note*
86
- 1. *if the 'snapshot ... restore ... ' is executed, once the command is finished, after a few seconds the snapshot is automatically deleted*
87
-
88
-
89
- - parameter **package_id** (in *:arubacloud* section ) is changed.
90
- Valid values now are :'small', 'medium', 'large', 'extra large'
91
-
92
-
93
- | package_id |CPU | Ram (GB) | Disk Size (GB) |
94
- | --------------------------------|--------------------| ------------------------------ | -------- |
95
- | `small` |1 | 1 | 20 |
96
- | `medium` |1 | 2 | 40 |
97
- | `large` |2 | 4 | 80 |
98
- | `extra large` |4 | 8 | 160 |
99
-
100
-
101
-
102
- - parameter **endpoint** (in *:arubacloud* section ) define what is the DataCenter Aruba can be used for the defined VM in Vagrantfile;
103
- valid value are: dc1, dc2, dc3, dc4, dc5, dc6, dc8
104
- (default: dc2 )
105
-
106
-
107
- | Parameter | Data Center Location |
108
- |-----------|------------------------------------------------------|
109
- | `dc1` | Italy 1 |
110
- | `dc2` | Italy 2 |
111
- | `dc3` | Czech republic |
112
- | `dc4` | France |
113
- | `dc5` | Deutschland |
114
- | `dc6` | United Kingdom |
115
- | `dc8` | Poland |
116
-
117
-
118
- - the parameter **nodename.url** (in *:arubacloud* section ) , if used can override the 'endpoint' value.
119
- This parameter should only be used in case of new 'dc*'not yet included in this plugin.
120
-
121
-
122
- - parameter **service_type** (in *:arubacloud* section ) is the 'code' (is a numeric value) of hypervisor used (in Arubacloud )
123
- Valid values are:
124
-
125
- | code | hypervisor | service type |
126
- | --- | --- | --- |
127
- | `1` | Microsoft Hyper-V | Cloud pro |
128
- | `2` | VMWare | Cloud pro |
129
- | `3` | Microsoft Hyper-V Low Cost | Cloud pro |
130
- | `4` | VMWare | Cloud smart |
131
-
132
- - parameter **server_name** (in *:arubacloud* section ) is the name of server ( name listed in arubacloud web interface)
133
- - parameter **arubacloud_username** (in *:arubacloud* section ) is user account to access arubacloud
134
- - parameter **arubacloud_password** (in *:arubacloud* section ) is password of account to access arubacloud
135
- - parameter **url** (in *:arubacloud* section ) is url of the web service to use ( *DEPRECATED*)
136
- - parameter **template_id** (in *:arubacloud* section ) is ID of the template to use ( read the next notes to determine the correct value)
137
- - parameter **cpu_number** (in *:arubacloud* section ) is number of virtual CPU to be assigned to the VM only for service type **not smart**
138
-
139
- | descr | n (number) of CPU) |
140
- | --- | --- |
141
- | Pro VMWare | 1 < `n` < 8 |
142
- | Pro Hyper-V | 1 < `n` < 4 |
143
-
144
- - parameter **ram_qty** (in *:arubacloud* section ) is amount of GB of RAM to be assigned to the VM (n <= 16) only for service type **not smart**
145
- - parameter **hds** (in *:arubacloud* section ) is an array containing hard disk Configuration only for service type **not smart**:
146
-
147
- *Example configuration (size is expressed in GB):*
148
- *hds* = [{:type => 0, :size => 100}, {:type => 1, :size => 200}]
149
-
150
- *Note*
151
- 1. *Hd type 0 is required because specify the first hard disk, max size per hd: 500 GB)*
152
- 2. *Hd type > 0 < 4 are 3 additional hard disks (optional)*
153
-
154
-
155
-
156
- Now the very important's messages has the name of DataCenter where the VM running : [dc?] in row displayed ( 'up', 'reload' , 'halt', 'arubacloud servers/templates', 'destroy', 'snapshot')
157
-
158
- Together with the package are provided some 'Vagrantfile_...', as an example of basic configuration , minimum configuration for consulting existing servers/templates in Arubacloud, configuration with syncing_folder and a simple shell for provisioning, multi-machine configuration with multiple VM .
159
-
160
-
161
-
162
- ___________
163
- ## Obsolete options
164
- (in config *:arubacloud* section)
165
- __________
166
-
167
-
168
- - option **admin_password** has been removed and replaced by the directive :
169
- 'nodename'.ssh.password
170
-
171
- _______________________________________
172
-
173
-
174
-
175
- ## Quickstart
176
- After installing the plugin (instructions above), the quickest way to get
177
- started is to actually use a dummy ArubaCloud box and specify all the details
178
- manually within a `config.vm.provider` block. So first, add the dummy
179
- box using any name you want:
180
-
181
- ```
182
- $ vagrant box add dummy https://github.com/arubacloud/vagrant-arubacloud/raw/master/dummy.box
183
- ...
184
- ```
185
-
186
- And then make a Vagrantfile that looks like the following, filling in
187
- your information where necessary. For now, username and password must be specified as environment variables:
188
- ```
189
- export AC_USERNAME=""
190
- export AC_PASSWORD=""
191
- ```
192
-
193
- For now, the root password must be specified in this way.
194
-
195
-
196
-
197
-
198
- ### Example Usage
199
-
200
-
201
- >
202
- > define a smart VM with these characteristics
203
- > use DataCenter Aruba 'dc2' , service type 'smart', package_id 'small' ( 1 cpu, 1 GB Ram) with 'Ubuntu Server 14.04 LTS 64bit '
204
-
205
-
206
-
207
-
208
- #### List Templates available
209
-
210
- First action is determine what is *template_id* available for 'dc2';
211
- To do this , you must prepare a minimal configuration of Vagrantfile and run a command for list the templates can be used.
212
- You can found an example in current directory ('Vagrantfile_only_arubacloud_tmpl_srv') or in Appendix of this document:
213
- [Example Vagrantfile to list arubacloud servers templates](#example-vagrantfile-to-list-arubacloud-servers-templates)
214
-
215
- _______
216
- **WARNING** : *this configuration MUST BE changed for all others use of vagrant (up, destroy, halt , reload.... etc) because is missing ....ssh.username, 'dummy' is not valid for package_id, template_id, .....ssh.password*
217
- ________
218
-
219
- Now check environment variables *AC_USERNAME*, *AC_PASSWORD* if set with correct value and enter the command from console:
220
-
221
-
222
- vagrant arubacloud templates
223
-
224
-
225
- This command validate the Vagrantfile , create if not exist a directory '.vagrant' in current directory and return a list of all templates available in 'dc2';
226
- After obtain the list , change the *template_id* , in Vagrantfile, from 'dummy' to value in ID column for row selected;
227
- (in this case and current date the *template_id* is 601)
228
-
229
-
230
- #### Create and Start VM
231
-
232
- then... :
233
- - choose and set value of *package_id*
234
- - change *vmvgr01_config.ssh.password* value
235
- - insert *vmvgr01_config.ssh.username* = 'root'
236
- - check if bypass the synced_folder for '.' into /Vagrant of the guest ( VM )
237
- - ....and check for other options if needed;
238
-
239
-
240
- You can found an example in current directory ('Vagrantfile_syncing_and_sample_provision') or in Appendix of this document:
241
- [Example Vagrantfile type smart with syncing and provision example](#example-vagrantfile-type-smart-with-syncing-and-provision-example)
242
- This configuration define a synced_folder bypass for '.' and add synced_folder for directory:
243
-
244
-
245
- /hostshare2 (Host) to --> /guestshare_norm ( VM )
246
-
247
-
248
- Save the file and enter the command:
249
-
250
-
251
- vagrant up --provider=arubacloud
252
-
253
-
254
- This command re-validate the Vagrantfile , create the VM as Ubuntu 14.04 instance in the second Italian Datacenter (DC2-IT) within your account and assuming your SSH information was filled in properly within your Vagrantfile; SSH and provisioning will work as well.
255
-
256
- The output is :
257
-
258
-
259
- ```
260
- Bringing machine 'vmvgr01' up with 'arubacloud' provider...
261
- ==> vmvgr01: Creating a server with the following settings...
262
- ==> vmvgr01: -- Datacenter: dc2
263
- ==> vmvgr01: -- Name: lnxtestvag1
264
- ==> vmvgr01: -- Root Password: test123
265
- ==> vmvgr01: -- Package: small config as: CPU: 1, Ram(GB): 1, DiskSize(GB): 20
266
- ==> vmvgr01: -- OS Template: 601
267
- ==> vmvgr01: -- Service Type: 4 (smart)
268
- ==> vmvgr01: [dc2] Waiting until server is ready...
269
- ==> vmvgr01: [dc2] The server is ready!
270
- ==> vmvgr01: Waiting for machine to boot. This may take a few minutes...
271
- vmvgr01: SSH address: xxx.xxx.xxx.xxx:22
272
- vmvgr01: SSH username: root
273
- vmvgr01: SSH auth method: password
274
- vmvgr01:
275
- vmvgr01: Inserting generated public key within guest...
276
- vmvgr01: Removing insecure key from the guest if it's present...
277
- vmvgr01: Key inserted! Disconnecting and reconnecting using new SSH key...
278
- ==> vmvgr01: Machine booted and ready!
279
- ==> vmvgr01: Rsyncing folder: /hostshare2/ => /guestshare_norm
280
- ```
281
-
282
-
283
- #### View VM from web
284
-
285
- Go to Aruba Cloud dashboard to view machine instances.
286
- Dashboard url is different depending on the selected endpoint:
287
-
288
- |[DC1](https://admin.dc1.computing.cloud.it/Login.aspx) |[DC2](https://admin.dc2.computing.cloud.it/Login.aspx) |[DC3](https://admin.dc3.computing.cloud.it/Login.aspx) |[DC4](https://admin.dc4.computing.cloud.it/Login.aspx) |[DC5](https://admin.dc5.computing.cloud.it/Login.aspx) |[DC6](https://admin.dc6.computing.cloud.it/Login.aspx) |[DC8](https://admin.dc8.computing.cloud.it/Login.aspx) |
289
- | --- | --- | --- | --- | --- | --- | --- |
290
-
291
-
292
- ![cloud1](cloud1.png)
293
-
294
-
295
- #### Reload VM
296
-
297
-
298
- For the above configuration this command :
299
-
300
- vagrant reload
301
-
302
-
303
-
304
- has the following output:
305
- ```
306
- ==> vmvgr01: [dc2] The server will be powered off.
307
- ==> vmvgr01: [dc2] Wait until server is powered off.
308
- ==> vmvgr01: [dc2] The server is now powered off.
309
- ==> vmvgr01: [dc2] The server will be powered on.
310
- ==> vmvgr01: [dc2] Wait until server is powered on.
311
- ==> vmvgr01: [dc2] The server is now powered on.
312
- ==> vmvgr01: Waiting for machine to boot. This may take a few minutes...
313
- vmvgr01: SSH address: xxx.xxx.xxx.xxx:22
314
- vmvgr01: SSH username: root
315
- vmvgr01: SSH auth method: password
316
- ==> vmvgr01: Machine booted and ready!
317
- ==> vmvgr01: Rsyncing folder: /hostshare2/ => /guestshare_norm
318
- ```
319
-
320
-
321
- #### Provision in VM
322
-
323
-
324
- For the above configuration this command :
325
-
326
-
327
- vagrant provision
328
-
329
-
330
- has the following output:
331
- ```
332
- ==> vmvgr01: Rsyncing folder: /hostshare2/ => /guestshare_norm
333
- ==> vmvgr01: Running provisioner: shell...
334
- vmvgr01: Running: inline script
335
- vmvgr01: test start script ok
336
- ```
337
-
338
-
339
- #### Destroy VM
340
-
341
-
342
- For the above configuration this command :
343
-
344
-
345
- vagrant destroy
346
-
347
-
348
- has the following output:
349
- ```
350
- vmvgr01: Are you sure you want to destroy the 'vmvgr01' VM? [y/N] y
351
- ==> vmvgr01: [dc2] The server will be powered off.
352
- ==> vmvgr01: [dc2] Wait until server is powered off.
353
- ==> vmvgr01: [dc2] The server is now powered off.
354
- ==> vmvgr01: [dc2] The server will be deleted.
355
-
356
- ```
357
-
358
-
359
-
360
- #### Snapshot VM
361
-
362
-
363
-
364
- ###### Create
365
-
366
-
367
- For the above configuration this command :
368
-
369
-
370
- vagrant snapshot -t create -n lnxtestvag1
371
-
372
-
373
- has the following output:
374
- ```
375
- ==> vmvgr01: [dc2] Connecting to DataCenter.
376
- ==> vmvgr01: [dc2] Connected.
377
- ==> vmvgr01: [dc2] Snapshot request is 'create' target id:48267
378
- ==> vmvgr01: [dc2] Snapshot created.
379
- ```
380
-
381
-
382
-
383
- ###### List
384
-
385
-
386
- For the above configuration this command :
387
-
388
-
389
- vagrant snapshot -t list -n lnxtestvag1
390
-
391
-
392
- has the following output:
393
- ```
394
- ==> vmvgr01: [dc2] Connecting to DataCenter.
395
- ==> vmvgr01: [dc2] Connected.
396
- ==> vmvgr01: [dc2] Snapshot request is 'list' target id:48267
397
- ==> vmvgr01: [dc2] snapshot create: 2018-02-23 11:29:11 expire: 2018-02-25 11:00:00
398
- ```
399
-
400
- Note: *after '....snapshot restore .... the output is:*
401
-
402
- ```
403
- ==> vmvgr01: [dc2] Connecting to DataCenter.
404
- ==> vmvgr01: [dc2] Connected.
405
- ==> vmvgr01: [dc2] Snapshot request is 'list' target id:48267
406
- ==> vmvgr01: [dc2] no snapshot found.
407
- ```
408
-
409
-
410
-
411
-
412
-
413
- ###### Restore
414
-
415
-
416
- For the above configuration this command :
417
-
418
-
419
- vagrant snapshot -t restore -n lnxtestvag1
420
-
421
-
422
- has the following output:
423
- ```
424
- ==> vmvgr01: [dc2] Connecting to DataCenter.
425
- ==> vmvgr01: [dc2] Connected.
426
- ==> vmvgr01: [dc2] Snapshot request is 'restore' target id:48267
427
- ==> vmvgr01: [dc2] Snapshot restore is done; now VM can be 'reload' (after restore snapshot is removed).
428
- ```
429
-
430
-
431
-
432
- ###### Delete
433
-
434
-
435
- For the above configuration this command :
436
-
437
-
438
- vagrant snapshot -t delete -n lnxtestvag1
439
-
440
-
441
- has the following output:
442
- ```
443
- ==> vmvgr01: [dc2] Connecting to DataCenter.
444
- ==> vmvgr01: [dc2] Connected.
445
- ==> vmvgr01: [dc2] Snapshot request is 'delete' target id:48267
446
- ==> vmvgr01: [dc2] Snapshot delete is done (effective delete can take a few seconds).
447
- ```
448
-
449
- Note: *if a previous operation 'create' it is not finished yet, the output is:*
450
- ```
451
- ==> vmvgr01: [dc2] Connecting to DataCenter.
452
- ==> vmvgr01: [dc2] Connected.
453
- ==> vmvgr01: [dc2] Snapshot request is 'delete' target id:48267
454
- ==> vmvgr01: [dc2] *ERROR* response message: ---
455
- ==> vmvgr01: ExceptionInfo:
456
- ==> vmvgr01: ResultCode: 17
457
- ==> vmvgr01: ResultMessage: "Operation already enqueued for ServerId = 48267....."
458
- ==> vmvgr01: Success: false
459
-
460
- ```
461
-
462
-
463
- #### View VM running in my Arubacloud
464
-
465
-
466
- For the configuration multi-machine ( as in supplied example ) this command :
467
-
468
-
469
- vagrant arubacloud servers
470
-
471
-
472
- has the following output:
473
- (the Id can be different )
474
-
475
-
476
- ```
477
- : DC Server Name Id State Code State meaning IPv4 address
478
- : --------------------------------------------------------------------------------
479
- ==> vmvgr01: dc2 lnxtestvaga 48839 3 Running xxx.xxx.xxx.xxx
480
- ==> vmvgr02: dc2 lnxtestvagb 48837 3 Running xxx.xxx.xxx.xxx
481
- ==> vmvgr03: dc2 lnxtestvagc 48838 3 Running xxx.xxx.xxx.xxx
482
- ==> vmvgr04: dc2 lnxtestvagd 48836 3 Running xxx.xxx.xxx.xxx
483
- ==> vmvgr05: dc2 lnxtestvage 48835 3 Running xxx.xxx.xxx.xxx
484
- - : dc2 vm-esterna1 45840 3 Running xxx.xxx.xxx.xxx
485
- - : dc2 lnxtestvag2 48523 3 Running xxx.xxx.xxx.xxx
486
- ```
487
-
488
- *Note: In this case they are highlighted rows with the servers defined in a multi-machine architecture (VM defined in current Vagrantfile) by entering the name of the node (left of row ); all others VM ( vm-external1 etc..) are displayed, with a light color and '-' ( VM not defined in my Vagrantfile);*
489
-
490
-
491
-
492
-
493
- ### Appendix
494
-
495
-
496
- #### Example Vagrantfile to list arubacloud servers-templates
497
-
498
- This is configuration example for Vagrantfile to extract all info relate servers in 'dcX' and templates can be used in this dc.
499
-
500
- ```ruby
501
- VAGRANTFILE_API_VERSION = '2'
502
- %w{AC_USERNAME AC_PASSWORD}.each do |var|
503
- abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
504
- end
505
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
506
- config.vm.box = "dummy"
507
- config.vm.define :vmvgr01 do |vmvgr01_config|
508
- vmvgr01_config.ssh.password = 'dummy'
509
- vmvgr01_config.vm.provider :arubacloud do |ac|
510
- ac.arubacloud_username = ENV['AC_USERNAME']
511
- ac.arubacloud_password = ENV['AC_PASSWORD']
512
- ac.service_type = 4
513
- ac.endpoint = "dc2"
514
- ac.template_id = 'dummy'
515
- ac.package_id = 'dummy'
516
- end
517
- end
518
- end
519
- ```
520
-
521
- #### Example Vagrantfile type smart basic
522
-
523
- This is configuration example for Vagrantfile very basic to start a simple VM in 'dc2'
524
-
525
-
526
- ```ruby
527
- VAGRANTFILE_API_VERSION = '2'
528
- %w{AC_USERNAME AC_PASSWORD}.each do |var|
529
- abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
530
- end
531
-
532
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
533
- config.vm.box = "dummy"
534
- config.vm.define :vmvgr01 do |vmvgr01_config|
535
- vmvgr01_config.ssh.username = 'root'
536
- vmvgr01_config.ssh.password = 'test123'
537
- vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
538
- vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
539
- ac_override.nfs.functional = false # no nfs start
540
- ac.arubacloud_username = ENV['AC_USERNAME']
541
- ac.arubacloud_password = ENV['AC_PASSWORD']
542
- ac.service_type = 4
543
- ac.endpoint = "dc2"
544
- ac.template_id = '601'
545
- ac.server_name = 'lnxtestvag1'
546
- ac.package_id = 'small'
547
- end
548
- end
549
- end
550
- ```
551
-
552
- #### Example Vagrantfile type smart with syncing and provision example
553
-
554
- This is configuration example for Vagrantfile for bypass synced folder of current directory in /vagrant directory of VM , sync a user directory ( /hostshared2 , must be defined ) in VM directory /guestshare_norm ( created if not found);
555
- Has a very simple script can be executed with provision command;
556
-
557
-
558
- ```ruby
559
- VAGRANTFILE_API_VERSION = '2'
560
- %w{AC_USERNAME AC_PASSWORD}.each do |var|
561
- abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
562
- end
563
-
564
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
565
- config.vm.box = "dummy"
566
- config.vm.define :vmvgr01 do |vmvgr01_config|
567
- vmvgr01_config.ssh.username = 'root'
568
- vmvgr01_config.ssh.password = 'test123'
569
- vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
570
- vmvgr01_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
571
- vmvgr01_config.vm.provision "shell" do |s|
572
- s.inline = "echo 'test start script ok'"
573
- end
574
- vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
575
- ac_override.nfs.functional = false # no nfs start
576
- ac.arubacloud_username = ENV['AC_USERNAME']
577
- ac.arubacloud_password = ENV['AC_PASSWORD']
578
- ac.service_type = 4
579
- ac.endpoint = "dc2"
580
- ac.template_id = '601'
581
- ac.server_name = 'lnxtestvag1'
582
- ac.package_id = 'small'
583
- end
584
- end
585
- end
586
- ```
587
- #### Example Vagrantfile type pro
588
-
589
- This is configuration example for Vagrantfile relate a Pro machine, configured as in previous example ,(bypass synced folder..... script with provision command);
590
- They have also been added: 2 CPU , 6 GB Ram, 2 Disk Device ( first 20 GB , second 30 GB)
591
-
592
- ```ruby
593
- VAGRANTFILE_API_VERSION = '2'
594
- %w{AC_USERNAME AC_PASSWORD}.each do |var|
595
- abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
596
- end
597
-
598
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
599
- config.vm.box = "dummy"
600
- config.vm.define :vmvgr01 do |vmvgr01_config|
601
- vmvgr01_config.ssh.username = 'root'
602
- vmvgr01_config.ssh.password = 'test123'
603
- vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
604
- vmvgr01_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
605
- vmvgr01_config.vm.provision "shell" do |s|
606
- s.inline = "echo 'test start script ok'"
607
- end
608
- vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
609
- ac_override.nfs.functional = false # no nfs start
610
- ac.arubacloud_username = ENV['AC_USERNAME']
611
- ac.arubacloud_password = ENV['AC_PASSWORD']
612
- #
613
- ac.service_type = 2
614
- ac.endpoint = "dc2"
615
- ac.cpu_number = 2
616
- ac.ram_qty = 6
617
- ac.hds = [{:type => 0, :size => 20}, {:type => 1, :size => 30}]
618
- #
619
- # CentOS 7.x 64bit with pro VmWare
620
- ac.template_id = '691'
621
- ac.server_name = 'lnxprotstvag2'
622
- end
623
- end
624
- end
625
- ```
626
-
627
-
628
-
629
-
630
-
631
- #### Example multi machine
632
-
633
-
634
- ###### Commands
635
-
636
- In the case of multi-machine configurations, in some cases it is necessary to indicate which VM you want to send the command and then the syntax is slightly different;
637
- Example :
638
-
639
- | Command | Description |
640
- | ---| --- |
641
- | *vagrant destroy vmvgrxx* | vmvgrxx : VM to be destroyed |
642
- | *vagrant halt vmvgrxx* | vmvgrxx : VM to be power off |
643
- | *vagrant snapshot -t list -n servername* | check if exist snapshot for 'servename' |
644
- | *vagrant ssh vmvgrxx* | vmvgrxx : VM start 'ssh' session |
645
- | *vagrant reload vmvgrxx* | vmvgrxx : VM to be stopped (if running) and started |
646
- | *vagrant provision vmvgrxx* | vmvgrxx : VM where is started the provision (& sync) |
647
- | *vagrant provision* | provision (& sync) is started in all VM |
648
-
649
- *In any case, it is advisable to consult the official vagrant documentation*
650
- ___________
651
-
652
-
653
- ###### Vagrantfile
654
-
655
- This is configuration example for Vagrantfile relate multi machine with five VM, each with different provision and a common folder for resyncing;
656
- It is advisable to define the names of the nodes ("vmvgrxx") all of the same length;
657
-
658
-
659
- ```ruby
660
- VAGRANTFILE_API_VERSION = '2'
661
- %w{AC_USERNAME AC_PASSWORD}.each do |var|
662
- abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
663
- end
664
-
665
- Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
666
- config.vm.box = "dummy"
667
- config.vm.define :vmvgr01 do |vmvgr01_config|
668
- vmvgr01_config.ssh.username = 'root'
669
- vmvgr01_config.ssh.password = 'test123'
670
- vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
671
- vmvgr01_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
672
- vmvgr01_config.vm.provision "shell" do |s|
673
- s.inline = "echo 'test start script ok'"
674
- end
675
- vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
676
- ac_override.nfs.functional = false # no nfs start
677
- ac.arubacloud_username = ENV['AC_USERNAME']
678
- ac.arubacloud_password = ENV['AC_PASSWORD']
679
- ac.service_type = 4
680
- ac.endpoint = "dc2"
681
- ac.template_id = '601'
682
- ac.server_name = 'lnxtestvaga'
683
- ac.package_id = 'small'
684
- end
685
- end
686
- #
687
- config.vm.define :vmvgr02 do |vmvgr02_config|
688
- vmvgr02_config.ssh.username = 'root'
689
- vmvgr02_config.ssh.password = 'test123'
690
- vmvgr02_config.vm.synced_folder ".", "/vagrant", disabled: true
691
- vmvgr02_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
692
- vmvgr02_config.vm.provision "shell" do |s|
693
- s.inline = "echo 'test2 start script ok'"
694
- end
695
- vmvgr02_config.vm.provider :arubacloud do |ac, ac_override|
696
- ac_override.nfs.functional = false # no nfs start
697
- ac.arubacloud_username = ENV['AC_USERNAME']
698
- ac.arubacloud_password = ENV['AC_PASSWORD']
699
- ac.service_type = 4
700
- ac.endpoint = "dc2"
701
- ac.template_id = '601'
702
- ac.server_name = 'lnxtestvagb'
703
- ac.package_id = 'small'
704
- end
705
- end
706
- #
707
- config.vm.define :vmvgr03 do |vmvgr03_config|
708
- vmvgr03_config.ssh.username = 'root'
709
- vmvgr03_config.ssh.password = 'test123'
710
- vmvgr03_config.vm.synced_folder ".", "/vagrant", disabled: true
711
- vmvgr03_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
712
- vmvgr03_config.vm.provision "shell" do |s|
713
- s.inline = "echo 'test machine 3 start script ok'"
714
- end
715
- vmvgr03_config.vm.provider :arubacloud do |ac, ac_override|
716
- ac_override.nfs.functional = false # no nfs start
717
- ac.arubacloud_username = ENV['AC_USERNAME']
718
- ac.arubacloud_password = ENV['AC_PASSWORD']
719
- ac.service_type = 4
720
- ac.endpoint = "dc2"
721
- ac.template_id = '601'
722
- ac.server_name = 'lnxtestvagc'
723
- ac.package_id = 'small'
724
- end
725
- end
726
- #
727
- config.vm.define :vmvgr04 do |vmvgr04_config|
728
- vmvgr04_config.ssh.username = 'root'
729
- vmvgr04_config.ssh.password = 'test123'
730
- vmvgr04_config.vm.synced_folder ".", "/vagrant", disabled: true
731
- vmvgr04_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
732
- vmvgr04_config.vm.provision "shell" do |s|
733
- s.inline = "echo 'test machine 04 start script ok'"
734
- end
735
- vmvgr04_config.vm.provider :arubacloud do |ac, ac_override|
736
- ac_override.nfs.functional = false # no nfs start
737
- ac.arubacloud_username = ENV['AC_USERNAME']
738
- ac.arubacloud_password = ENV['AC_PASSWORD']
739
- ac.service_type = 4
740
- ac.endpoint = "dc2"
741
- ac.template_id = '601'
742
- ac.server_name = 'lnxtestvagd'
743
- ac.package_id = 'medium'
744
- end
745
- end
746
- #
747
- config.vm.define :vmvgr05 do |vmvgr05_config|
748
- vmvgr05_config.ssh.username = 'root'
749
- vmvgr05_config.ssh.password = 'test123'
750
- vmvgr05_config.vm.synced_folder ".", "/vagrant", disabled: true
751
- vmvgr05_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
752
- vmvgr05_config.vm.provision "shell" do |s|
753
- s.inline = "echo 'test machine 5 start script ok'"
754
- end
755
- vmvgr05_config.vm.provider :arubacloud do |ac, ac_override|
756
- ac_override.nfs.functional = false # no nfs start
757
- ac.arubacloud_username = ENV['AC_USERNAME']
758
- ac.arubacloud_password = ENV['AC_PASSWORD']
759
- ac.service_type = 4
760
- ac.endpoint = "dc2"
761
- ac.template_id = '601'
762
- ac.server_name = 'lnxtestvage'
763
- ac.package_id = 'small'
764
- end
765
- end
766
-
767
- end
768
- ```
769
-
770
-
771
-
772
-
773
-
774
- #### Vagrant option supported and not
775
-
776
- The following table shows the vagrant options supported and not from this plugin
777
-
778
- | option | support ? | description |
779
- | --- | --- | --- |
780
- | *arubacloud* | `OK`| used for subcommand servers / templates |
781
- | *box* | `OK` | manages boxes: installation, removal, etc |
782
- | *cap* | not tested | checks and executes capability |
783
- | *connect* | not tested | connect to a remotely shared Vagrant environment |
784
- | *cucumber* | not tested | |
785
- | *destroy* | `OK`| tops and deletes all traces of the vagrant machine |
786
- | *docker-exec* | not tested | attach to an already-running docker container |
787
- | *docker-logs* | not tested | outputs the logs from the Docker container |
788
- | *docker-run* | not tested | run a one-off command in the context of a container |
789
- | *global-status* | `OK`| outputs status Vagrant environments for this user |
790
- | *halt* | `OK*` | stops the vagrant machin: is ok for 'smart' not for 'pro' |
791
- | *help* | `OK`| shows the help for a subcommand |
792
- | *init* | `OK`| initializes a new Vagrant environment by creating a Vagrantfile |
793
- | *login* |not tested | log in to HashiCorp's Vagrant Cloud |
794
- | *mutate* | no supported | |
795
- | *package* | no supported | packages a running vagrant environment into a box |
796
- | *plugin* | `OK`| manages plugins: install, uninstall, update, etc. |
797
- | *port* | not tested | displays information about guest port mappings |
798
- | *powershell* | not tested | connects to machine via powershell remoting |
799
- | *provider* | `OK` | show provider for this environment |
800
- | *provision* | `OK`| provisions the vagrant machine |
801
- | *push* | not tested | deploys code in this environment to a configured destination |
802
- | *rdp* | not tested | connects to machine via RDP |
803
- | *reload* | `OK*`| is a power-off ( software shutdown) + power-on |
804
- | *share* | not tested | share your Vagrant environment with anyone in the world |
805
- | *snapshot* | `OK*` | make snapshots: create,delete,restore,list (--help for view syntax)|
806
- | *ssh* | `OK`| connects to machine via SSH |
807
- | *ssh-config* | `OK`| outputs OpenSSH valid configuration to connect to the machine |
808
- | *status* | `OK`| outputs status of the vagrant machine |
809
- | *suspend* | not supported | suspends the machine |
810
- | *resume* | not supported | resume a suspended vagrant machine |
811
- | *rsync* | `OK` | syncs rsync synced folders to remote machine |
812
- | *rsync-auto* | `OK` | syncs rsync synced folders automatically when files change |
813
- | *suspend* | not supported | suspends the machine |
814
- | *up* | `OK`| starts and provisions the vagrant environment |
815
- | *validate* | `OK`| validates the Vagrantfile |
816
- | *vbguest* | not tested | install VirtualBox Guest Additions to the machine |
817
- | *version* | `OK`| prints current and latest Vagrant version |
818
-
819
-
820
- Note:
821
- 1. to obtain full list vagrant options enter: *vagrant list-commands*
822
- 2. `OK*` : operation and syntax is slightly different from Vagrant specifications
823
-
824
-
825
-
826
-
827
-
828
- #### Error messages
829
-
830
-
831
-
832
- _________
833
- * if after 'vagrant up .... ' is returned this output :
834
-
835
- ```
836
- - Vagrant failed to initialize at a very early stage:
837
-
838
- The plugins failed to load properly. The error message given is
839
- shown below.
840
-
841
- Encoded files can't be read outside of the Vagrant installer.
842
- ```
843
-
844
- *a possible solution can be export VAGRANT_INSTALLER_EMBEDDED_DIR with the name of the folder from which the command is launched and where the vagrantfile is located.*
845
- example :
846
-
847
-
848
- export VAGRANT_INSTALLER_EMBEDDED_DIR=/home/user/vagrant_dir
849
-
850
-
851
- (if you start 'vagrant up' from directory : */home/user/vagrant_dir* )
852
-
853
-
854
- _________
855
- * when vagrant with any options return this output
856
-
857
-
858
- ```
859
- ... {:http_method=>:post, :method=>"GetServerDetails", :body=>"{\"ApplicationId\":\"GetServerDetails\",\"RequestId\":\"GetServerDetails\",\"Sessionid\":\"GetServerDetails\",\"Username\":\"...\",\"Password\":\"...\",\"ServerId\":\"..nnn..\"}"}**---starting ---------bundler: failed to load command: vagrant (/....../.gem/ruby/2.x.x/bin/vagrant)
860
- Fog::ArubaCloud::Errors::RequestError: Could not find Server Id ..nnn..
861
- ExceptionCode=15
862
- ExceptionCode=15
863
- ```
864
-
865
- *the VM may have been deleted outside of vagrant;
866
- A possible solution is rename the '.vagrant' directory as '.vagrant-old' (it's in the folder from which we start the vagrant commands) and run the command to create the VM again.
867
- (warning : if there are multiple VM defined in '.vagrant' directory , you should consult the official documentation of Vagrant)*
868
-
869
-
870
- _______
871
- * when vagrant with any options (for example 'reload' 'halt' ...etc) return this output
872
-
873
- ```
874
- ==> vmvgr01: [dc2] The server will be powered off.
875
- ==> vmvgr01: The operation you are calling on the server, is already present in queue.
876
- ..........
877
- ```
878
-
879
- *In this case the interface is still in a 'busy' state; try again after a few tens of seconds or a minute the command;*
880
-
881
-
882
-
883
- _________
884
- * if after 'vagrant arubacloud servers' is returned this output :
885
-
886
- ```
887
- : DC Server Name Id State Code State meaning IPv4 address
888
- : --------------------------------------------------------------------------------
889
- -------: dc2 server1 45840 3 Running xxx.xxx.xxx.xxx
890
- -------: dc2 lnxtestvag2 48523 3 Running yyy.yyy.yyy.yyy
891
-
892
- bundler: failed to load command: vagrant (/..../bin/vagrant)
893
- Fog::ArubaCloud::Errors::RequestError: Could not find Server Id .....
894
- ```
895
-
896
-
897
- *In case the destroy is done, since this operation is not immediate, if the server list is requested, it can happen that the operation takes place when the server details are requested;
898
- in this case the detail can no longer be found and the command returns this message;
899
- try again after a few seconds the command;*
900
-
901
-
902
-
903
-
904
-
905
-
906
- ________
907
- Notes:
908
- ________
909
-
910
-
911
- Note that normally a lot of this boilerplate is encoded within the box file, but the box file used for the quick start, the "dummy" box, has no preconfigured defaults.
912
-
913
- If you have issues with SSH connecting, make sure that the instances are being launched with a security group that allows SSH access.
914
-
915
-
916
-
917
-
918
-
919
-
920
-
921
-
922
- #### Development
923
-
924
- To work on the `vagrant-arubacloud` plugin, clone this repository out, and use
925
- [Bundler](http://gembundler.com) to get the dependencies:
926
-
927
- ```
928
- $ bundle
929
- ```
930
-
931
- Once you have the dependencies, verify the unit tests pass with `rake`:
932
-
933
- ```
934
- $ bundle exec rake
935
- ```
936
-
937
- If those pass, you're ready to start developing the plugin. You can test
938
- the plugin without installing it into your Vagrant environment by just
939
- creating a `Vagrantfile` in the top level of this directory (it is gitignored)
940
- and add the following line to your `Vagrantfile`
941
- ```ruby
942
- Vagrant.require_plugin "vagrant-arubacloud"
943
- ```
944
- Use bundler to execute Vagrant:
945
- ```
946
- $ bundle exec vagrant up --provider=arubacloud
947
- ```
948
-
949
-
950
- #### License
951
-
952
- This code is released under the MIT License.
953
-
954
- Copyright (c) 2018 Aruba Cloud
1
+ # Vagrant ArubaCloud Provider
2
+
3
+
4
+
5
+ ## Table of Contents
6
+
7
+ * [Overview](#overview)
8
+ * [Features](#features)
9
+ * [Installation](#installation)
10
+ * [Available commands and parameters](#available-commands-and-parameters)
11
+ * [Obsolete options](#obsolete-options)
12
+ * [Quick start](#quickstart)
13
+ * [Example Usage](#example-usage)
14
+ * [List Templates available](#list-templates-available)
15
+ * [Create and Start VM](#create-and-start-vm)
16
+ * [View VM from web](#view-vm-from-web)
17
+ * [Reload VM](#reload-vm)
18
+ * [Provision in VM](#provision-in-vm)
19
+ * [Destroy VM](#destroy-vm)
20
+ * [Snapshot VM](#snapshot-vm)
21
+ * [Create](#create)
22
+ * [List](#list)
23
+ * [Restore](#restore)
24
+ * [Delete](#delete)
25
+ * [View VM running in my Arubacloud](#view-vm-running-in-my-arubacloud)
26
+ * [Appendix](#appendix)
27
+ * [Example Vagrantfile to list arubacloud servers templates](#example-vagrantfile-to-list-arubacloud-servers-templates)
28
+ * [Example Vagrantfile type smart basic](#example-vagrantfile-type-smart-basic)
29
+ * [Example Vagrantfile type smart with syncing and provision example](#example-vagrantfile-type-smart-with-syncing-and-provision-example)
30
+ * [Example Vagrantfile type pro](#example-vagrantfile-type-pro)
31
+ * [Example multi machine](#example-multi-machine)
32
+ * [Commands](#commands)
33
+ * [Vagrantfile](#vagrantfile)
34
+ * [Vagrant option supported and not](#vagrant-option-supported-and-not)
35
+ * [Error messages](#error-messages)
36
+ * [Development](#development)
37
+ * [License](#license)
38
+
39
+
40
+ ## Overview
41
+
42
+
43
+ This is a [Vagrant](http://www.vagrantup.com) plugin that adds ArubaCloud provider
44
+ to Vagrant, allowing Vagrant to control and provision machine in ArubaCloud IaaS Service.
45
+
46
+ ## Features
47
+ * Boot ArubaCloud instances.
48
+ * SSH into instances.
49
+ * Provision the instances with any built-in Vagrant provisioner.
50
+ * Specify which datacenter you want to use with a simple prefix.
51
+ * Configure multi machine architecture (an example of configuration is provided)
52
+
53
+
54
+ ## Installation
55
+ Install using standard `vagrant plugin install` method, since the gem is published in
56
+ [central RubyGemsrepository](https://rubygems.org/gems/vagrant-arubacloud)
57
+
58
+ ```
59
+ $ vagrant plugin install vagrant-arubacloud
60
+ ```
61
+
62
+
63
+
64
+ ## Available commands and parameters
65
+
66
+
67
+ - the command **vagrant arubacloud servers** show for each server found :
68
+ * DC (DataCenter), the 'id' of the server, the description of the status(run, stop ... etc).
69
+ * the name of the node is highlighted to see if it has been defined in Vagrantfile.
70
+
71
+ - the command **vagrant reload** execute a simple
72
+ *power off* ( it's a 'shutdown' and not 'power-off' forced)
73
+ *power on*
74
+
75
+ - the command **vagrant snapshot** execute a snapshot of server:
76
+
77
+
78
+ | Type| Command | description | status server |
79
+ | --- | --- | --- | --- |
80
+ | `create` | *vagrant snapshot -t create -n 'server_name'* | create a snapshot of vm | running |
81
+ | `delete` | *vagrant snapshot -t delete -n 'server_name'* | delete snapshot of vm | any |
82
+ | `restore` | *vagrant snapshot -t restore -n 'server_name'* | restore vm from snapshot | power off |
83
+ | `list` | *vagrant snapshot -t list -n 'server_name'* | list info relate snapshot of vm | any |
84
+
85
+ *Note*
86
+ 1. *if the 'snapshot ... restore ... ' is executed, once the command is finished, after a few seconds the snapshot is automatically deleted*
87
+
88
+
89
+ - parameter **package_id** (in *:arubacloud* section ) is changed.
90
+ Valid values now are :'small', 'medium', 'large', 'extra large'
91
+
92
+
93
+ | package_id |CPU | Ram (GB) | Disk Size (GB) |
94
+ | --------------------------------|--------------------| ------------------------------ | -------- |
95
+ | `small` |1 | 1 | 20 |
96
+ | `medium` |1 | 2 | 40 |
97
+ | `large` |2 | 4 | 80 |
98
+ | `extra large` |4 | 8 | 160 |
99
+
100
+
101
+
102
+ - parameter **endpoint** (in *:arubacloud* section ) define what is the DataCenter Aruba can be used for the defined VM in Vagrantfile;
103
+ valid value are: dc1, dc2, dc3, dc4, dc5, dc6, dc8
104
+ (default: dc2 )
105
+
106
+
107
+ | Parameter | Data Center Location |
108
+ |-----------|------------------------------------------------------|
109
+ | `dc1` | Italy 1 |
110
+ | `dc2` | Italy 2 |
111
+ | `dc3` | Czech republic |
112
+ | `dc4` | France |
113
+ | `dc5` | Deutschland |
114
+ | `dc6` | United Kingdom |
115
+ | `dc8` | Poland |
116
+
117
+
118
+ - the parameter **nodename.url** (in *:arubacloud* section ) , if used can override the 'endpoint' value.
119
+ This parameter should only be used in case of new 'dc*'not yet included in this plugin.
120
+
121
+
122
+ - parameter **service_type** (in *:arubacloud* section ) is the 'code' (is a numeric value) of hypervisor used (in Arubacloud )
123
+ Valid values are:
124
+
125
+ | code | hypervisor | service type |
126
+ | --- | --- | --- |
127
+ | `1` | Microsoft Hyper-V | Cloud pro |
128
+ | `2` | VMWare | Cloud pro |
129
+ | `3` | Microsoft Hyper-V Low Cost | Cloud pro |
130
+ | `4` | VMWare | Cloud smart |
131
+
132
+ - parameter **server_name** (in *:arubacloud* section ) is the name of server ( name listed in arubacloud web interface)
133
+ - parameter **arubacloud_username** (in *:arubacloud* section ) is user account to access arubacloud
134
+ - parameter **arubacloud_password** (in *:arubacloud* section ) is password of account to access arubacloud
135
+ - parameter **url** (in *:arubacloud* section ) is url of the web service to use ( *DEPRECATED*)
136
+ - parameter **template_id** (in *:arubacloud* section ) is ID of the template to use ( read the next notes to determine the correct value)
137
+ - parameter **cpu_number** (in *:arubacloud* section ) is number of virtual CPU to be assigned to the VM only for service type **not smart**
138
+
139
+ | descr | n (number) of CPU) |
140
+ | --- | --- |
141
+ | Pro VMWare | 1 < `n` < 8 |
142
+ | Pro Hyper-V | 1 < `n` < 4 |
143
+
144
+ - parameter **ram_qty** (in *:arubacloud* section ) is amount of GB of RAM to be assigned to the VM (n <= 16) only for service type **not smart**
145
+ - parameter **hds** (in *:arubacloud* section ) is an array containing hard disk Configuration only for service type **not smart**:
146
+
147
+ *Example configuration (size is expressed in GB):*
148
+ *hds* = [{:type => 0, :size => 100}, {:type => 1, :size => 200}]
149
+
150
+ *Note*
151
+ 1. *Hd type 0 is required because specify the first hard disk, max size per hd: 500 GB)*
152
+ 2. *Hd type > 0 < 4 are 3 additional hard disks (optional)*
153
+
154
+
155
+
156
+ Now the very important's messages has the name of DataCenter where the VM running : [dc?] in row displayed ( 'up', 'reload' , 'halt', 'arubacloud servers/templates', 'destroy', 'snapshot')
157
+
158
+ Together with the package are provided some 'Vagrantfile_...', as an example of basic configuration , minimum configuration for consulting existing servers/templates in Arubacloud, configuration with syncing_folder and a simple shell for provisioning, multi-machine configuration with multiple VM .
159
+
160
+
161
+
162
+ ___________
163
+ ## Obsolete options
164
+ (in config *:arubacloud* section)
165
+ __________
166
+
167
+
168
+ - option **admin_password** has been removed and replaced by the directive :
169
+ 'nodename'.ssh.password
170
+
171
+ _______________________________________
172
+
173
+
174
+
175
+ ## Quickstart
176
+ After installing the plugin (instructions above), the quickest way to get
177
+ started is to actually use a dummy ArubaCloud box and specify all the details
178
+ manually within a `config.vm.provider` block. So first, add the dummy
179
+ box using any name you want:
180
+
181
+ ```
182
+ $ vagrant box add dummy https://github.com/arubacloud/vagrant-arubacloud/raw/master/dummy.box
183
+ ...
184
+ ```
185
+
186
+ And then make a Vagrantfile that looks like the following, filling in
187
+ your information where necessary. For now, username and password must be specified as environment variables:
188
+ ```
189
+ export AC_USERNAME=""
190
+ export AC_PASSWORD=""
191
+ ```
192
+
193
+ For now, the root password must be specified in this way.
194
+
195
+
196
+
197
+
198
+ ### Example Usage
199
+
200
+
201
+ >
202
+ > define a smart VM with these characteristics
203
+ > use DataCenter Aruba 'dc2' , service type 'smart', package_id 'small' ( 1 cpu, 1 GB Ram) with 'Ubuntu Server 14.04 LTS 64bit '
204
+
205
+
206
+
207
+
208
+ #### List Templates available
209
+
210
+ First action is determine what is *template_id* available for 'dc2';
211
+ To do this , you must prepare a minimal configuration of Vagrantfile and run a command for list the templates can be used.
212
+ You can found an example in current directory ('Vagrantfile_only_arubacloud_tmpl_srv') or in Appendix of this document:
213
+ [Example Vagrantfile to list arubacloud servers templates](#example-vagrantfile-to-list-arubacloud-servers-templates)
214
+
215
+ _______
216
+ **WARNING** : *this configuration MUST BE changed for all others use of vagrant (up, destroy, halt , reload.... etc) because is missing ....ssh.username, 'dummy' is not valid for package_id, template_id, .....ssh.password*
217
+ ________
218
+
219
+ Now check environment variables *AC_USERNAME*, *AC_PASSWORD* if set with correct value and enter the command from console:
220
+
221
+
222
+ vagrant arubacloud templates
223
+
224
+
225
+ This command validate the Vagrantfile , create if not exist a directory '.vagrant' in current directory and return a list of all templates available in 'dc2';
226
+ After obtain the list , change the *template_id* , in Vagrantfile, from 'dummy' to value in ID column for row selected;
227
+ (in this case and current date the *template_id* is 601)
228
+
229
+
230
+ #### Create and Start VM
231
+
232
+ then... :
233
+ - choose and set value of *package_id*
234
+ - change *vmvgr01_config.ssh.password* value
235
+ - insert *vmvgr01_config.ssh.username* = 'root'
236
+ - check if bypass the synced_folder for '.' into /Vagrant of the guest ( VM )
237
+ - ....and check for other options if needed;
238
+
239
+
240
+ You can found an example in current directory ('Vagrantfile_syncing_and_sample_provision') or in Appendix of this document:
241
+ [Example Vagrantfile type smart with syncing and provision example](#example-vagrantfile-type-smart-with-syncing-and-provision-example)
242
+ This configuration define a synced_folder bypass for '.' and add synced_folder for directory:
243
+
244
+
245
+ /hostshare2 (Host) to --> /guestshare_norm ( VM )
246
+
247
+
248
+ Save the file and enter the command:
249
+
250
+
251
+ vagrant up --provider=arubacloud
252
+
253
+
254
+ This command re-validate the Vagrantfile , create the VM as Ubuntu 14.04 instance in the second Italian Datacenter (DC2-IT) within your account and assuming your SSH information was filled in properly within your Vagrantfile; SSH and provisioning will work as well.
255
+
256
+ The output is :
257
+
258
+
259
+ ```
260
+ Bringing machine 'vmvgr01' up with 'arubacloud' provider...
261
+ ==> vmvgr01: Creating a server with the following settings...
262
+ ==> vmvgr01: -- Datacenter: dc2
263
+ ==> vmvgr01: -- Name: lnxtestvag1
264
+ ==> vmvgr01: -- Root Password: test123
265
+ ==> vmvgr01: -- Package: small config as: CPU: 1, Ram(GB): 1, DiskSize(GB): 20
266
+ ==> vmvgr01: -- OS Template: 601
267
+ ==> vmvgr01: -- Service Type: 4 (smart)
268
+ ==> vmvgr01: [dc2] Waiting until server is ready...
269
+ ==> vmvgr01: [dc2] The server is ready!
270
+ ==> vmvgr01: Waiting for machine to boot. This may take a few minutes...
271
+ vmvgr01: SSH address: xxx.xxx.xxx.xxx:22
272
+ vmvgr01: SSH username: root
273
+ vmvgr01: SSH auth method: password
274
+ vmvgr01:
275
+ vmvgr01: Inserting generated public key within guest...
276
+ vmvgr01: Removing insecure key from the guest if it's present...
277
+ vmvgr01: Key inserted! Disconnecting and reconnecting using new SSH key...
278
+ ==> vmvgr01: Machine booted and ready!
279
+ ==> vmvgr01: Rsyncing folder: /hostshare2/ => /guestshare_norm
280
+ ```
281
+
282
+
283
+ #### View VM from web
284
+
285
+ Go to Aruba Cloud dashboard to view machine instances.
286
+ Dashboard url is different depending on the selected endpoint:
287
+
288
+ |[DC1](https://admin.dc1.computing.cloud.it/Login.aspx) |[DC2](https://admin.dc2.computing.cloud.it/Login.aspx) |[DC3](https://admin.dc3.computing.cloud.it/Login.aspx) |[DC4](https://admin.dc4.computing.cloud.it/Login.aspx) |[DC5](https://admin.dc5.computing.cloud.it/Login.aspx) |[DC6](https://admin.dc6.computing.cloud.it/Login.aspx) |[DC8](https://admin.dc8.computing.cloud.it/Login.aspx) |
289
+ | --- | --- | --- | --- | --- | --- | --- |
290
+
291
+
292
+ ![cloud1](cloud1.png)
293
+
294
+
295
+ #### Reload VM
296
+
297
+
298
+ For the above configuration this command :
299
+
300
+ vagrant reload
301
+
302
+
303
+
304
+ has the following output:
305
+ ```
306
+ ==> vmvgr01: [dc2] The server will be powered off.
307
+ ==> vmvgr01: [dc2] Wait until server is powered off.
308
+ ==> vmvgr01: [dc2] The server is now powered off.
309
+ ==> vmvgr01: [dc2] The server will be powered on.
310
+ ==> vmvgr01: [dc2] Wait until server is powered on.
311
+ ==> vmvgr01: [dc2] The server is now powered on.
312
+ ==> vmvgr01: Waiting for machine to boot. This may take a few minutes...
313
+ vmvgr01: SSH address: xxx.xxx.xxx.xxx:22
314
+ vmvgr01: SSH username: root
315
+ vmvgr01: SSH auth method: password
316
+ ==> vmvgr01: Machine booted and ready!
317
+ ==> vmvgr01: Rsyncing folder: /hostshare2/ => /guestshare_norm
318
+ ```
319
+
320
+
321
+ #### Provision in VM
322
+
323
+
324
+ For the above configuration this command :
325
+
326
+
327
+ vagrant provision
328
+
329
+
330
+ has the following output:
331
+ ```
332
+ ==> vmvgr01: Rsyncing folder: /hostshare2/ => /guestshare_norm
333
+ ==> vmvgr01: Running provisioner: shell...
334
+ vmvgr01: Running: inline script
335
+ vmvgr01: test start script ok
336
+ ```
337
+
338
+
339
+ #### Destroy VM
340
+
341
+
342
+ For the above configuration this command :
343
+
344
+
345
+ vagrant destroy
346
+
347
+
348
+ has the following output:
349
+ ```
350
+ vmvgr01: Are you sure you want to destroy the 'vmvgr01' VM? [y/N] y
351
+ ==> vmvgr01: [dc2] The server will be powered off.
352
+ ==> vmvgr01: [dc2] Wait until server is powered off.
353
+ ==> vmvgr01: [dc2] The server is now powered off.
354
+ ==> vmvgr01: [dc2] The server will be deleted.
355
+
356
+ ```
357
+
358
+
359
+
360
+ #### Snapshot VM
361
+
362
+
363
+
364
+ ###### Create
365
+
366
+
367
+ For the above configuration this command :
368
+
369
+
370
+ vagrant snapshot -t create -n lnxtestvag1
371
+
372
+
373
+ has the following output:
374
+ ```
375
+ ==> vmvgr01: [dc2] Connecting to DataCenter.
376
+ ==> vmvgr01: [dc2] Connected.
377
+ ==> vmvgr01: [dc2] Snapshot request is 'create' target id:48267
378
+ ==> vmvgr01: [dc2] Snapshot created.
379
+ ```
380
+
381
+
382
+
383
+ ###### List
384
+
385
+
386
+ For the above configuration this command :
387
+
388
+
389
+ vagrant snapshot -t list -n lnxtestvag1
390
+
391
+
392
+ has the following output:
393
+ ```
394
+ ==> vmvgr01: [dc2] Connecting to DataCenter.
395
+ ==> vmvgr01: [dc2] Connected.
396
+ ==> vmvgr01: [dc2] Snapshot request is 'list' target id:48267
397
+ ==> vmvgr01: [dc2] snapshot create: 2018-02-23 11:29:11 expire: 2018-02-25 11:00:00
398
+ ```
399
+
400
+ Note: *after '....snapshot restore .... the output is:*
401
+
402
+ ```
403
+ ==> vmvgr01: [dc2] Connecting to DataCenter.
404
+ ==> vmvgr01: [dc2] Connected.
405
+ ==> vmvgr01: [dc2] Snapshot request is 'list' target id:48267
406
+ ==> vmvgr01: [dc2] no snapshot found.
407
+ ```
408
+
409
+
410
+
411
+
412
+
413
+ ###### Restore
414
+
415
+
416
+ For the above configuration this command :
417
+
418
+
419
+ vagrant snapshot -t restore -n lnxtestvag1
420
+
421
+
422
+ has the following output:
423
+ ```
424
+ ==> vmvgr01: [dc2] Connecting to DataCenter.
425
+ ==> vmvgr01: [dc2] Connected.
426
+ ==> vmvgr01: [dc2] Snapshot request is 'restore' target id:48267
427
+ ==> vmvgr01: [dc2] Snapshot restore is done; now VM can be 'reload' (after restore snapshot is removed).
428
+ ```
429
+
430
+
431
+
432
+ ###### Delete
433
+
434
+
435
+ For the above configuration this command :
436
+
437
+
438
+ vagrant snapshot -t delete -n lnxtestvag1
439
+
440
+
441
+ has the following output:
442
+ ```
443
+ ==> vmvgr01: [dc2] Connecting to DataCenter.
444
+ ==> vmvgr01: [dc2] Connected.
445
+ ==> vmvgr01: [dc2] Snapshot request is 'delete' target id:48267
446
+ ==> vmvgr01: [dc2] Snapshot delete is done (effective delete can take a few seconds).
447
+ ```
448
+
449
+ Note: *if a previous operation 'create' it is not finished yet, the output is:*
450
+ ```
451
+ ==> vmvgr01: [dc2] Connecting to DataCenter.
452
+ ==> vmvgr01: [dc2] Connected.
453
+ ==> vmvgr01: [dc2] Snapshot request is 'delete' target id:48267
454
+ ==> vmvgr01: [dc2] *ERROR* response message: ---
455
+ ==> vmvgr01: ExceptionInfo:
456
+ ==> vmvgr01: ResultCode: 17
457
+ ==> vmvgr01: ResultMessage: "Operation already enqueued for ServerId = 48267....."
458
+ ==> vmvgr01: Success: false
459
+
460
+ ```
461
+
462
+
463
+ #### View VM running in my Arubacloud
464
+
465
+
466
+ For the configuration multi-machine ( as in supplied example ) this command :
467
+
468
+
469
+ vagrant arubacloud servers
470
+
471
+
472
+ has the following output:
473
+ (the Id can be different )
474
+
475
+
476
+ ```
477
+ : DC Server Name Id State Code State meaning IPv4 address
478
+ : --------------------------------------------------------------------------------
479
+ ==> vmvgr01: dc2 lnxtestvaga 48839 3 Running xxx.xxx.xxx.xxx
480
+ ==> vmvgr02: dc2 lnxtestvagb 48837 3 Running xxx.xxx.xxx.xxx
481
+ ==> vmvgr03: dc2 lnxtestvagc 48838 3 Running xxx.xxx.xxx.xxx
482
+ ==> vmvgr04: dc2 lnxtestvagd 48836 3 Running xxx.xxx.xxx.xxx
483
+ ==> vmvgr05: dc2 lnxtestvage 48835 3 Running xxx.xxx.xxx.xxx
484
+ - : dc2 vm-esterna1 45840 3 Running xxx.xxx.xxx.xxx
485
+ - : dc2 lnxtestvag2 48523 3 Running xxx.xxx.xxx.xxx
486
+ ```
487
+
488
+ *Note: In this case they are highlighted rows with the servers defined in a multi-machine architecture (VM defined in current Vagrantfile) by entering the name of the node (left of row ); all others VM ( vm-external1 etc..) are displayed, with a light color and '-' ( VM not defined in my Vagrantfile);*
489
+
490
+
491
+
492
+
493
+ ### Appendix
494
+
495
+
496
+ #### Example Vagrantfile to list arubacloud servers-templates
497
+
498
+ This is configuration example for Vagrantfile to extract all info relate servers in 'dcX' and templates can be used in this dc.
499
+
500
+ ```ruby
501
+ VAGRANTFILE_API_VERSION = '2'
502
+ %w{AC_USERNAME AC_PASSWORD}.each do |var|
503
+ abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
504
+ end
505
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
506
+ config.vm.box = "dummy"
507
+ config.vm.define :vmvgr01 do |vmvgr01_config|
508
+ vmvgr01_config.ssh.password = 'dummy'
509
+ vmvgr01_config.vm.provider :arubacloud do |ac|
510
+ ac.arubacloud_username = ENV['AC_USERNAME']
511
+ ac.arubacloud_password = ENV['AC_PASSWORD']
512
+ ac.service_type = 4
513
+ ac.endpoint = "dc2"
514
+ ac.template_id = 'dummy'
515
+ ac.package_id = 'dummy'
516
+ end
517
+ end
518
+ end
519
+ ```
520
+
521
+ #### Example Vagrantfile type smart basic
522
+
523
+ This is configuration example for Vagrantfile very basic to start a simple VM in 'dc2'
524
+
525
+
526
+ ```ruby
527
+ VAGRANTFILE_API_VERSION = '2'
528
+ %w{AC_USERNAME AC_PASSWORD}.each do |var|
529
+ abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
530
+ end
531
+
532
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
533
+ config.vm.box = "dummy"
534
+ config.vm.define :vmvgr01 do |vmvgr01_config|
535
+ vmvgr01_config.ssh.username = 'root'
536
+ vmvgr01_config.ssh.password = 'test123'
537
+ vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
538
+ vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
539
+ ac_override.nfs.functional = false # no nfs start
540
+ ac.arubacloud_username = ENV['AC_USERNAME']
541
+ ac.arubacloud_password = ENV['AC_PASSWORD']
542
+ ac.service_type = 4
543
+ ac.endpoint = "dc2"
544
+ ac.template_id = '601'
545
+ ac.server_name = 'lnxtestvag1'
546
+ ac.package_id = 'small'
547
+ end
548
+ end
549
+ end
550
+ ```
551
+
552
+ #### Example Vagrantfile type smart with syncing and provision example
553
+
554
+ This is configuration example for Vagrantfile for bypass synced folder of current directory in /vagrant directory of VM , sync a user directory ( /hostshared2 , must be defined ) in VM directory /guestshare_norm ( created if not found);
555
+ Has a very simple script can be executed with provision command;
556
+
557
+
558
+ ```ruby
559
+ VAGRANTFILE_API_VERSION = '2'
560
+ %w{AC_USERNAME AC_PASSWORD}.each do |var|
561
+ abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
562
+ end
563
+
564
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
565
+ config.vm.box = "dummy"
566
+ config.vm.define :vmvgr01 do |vmvgr01_config|
567
+ vmvgr01_config.ssh.username = 'root'
568
+ vmvgr01_config.ssh.password = 'test123'
569
+ vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
570
+ vmvgr01_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
571
+ vmvgr01_config.vm.provision "shell" do |s|
572
+ s.inline = "echo 'test start script ok'"
573
+ end
574
+ vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
575
+ ac_override.nfs.functional = false # no nfs start
576
+ ac.arubacloud_username = ENV['AC_USERNAME']
577
+ ac.arubacloud_password = ENV['AC_PASSWORD']
578
+ ac.service_type = 4
579
+ ac.endpoint = "dc2"
580
+ ac.template_id = '601'
581
+ ac.server_name = 'lnxtestvag1'
582
+ ac.package_id = 'small'
583
+ end
584
+ end
585
+ end
586
+ ```
587
+ #### Example Vagrantfile type pro
588
+
589
+ This is configuration example for Vagrantfile relate a Pro machine, configured as in previous example ,(bypass synced folder..... script with provision command);
590
+ They have also been added: 2 CPU , 6 GB Ram, 2 Disk Device ( first 20 GB , second 30 GB)
591
+
592
+ ```ruby
593
+ VAGRANTFILE_API_VERSION = '2'
594
+ %w{AC_USERNAME AC_PASSWORD}.each do |var|
595
+ abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
596
+ end
597
+
598
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
599
+ config.vm.box = "dummy"
600
+ config.vm.define :vmvgr01 do |vmvgr01_config|
601
+ vmvgr01_config.ssh.username = 'root'
602
+ vmvgr01_config.ssh.password = 'test123'
603
+ vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
604
+ vmvgr01_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
605
+ vmvgr01_config.vm.provision "shell" do |s|
606
+ s.inline = "echo 'test start script ok'"
607
+ end
608
+ vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
609
+ ac_override.nfs.functional = false # no nfs start
610
+ ac.arubacloud_username = ENV['AC_USERNAME']
611
+ ac.arubacloud_password = ENV['AC_PASSWORD']
612
+ #
613
+ ac.service_type = 2
614
+ ac.endpoint = "dc2"
615
+ ac.cpu_number = 2
616
+ ac.ram_qty = 6
617
+ ac.hds = [{:type => 0, :size => 20}, {:type => 1, :size => 30}]
618
+ #
619
+ # CentOS 7.x 64bit with pro VmWare
620
+ ac.template_id = '691'
621
+ ac.server_name = 'lnxprotstvag2'
622
+ end
623
+ end
624
+ end
625
+ ```
626
+
627
+
628
+
629
+
630
+
631
+ #### Example multi machine
632
+
633
+
634
+ ###### Commands
635
+
636
+ In the case of multi-machine configurations, in some cases it is necessary to indicate which VM you want to send the command and then the syntax is slightly different;
637
+ Example :
638
+
639
+ | Command | Description |
640
+ | ---| --- |
641
+ | *vagrant destroy vmvgrxx* | vmvgrxx : VM to be destroyed |
642
+ | *vagrant halt vmvgrxx* | vmvgrxx : VM to be power off |
643
+ | *vagrant snapshot -t list -n servername* | check if exist snapshot for 'servename' |
644
+ | *vagrant ssh vmvgrxx* | vmvgrxx : VM start 'ssh' session |
645
+ | *vagrant reload vmvgrxx* | vmvgrxx : VM to be stopped (if running) and started |
646
+ | *vagrant provision vmvgrxx* | vmvgrxx : VM where is started the provision (& sync) |
647
+ | *vagrant provision* | provision (& sync) is started in all VM |
648
+
649
+ *In any case, it is advisable to consult the official vagrant documentation*
650
+ ___________
651
+
652
+
653
+ ###### Vagrantfile
654
+
655
+ This is configuration example for Vagrantfile relate multi machine with five VM, each with different provision and a common folder for resyncing;
656
+ It is advisable to define the names of the nodes ("vmvgrxx") all of the same length;
657
+
658
+
659
+ ```ruby
660
+ VAGRANTFILE_API_VERSION = '2'
661
+ %w{AC_USERNAME AC_PASSWORD}.each do |var|
662
+ abort "Please set the environment variable #{var} in order to run the test" unless ENV.key? var
663
+ end
664
+
665
+ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
666
+ config.vm.box = "dummy"
667
+ config.vm.define :vmvgr01 do |vmvgr01_config|
668
+ vmvgr01_config.ssh.username = 'root'
669
+ vmvgr01_config.ssh.password = 'test123'
670
+ vmvgr01_config.vm.synced_folder ".", "/vagrant", disabled: true
671
+ vmvgr01_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
672
+ vmvgr01_config.vm.provision "shell" do |s|
673
+ s.inline = "echo 'test start script ok'"
674
+ end
675
+ vmvgr01_config.vm.provider :arubacloud do |ac, ac_override|
676
+ ac_override.nfs.functional = false # no nfs start
677
+ ac.arubacloud_username = ENV['AC_USERNAME']
678
+ ac.arubacloud_password = ENV['AC_PASSWORD']
679
+ ac.service_type = 4
680
+ ac.endpoint = "dc2"
681
+ ac.template_id = '601'
682
+ ac.server_name = 'lnxtestvaga'
683
+ ac.package_id = 'small'
684
+ end
685
+ end
686
+ #
687
+ config.vm.define :vmvgr02 do |vmvgr02_config|
688
+ vmvgr02_config.ssh.username = 'root'
689
+ vmvgr02_config.ssh.password = 'test123'
690
+ vmvgr02_config.vm.synced_folder ".", "/vagrant", disabled: true
691
+ vmvgr02_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
692
+ vmvgr02_config.vm.provision "shell" do |s|
693
+ s.inline = "echo 'test2 start script ok'"
694
+ end
695
+ vmvgr02_config.vm.provider :arubacloud do |ac, ac_override|
696
+ ac_override.nfs.functional = false # no nfs start
697
+ ac.arubacloud_username = ENV['AC_USERNAME']
698
+ ac.arubacloud_password = ENV['AC_PASSWORD']
699
+ ac.service_type = 4
700
+ ac.endpoint = "dc2"
701
+ ac.template_id = '601'
702
+ ac.server_name = 'lnxtestvagb'
703
+ ac.package_id = 'small'
704
+ end
705
+ end
706
+ #
707
+ config.vm.define :vmvgr03 do |vmvgr03_config|
708
+ vmvgr03_config.ssh.username = 'root'
709
+ vmvgr03_config.ssh.password = 'test123'
710
+ vmvgr03_config.vm.synced_folder ".", "/vagrant", disabled: true
711
+ vmvgr03_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
712
+ vmvgr03_config.vm.provision "shell" do |s|
713
+ s.inline = "echo 'test machine 3 start script ok'"
714
+ end
715
+ vmvgr03_config.vm.provider :arubacloud do |ac, ac_override|
716
+ ac_override.nfs.functional = false # no nfs start
717
+ ac.arubacloud_username = ENV['AC_USERNAME']
718
+ ac.arubacloud_password = ENV['AC_PASSWORD']
719
+ ac.service_type = 4
720
+ ac.endpoint = "dc2"
721
+ ac.template_id = '601'
722
+ ac.server_name = 'lnxtestvagc'
723
+ ac.package_id = 'small'
724
+ end
725
+ end
726
+ #
727
+ config.vm.define :vmvgr04 do |vmvgr04_config|
728
+ vmvgr04_config.ssh.username = 'root'
729
+ vmvgr04_config.ssh.password = 'test123'
730
+ vmvgr04_config.vm.synced_folder ".", "/vagrant", disabled: true
731
+ vmvgr04_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
732
+ vmvgr04_config.vm.provision "shell" do |s|
733
+ s.inline = "echo 'test machine 04 start script ok'"
734
+ end
735
+ vmvgr04_config.vm.provider :arubacloud do |ac, ac_override|
736
+ ac_override.nfs.functional = false # no nfs start
737
+ ac.arubacloud_username = ENV['AC_USERNAME']
738
+ ac.arubacloud_password = ENV['AC_PASSWORD']
739
+ ac.service_type = 4
740
+ ac.endpoint = "dc2"
741
+ ac.template_id = '601'
742
+ ac.server_name = 'lnxtestvagd'
743
+ ac.package_id = 'medium'
744
+ end
745
+ end
746
+ #
747
+ config.vm.define :vmvgr05 do |vmvgr05_config|
748
+ vmvgr05_config.ssh.username = 'root'
749
+ vmvgr05_config.ssh.password = 'test123'
750
+ vmvgr05_config.vm.synced_folder ".", "/vagrant", disabled: true
751
+ vmvgr05_config.vm.synced_folder "/hostshare2", "/guestshare_norm"
752
+ vmvgr05_config.vm.provision "shell" do |s|
753
+ s.inline = "echo 'test machine 5 start script ok'"
754
+ end
755
+ vmvgr05_config.vm.provider :arubacloud do |ac, ac_override|
756
+ ac_override.nfs.functional = false # no nfs start
757
+ ac.arubacloud_username = ENV['AC_USERNAME']
758
+ ac.arubacloud_password = ENV['AC_PASSWORD']
759
+ ac.service_type = 4
760
+ ac.endpoint = "dc2"
761
+ ac.template_id = '601'
762
+ ac.server_name = 'lnxtestvage'
763
+ ac.package_id = 'small'
764
+ end
765
+ end
766
+
767
+ end
768
+ ```
769
+
770
+
771
+
772
+
773
+
774
+ #### Vagrant option supported and not
775
+
776
+ The following table shows the vagrant options supported and not from this plugin
777
+
778
+ | option | support ? | description |
779
+ | --- | --- | --- |
780
+ | *arubacloud* | `OK`| used for subcommand servers / templates |
781
+ | *box* | `OK` | manages boxes: installation, removal, etc |
782
+ | *cap* | not tested | checks and executes capability |
783
+ | *connect* | not tested | connect to a remotely shared Vagrant environment |
784
+ | *cucumber* | not tested | |
785
+ | *destroy* | `OK`| tops and deletes all traces of the vagrant machine |
786
+ | *docker-exec* | not tested | attach to an already-running docker container |
787
+ | *docker-logs* | not tested | outputs the logs from the Docker container |
788
+ | *docker-run* | not tested | run a one-off command in the context of a container |
789
+ | *global-status* | `OK`| outputs status Vagrant environments for this user |
790
+ | *halt* | `OK*` | stops the vagrant machin: is ok for 'smart' not for 'pro' |
791
+ | *help* | `OK`| shows the help for a subcommand |
792
+ | *init* | `OK`| initializes a new Vagrant environment by creating a Vagrantfile |
793
+ | *login* |not tested | log in to HashiCorp's Vagrant Cloud |
794
+ | *mutate* | no supported | |
795
+ | *package* | no supported | packages a running vagrant environment into a box |
796
+ | *plugin* | `OK`| manages plugins: install, uninstall, update, etc. |
797
+ | *port* | not tested | displays information about guest port mappings |
798
+ | *powershell* | not tested | connects to machine via powershell remoting |
799
+ | *provider* | `OK` | show provider for this environment |
800
+ | *provision* | `OK`| provisions the vagrant machine |
801
+ | *push* | not tested | deploys code in this environment to a configured destination |
802
+ | *rdp* | not tested | connects to machine via RDP |
803
+ | *reload* | `OK*`| is a power-off ( software shutdown) + power-on |
804
+ | *share* | not tested | share your Vagrant environment with anyone in the world |
805
+ | *snapshot* | `OK*` | make snapshots: create,delete,restore,list (--help for view syntax)|
806
+ | *ssh* | `OK`| connects to machine via SSH |
807
+ | *ssh-config* | `OK`| outputs OpenSSH valid configuration to connect to the machine |
808
+ | *status* | `OK`| outputs status of the vagrant machine |
809
+ | *suspend* | not supported | suspends the machine |
810
+ | *resume* | not supported | resume a suspended vagrant machine |
811
+ | *rsync* | `OK` | syncs rsync synced folders to remote machine |
812
+ | *rsync-auto* | `OK` | syncs rsync synced folders automatically when files change |
813
+ | *suspend* | not supported | suspends the machine |
814
+ | *up* | `OK`| starts and provisions the vagrant environment |
815
+ | *validate* | `OK`| validates the Vagrantfile |
816
+ | *vbguest* | not tested | install VirtualBox Guest Additions to the machine |
817
+ | *version* | `OK`| prints current and latest Vagrant version |
818
+
819
+
820
+ Note:
821
+ 1. to obtain full list vagrant options enter: *vagrant list-commands*
822
+ 2. `OK*` : operation and syntax is slightly different from Vagrant specifications
823
+
824
+
825
+
826
+
827
+
828
+ #### Error messages
829
+
830
+
831
+
832
+ _________
833
+ * if after 'vagrant up .... ' is returned this output :
834
+
835
+ ```
836
+ - Vagrant failed to initialize at a very early stage:
837
+
838
+ The plugins failed to load properly. The error message given is
839
+ shown below.
840
+
841
+ Encoded files can't be read outside of the Vagrant installer.
842
+ ```
843
+
844
+ *a possible solution can be export VAGRANT_INSTALLER_EMBEDDED_DIR with the name of the folder from which the command is launched and where the vagrantfile is located.*
845
+ example :
846
+
847
+
848
+ export VAGRANT_INSTALLER_EMBEDDED_DIR=/home/user/vagrant_dir
849
+
850
+
851
+ (if you start 'vagrant up' from directory : */home/user/vagrant_dir* )
852
+
853
+
854
+ _________
855
+ * when vagrant with any options return this output
856
+
857
+
858
+ ```
859
+ ... {:http_method=>:post, :method=>"GetServerDetails", :body=>"{\"ApplicationId\":\"GetServerDetails\",\"RequestId\":\"GetServerDetails\",\"Sessionid\":\"GetServerDetails\",\"Username\":\"...\",\"Password\":\"...\",\"ServerId\":\"..nnn..\"}"}**---starting ---------bundler: failed to load command: vagrant (/....../.gem/ruby/2.x.x/bin/vagrant)
860
+ Fog::ArubaCloud::Errors::RequestError: Could not find Server Id ..nnn..
861
+ ExceptionCode=15
862
+ ExceptionCode=15
863
+ ```
864
+
865
+ *the VM may have been deleted outside of vagrant;
866
+ A possible solution is rename the '.vagrant' directory as '.vagrant-old' (it's in the folder from which we start the vagrant commands) and run the command to create the VM again.
867
+ (warning : if there are multiple VM defined in '.vagrant' directory , you should consult the official documentation of Vagrant)*
868
+
869
+
870
+ _______
871
+ * when vagrant with any options (for example 'reload' 'halt' ...etc) return this output
872
+
873
+ ```
874
+ ==> vmvgr01: [dc2] The server will be powered off.
875
+ ==> vmvgr01: The operation you are calling on the server, is already present in queue.
876
+ ..........
877
+ ```
878
+
879
+ *In this case the interface is still in a 'busy' state; try again after a few tens of seconds or a minute the command;*
880
+
881
+
882
+
883
+ _________
884
+ * if after 'vagrant arubacloud servers' is returned this output :
885
+
886
+ ```
887
+ : DC Server Name Id State Code State meaning IPv4 address
888
+ : --------------------------------------------------------------------------------
889
+ -------: dc2 server1 45840 3 Running xxx.xxx.xxx.xxx
890
+ -------: dc2 lnxtestvag2 48523 3 Running yyy.yyy.yyy.yyy
891
+
892
+ bundler: failed to load command: vagrant (/..../bin/vagrant)
893
+ Fog::ArubaCloud::Errors::RequestError: Could not find Server Id .....
894
+ ```
895
+
896
+
897
+ *In case the destroy is done, since this operation is not immediate, if the server list is requested, it can happen that the operation takes place when the server details are requested;
898
+ in this case the detail can no longer be found and the command returns this message;
899
+ try again after a few seconds the command;*
900
+
901
+
902
+
903
+
904
+
905
+
906
+ ________
907
+ Notes:
908
+ ________
909
+
910
+
911
+ Note that normally a lot of this boilerplate is encoded within the box file, but the box file used for the quick start, the "dummy" box, has no preconfigured defaults.
912
+
913
+ If you have issues with SSH connecting, make sure that the instances are being launched with a security group that allows SSH access.
914
+
915
+
916
+
917
+
918
+
919
+
920
+
921
+
922
+ #### Development
923
+
924
+ To work on the `vagrant-arubacloud` plugin, clone this repository out, and use
925
+ [Bundler](http://gembundler.com) to get the dependencies:
926
+
927
+ ```
928
+ $ bundle
929
+ ```
930
+
931
+ Once you have the dependencies, verify the unit tests pass with `rake`:
932
+
933
+ ```
934
+ $ bundle exec rake
935
+ ```
936
+
937
+ If those pass, you're ready to start developing the plugin. You can test
938
+ the plugin without installing it into your Vagrant environment by just
939
+ creating a `Vagrantfile` in the top level of this directory (it is gitignored)
940
+ and add the following line to your `Vagrantfile`
941
+ ```ruby
942
+ Vagrant.require_plugin "vagrant-arubacloud"
943
+ ```
944
+ Use bundler to execute Vagrant:
945
+ ```
946
+ $ bundle exec vagrant up --provider=arubacloud
947
+ ```
948
+
949
+
950
+ #### License
951
+
952
+ This code is released under the MIT License.
953
+
954
+ Copyright (c) 2018 Aruba Cloud