vagrant-azure 2.0.0.pre2 → 2.0.0.pre3

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
  SHA1:
3
- metadata.gz: 5bec96dd4b99f7a5bf92f5d5b8056b1ce4885d44
4
- data.tar.gz: aa65b0f1615ae25b591ffd59efd462332ea4de93
3
+ metadata.gz: 500531015ee4b9fa81557c8398f1fed55455cc4c
4
+ data.tar.gz: dec5502ea4dab238bb49cd61b2559102ad4eada6
5
5
  SHA512:
6
- metadata.gz: 5f838e34d66d8795e0b0dc00ad4f2529ad230f996e06923ba37adb4e1d16403c263dfca156d292ccc204c5e63ec39fe63491474f8164e8e0efbfc515a90457e2
7
- data.tar.gz: 3e057b8906ad18b76e15dcf5f8a674bbaa3b050880de1e5e4a188a1efa07c0d811fee2b4e2c855764862bf1b2a8fc151372d4d6709ce252f1eb7f01ac1defe21
6
+ metadata.gz: 2dce397adb9a233f7294d3f857e7de47c192b76a4da0f959e826a0ca449015bba6984d655d6a23d19d4d7a83e027f92facf35ba55cf084855d91dfe8f82c509b
7
+ data.tar.gz: 18d6a73dd73b31e4cafa27b29aaffcfb626653d6f6e36a7aab6a49853658872faadc6ae94b87c26456280b40b5dbe838ce973426eac029c3fd98cc9569902329
data/README.md CHANGED
@@ -11,10 +11,10 @@ provider to Vagrant, allowing Vagrant to control and provision machines in Micro
11
11
 
12
12
  Install the vagrant-azure plugin using the standard Vagrant 1.1+ installation methods. After installing the plugin, you can ```vagrant up``` and use ```azure``` provider. For example:
13
13
 
14
- ```
15
- vagrant plugin install vagrant-azure --plugin-version '2.0.0.pre1' --plugin-prerelease
14
+ ```sh
15
+ & vagrant plugin install vagrant-azure --plugin-version '2.0.0.pre3'
16
16
  ...
17
- vagrant up --provider=azure
17
+ $ vagrant up --provider=azure
18
18
  ...
19
19
  ```
20
20
 
@@ -24,12 +24,12 @@ You'll need an ```azure``` box before you can do ```vagrant up``` though.
24
24
 
25
25
  You can use the dummy box and specify all the required details manually in the ```config.vm.provider``` block in your ```Vagrantfile```. Add the dummy box with the name you want:
26
26
 
27
- ```
28
- vagrant box add azure https://github.com/azure/vagrant-azure/raw/v2.0/dummy.box
27
+ ```sh
28
+ $ vagrant box add azure https://github.com/azure/vagrant-azure/raw/v2.0/dummy.box
29
29
  ...
30
30
  ```
31
31
 
32
- Now edit your ```Vagrantfile``` as shown below and provide all the values as explained.
32
+ For ***nix**, edit your `Vagrantfile` as shown below and provide all the values as explained.
33
33
 
34
34
  ```ruby
35
35
  Vagrant.configure('2') do |config|
@@ -52,10 +52,41 @@ Vagrant.configure('2') do |config|
52
52
  end
53
53
  ```
54
54
 
55
- Now you can run
55
+ For **Windows**, edit your `Vagrantfile` as shown below and provide all the values as explained.
56
+
57
+ ```ruby
58
+ Vagrant.configure('2') do |config|
59
+ config.vm.box = 'azure'
56
60
 
61
+ config.vm.provider :azure do |azure, override|
62
+
63
+ # use Azure Active Directory Application / Service Principal to connect to Azure
64
+ # see: https://azure.microsoft.com/en-us/documentation/articles/resource-group-create-service-principal-portal/
65
+
66
+ # each of the below values will default to use the env vars named as below if not specified explicitly
67
+ azure.tenant_id = ENV['AZURE_TENANT_ID']
68
+ azure.client_id = ENV['AZURE_CLIENT_ID']
69
+ azure.client_secret = ENV['AZURE_CLIENT_SECRET']
70
+ azure.subscription_id = ENV['AZURE_SUBSCRIPTION_ID']
71
+
72
+ azure.vm_image_urn = 'MicrosoftSQLServer:SQL2016-WS2012R2:Express:latest'
73
+ azure.instance_ready_timeout = 600
74
+ azure.vm_password = 'TopSecretPassw0rd'
75
+ azure.admin_username = "OctoAdmin"
76
+ azure.admin_password = 'TopSecretPassw0rd'
77
+ override.winrm.transport = :ssl
78
+ override.winrm.port = 5986
79
+ override.winrm.ssl_peer_verification = false # must be false if using a self signed cert
80
+ end
81
+
82
+ end
57
83
  ```
58
- vagrant up --provider=azure
84
+
85
+ Now you can run
86
+
87
+ ```sh
88
+ $ vagrant up --provider=azure
89
+ ...
59
90
  ```
60
91
 
61
92
  This will bring up an Azure VM as per the configuration options set above.
@@ -66,7 +97,7 @@ Normally, a lot of this options, e.g., ```vm_image_urn```, will be embedded in a
66
97
 
67
98
  ## Azure Boxes
68
99
 
69
- The vagrant-azure plugin provides the ability to use ```Azure``` boxes with Vagrant. Please see the example box provided in [example_box/ directory](https://github.com/azure/vagrant-azure/tree/v2.0/example_box) and follow the instructions there to build an ```azure``` box.
100
+ The vagrant-azure plugin provides the ability to use ```Azure``` boxes with Vagrant. Please see the example box provided in [example_box](https://github.com/azure/vagrant-azure/tree/v2.0/example_box) directory and follow the instructions there to build an ```azure``` box.
70
101
 
71
102
  Please see [Vagrant Docs](http://docs.vagrantup.com/v2/) for more details.
72
103
 
@@ -76,21 +107,28 @@ The vagrant-azure provide exposes a few Azure specific configuration options:
76
107
 
77
108
  ### Mandatory
78
109
 
79
- For instructions on how to setup an Azure Active Directory Application see: https://azure.microsoft.com/en-us/documentation/articles/resource-group-create-service-principal-portal/
110
+ For instructions on how to setup an Azure Active Directory Application see: <https://azure.microsoft.com/en-us/documentation/articles/resource-group-create-service-principal-portal/>
111
+
80
112
  * `tenant_id`: Your Azure Active Directory Tenant Id.
81
113
  * `client_id`: Your Azure Active Directory application client id.
82
114
  * `client_secret`: Your Azure Active Directory application client secret.
83
115
  * `subscription_id`: The Azure subscription Id you'd like to use.
84
116
 
85
117
  ### Optional
118
+
86
119
  * `resource_group_name`: (Optional) Name of the resource group to use.
87
- * `location`: (Optional) Azure location to build the VM -- defaults to 'westus'
120
+ * `location`: (Optional) Azure location to build the VM -- defaults to `westus`
88
121
  * `vm_name`: (Optional) Name of the virtual machine
89
122
  * `vm_password`: (Optional for *nix) Password for the VM -- This is not recommended for *nix deployments
90
- * `vm_size`: (Optional) VM size to be used -- defaults to 'Standard_DS2_v2'. See: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-sizes/
91
- * `vm_image_urn`: (Optional) Name of the virtual machine image urn to use -- defaults to 'canonical:ubuntuserver:16.04-LTS:latest'. See: https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-cli-ps-findimage/
123
+ * `vm_size`: (Optional) VM size to be used -- defaults to 'Standard_DS2_v2'. See sizes for [*nix](https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-sizes/), [Windows](https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-windows-sizes/).
124
+ * `vm_image_urn`: (Optional) Name of the virtual machine image urn to use -- defaults to 'canonical:ubuntuserver:16.04-LTS:latest'. See documentation for [*nix](https://azure.microsoft.com/en-us/documentation/articles/virtual-machines-linux-cli-ps-findimage/), [Windows](https://docs.microsoft.com/en-us/azure/virtual-machines/virtual-machines-windows-cli-ps-findimage).
92
125
  * `virtual_network_name`: (Optional) Name of the virtual network resource
93
126
  * `subnet_name`: (Optional) Name of the virtual network subnet resource
94
127
  * `instance_ready_timeout`: (Optional) The timeout to wait for an instance to become ready -- default 120 seconds.
95
128
  * `instance_check_interval`: (Optional) The interval to wait for checking an instance's state -- default 2 seconds.
96
- * `endpoint`: (Optional) The Azure Management API endpoint -- default 'https://management.azure.com' seconds -- ENV['AZURE_MANAGEMENT_ENDPOINT'].
129
+ * `endpoint`: (Optional) The Azure Management API endpoint -- default `ENV['AZURE_MANAGEMENT_ENDPOINT']` if exists, falls back to <https://management.azure.com>.
130
+ * `admin_username`: (Optional) The root/administrator username for the VM
131
+ * `admin_password`: (Optional, Windows only) The password to set for the windows administrator user
132
+ * `winrm_install_self_signed_cert`: (Optional, Windows only) Whether to install a self-signed cert automatically to enable WinRM to communicate over HTTPS (5986). Only available when a custom `deployment_template` is not supplied. Default 'true'.
133
+ * `deployment_template`: (Optional) A custom ARM template to use instead of the default template
134
+ * `wait_for_destroy`: (Optional) Wait for all resources to be deleted prior to completing Vagrant destroy -- default false.
@@ -90,6 +90,7 @@ module VagrantPlugins
90
90
  operating_system = get_image_os(image_details)
91
91
 
92
92
  template_params = {
93
+ availability_set_name: availability_set_name,
93
94
  operating_system: operating_system,
94
95
  winrm_install_self_signed_cert: winrm_install_self_signed_cert,
95
96
  winrm_port: winrm_port,
@@ -10,7 +10,7 @@ module VagrantPlugins
10
10
  class TerminateInstance
11
11
  include VagrantPlugins::Azure::Util::MachineIdHelper
12
12
 
13
- def initialize(app, env)
13
+ def initialize(app, _)
14
14
  @app = app
15
15
  @logger = Log4r::Logger.new('vagrant_azure::action::terminate_instance')
16
16
  end
@@ -23,7 +23,12 @@ module VagrantPlugins
23
23
  env[:ui].info('Deleting resource group')
24
24
 
25
25
  # Call the begin_xxx_async version to kick off the delete, but don't wait for the resource group to be cleaned up
26
- env[:azure_arm_service].resources.resource_groups.begin_delete_async(parsed[:group]).value!
26
+ if env[:machine].provider_config.wait_for_destroy
27
+ env[:azure_arm_service].resources.resource_groups.delete(parsed[:group])
28
+ else
29
+ env[:azure_arm_service].resources.resource_groups.begin_delete_async(parsed[:group]).value!
30
+ end
31
+
27
32
  env[:ui].info('Resource group is deleting... Moving on.')
28
33
  rescue MsRestAzure::AzureOperationError => ex
29
34
  unless ex.response.status == 404
@@ -113,6 +113,11 @@ module VagrantPlugins
113
113
  # @return [String]
114
114
  attr_accessor :deployment_template
115
115
 
116
+ # (Optional) Wait for all resources to be deleted prior to completing Vagrant destroy -- default false.
117
+ #
118
+ # @return [String]
119
+ attr_accessor :wait_for_destroy
120
+
116
121
  def initialize
117
122
  @tenant_id = UNSET_VALUE
118
123
  @client_id = UNSET_VALUE
@@ -135,6 +140,7 @@ module VagrantPlugins
135
140
  @admin_password = UNSET_VALUE
136
141
  @winrm_install_self_signed_cert = UNSET_VALUE
137
142
  @deployment_template = UNSET_VALUE
143
+ @wait_for_destroy = UNSET_VALUE
138
144
  end
139
145
 
140
146
  def finalize!
@@ -162,6 +168,7 @@ module VagrantPlugins
162
168
  @admin_password = (ENV['AZURE_VM_ADMIN_PASSWORD'] || '$Vagrant(0)') if @admin_password == UNSET_VALUE
163
169
  @winrm_install_self_signed_cert = true if @winrm_install_self_signed_cert == UNSET_VALUE
164
170
  @deployment_template = nil if @deployment_template == UNSET_VALUE
171
+ @wait_for_destroy = false if @wait_for_destroy == UNSET_VALUE
165
172
  end
166
173
 
167
174
  def validate(machine)
@@ -4,6 +4,6 @@
4
4
 
5
5
  module VagrantPlugins
6
6
  module Azure
7
- VERSION = '2.0.0.pre2'.freeze
7
+ VERSION = '2.0.0.pre3'.freeze
8
8
  end
9
9
  end
data/spec/spec_helper.rb CHANGED
@@ -3,35 +3,6 @@
3
3
  # Licensed under the MIT License. See License in the project root for license information.
4
4
  require 'vagrant-azure'
5
5
 
6
- if ENV['COVERAGE'] || ENV['CI'] || ENV['TRAVIS']
7
- require 'simplecov'
8
- require 'coveralls'
9
-
10
- if ENV['TRAVIS']
11
- SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
12
- SimpleCov::Formatter::HTMLFormatter,
13
- Coveralls::SimpleCov::Formatter
14
- ]
15
- else
16
- SimpleCov.formatter = SimpleCov::Formatter::HTMLFormatter
17
- end
18
-
19
- SimpleCov.start do
20
- project_name 'vagrant-azure'
21
- add_filter '/build-tests/'
22
- add_filter '/coverage/'
23
- add_filter '/locales/'
24
- add_filter '/templates/'
25
- add_filter '/doc/'
26
- add_filter '/example_box/'
27
- add_filter '/pkg/'
28
- add_filter '/spec/'
29
- add_filter '/tasks/'
30
- add_filter '/yard-template/'
31
- add_filter '/yardoc/'
32
- end
33
- end
34
-
35
6
  # import all the support files
36
7
  Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require File.expand_path(f) }
37
8
 
@@ -242,6 +242,14 @@
242
242
  ]
243
243
  }
244
244
  },
245
+ <% if availabilitySetName = availability_set_name.nil? || availability_set_name.empty? ? nil : availability_set_name %>
246
+ {
247
+ "apiVersion": "[variables('apiVersion')]",
248
+ "type": "Microsoft.Compute/availabilitySets",
249
+ "name": "<%= availabilitySetName %>",
250
+ "location": "[variables('location')]"
251
+ },
252
+ <% end %>
245
253
  {
246
254
  "apiVersion": "[variables('apiVersion')]",
247
255
  "type": "Microsoft.Compute/virtualMachines",
@@ -250,6 +258,9 @@
250
258
  "dependsOn": [
251
259
  "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
252
260
  "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
261
+ <% if availabilitySetName %>,
262
+ "[resourceId('Microsoft.Compute/availabilitySets', '<%= availabilitySetName %>')]"
263
+ <% end %>
253
264
  ],
254
265
  <% if operating_system == 'Windows' %>
255
266
  <%= self_signed_cert_resource %>
@@ -300,6 +311,11 @@
300
311
  }
301
312
  ]
302
313
  }
314
+ <% if availabilitySetName %>,
315
+ "availabilitySet": {
316
+ "id": "[resourceId('Microsoft.Compute/availabilitySets', '<%= availabilitySetName %>')]"
317
+ }
318
+ <% end %>
303
319
  }
304
320
  }
305
321
  ]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-azure
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre2
4
+ version: 2.0.0.pre3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Azure
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-02 00:00:00.000000000 Z
11
+ date: 2017-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: azure_mgmt_resources