vagrant-arubacloud 0.0.4 → 0.0.5

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