kitchen-azurerm 0.9.0 → 0.9.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +43 -14
- data/lib/kitchen/driver/azurerm.rb +7 -3
- data/templates/internal.erb +16 -2
- data/templates/public.erb +17 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ad9802000d8da44ea5c8a5db26f62bc73032f3de
|
4
|
+
data.tar.gz: 05af13b533563440adf0bf12b4d484bce16ab6d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa059e1b4db08380723c341a1bfba8eed3b286c2d1da15859dc4c65d6e805acebfd632909f00be3b5678c2866a3e4c8c60b9fff4c69ce64ab0579301a8eea990
|
7
|
+
data.tar.gz: 405e3b0cf9ff62ad381196a462ba8093fd8043b34b74258881d51b51bfa7bd26ec4d7cf71d734a7df1f071ab6460283d865adac9d8dd74fb217d29ed6ec38dcc
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# kitchen-azurerm Changelog
|
2
2
|
|
3
|
+
## [0.9.1] - 2017-05-25
|
4
|
+
- Support for Managed Disks enabled by default (@stuartpreston)
|
5
|
+
- Add ```use_managed_disks``` driver_config parameter (@stuartpreston)
|
6
|
+
|
7
|
+
## [0.9.0] - 2017-04-28
|
8
|
+
- Support for AzureUSGovernment, AzureChina and AzureGermanCloud environments
|
9
|
+
- Add ```azure_environment``` driver_config parameter (@stuartpreston)
|
10
|
+
|
3
11
|
## [0.8.1] - 2017-02-28
|
4
12
|
- Adding provider identifier tag to all created resources (@stuartpreston)
|
5
13
|
|
data/README.md
CHANGED
@@ -7,7 +7,9 @@
|
|
7
7
|
This version has been tested on Windows, OS/X and Ubuntu. If you encounter a problem on your platform, please raise an issue.
|
8
8
|
|
9
9
|
## Quick-start
|
10
|
+
|
10
11
|
### Installation
|
12
|
+
|
11
13
|
This plugin is distributed as a [Ruby Gem](https://rubygems.org/gems/kitchen-azurerm). To install it, run:
|
12
14
|
|
13
15
|
```$ gem install kitchen-azurerm```
|
@@ -91,9 +93,7 @@ Where <n> is the number of threads to create. Note that any failure (e.g. an Azu
|
|
91
93
|
|
92
94
|
### .kitchen.yml example 2 - Windows
|
93
95
|
|
94
|
-
Here's a further example ```.kitchen.yml``` file that will provision a Windows Server 2012 R2 instance
|
95
|
-
|
96
|
-
**Note: Test Kitchen currently uses WinRM over HTTP rather than HTTPS. This means the temporary machine credentials traverse the internet in the clear. This will be changed once Test Kitchen fully supports WinRM over a secure channel.**
|
96
|
+
Here's a further example ```.kitchen.yml``` file that will provision a Windows Server 2012 R2 instance, using WinRM as the transport. The resource created in Azure will enable itself for remote access at deployment time (it does this by customizing the machine at provisioning time):
|
97
97
|
|
98
98
|
```yaml
|
99
99
|
---
|
@@ -114,17 +114,6 @@ platforms:
|
|
114
114
|
image_urn: MicrosoftWindowsServer:WindowsServer:2012-R2-Datacenter:latest
|
115
115
|
transport:
|
116
116
|
name: winrm
|
117
|
-
- name: windows2008-r2
|
118
|
-
driver_config:
|
119
|
-
image_urn: MicrosoftWindowsServer:WindowsServer:2008-R2-SP1:latest
|
120
|
-
winrm_powershell_script: |-
|
121
|
-
winrm quickconfig -q
|
122
|
-
winrm set winrm/config/winrs '@{MaxMemoryPerShellMB="512"}'
|
123
|
-
winrm set winrm/config '@{MaxTimeoutms="1800000"}'
|
124
|
-
winrm set winrm/config/service '@{AllowUnencrypted="true"}'
|
125
|
-
winrm set winrm/config/service/auth '@{Basic="true"}'
|
126
|
-
transport:
|
127
|
-
name: winrm
|
128
117
|
suites:
|
129
118
|
- name: default
|
130
119
|
run_list:
|
@@ -246,6 +235,45 @@ suites:
|
|
246
235
|
attributes:
|
247
236
|
```
|
248
237
|
|
238
|
+
## Support for Government and Sovereign Clouds (China and Germany)
|
239
|
+
|
240
|
+
Starting with v0.9.0 this driver has support for Azure Government and Sovereign Clouds via the use of the ```azure_environment``` setting. Valid Azure environments are ```Azure```, ```AzureUSGovernment```, ```AzureChina``` and ```AzureGermanCloud```
|
241
|
+
|
242
|
+
Note that the ```use_managed_disks``` option should be set to false until supported by AzureUSGovernment.
|
243
|
+
|
244
|
+
### Example .kitchen.yml for Azure US Government cloud
|
245
|
+
|
246
|
+
```yaml
|
247
|
+
---
|
248
|
+
driver:
|
249
|
+
name: azurerm
|
250
|
+
|
251
|
+
driver_config:
|
252
|
+
subscription_id: 'abcdabcd-YOUR-GUID-HERE-abcdabcdabcd'
|
253
|
+
azure_environment: 'AzureUSGovernment'
|
254
|
+
location: 'US Gov Iowa'
|
255
|
+
machine_size: 'Standard_D2_v2_Promo'
|
256
|
+
use_managed_disks: false
|
257
|
+
|
258
|
+
provisioner:
|
259
|
+
name: chef_zero
|
260
|
+
|
261
|
+
verifier:
|
262
|
+
name: inspec
|
263
|
+
|
264
|
+
platforms:
|
265
|
+
- name: ubuntu1604
|
266
|
+
driver_config:
|
267
|
+
image_urn: Canonical:UbuntuServer:16.04-LTS:latest
|
268
|
+
transport:
|
269
|
+
ssh_key: ~/.ssh/id_kitchen-azurerm
|
270
|
+
|
271
|
+
suites:
|
272
|
+
- name: default
|
273
|
+
run_list:
|
274
|
+
- recipe[vmtesting::default]
|
275
|
+
```
|
276
|
+
|
249
277
|
### How to retrieve the image_urn
|
250
278
|
You can use the azure (azure-cli) command line tools to interrogate for the Urn. All 4 parts of the Urn must be specified, though the last part can be changed to "latest" to indicate you always wish to provision the latest operating system and patches.
|
251
279
|
|
@@ -285,6 +313,7 @@ info: vm image list command OK
|
|
285
313
|
- The ```storage_account_type``` parameter defaults to 'Standard_LRS' and allows you to switch to premium storage (e.g. 'Premium_LRS')
|
286
314
|
- The ```enable_boot_diagnostics``` parameter defaults to 'true' and allows you to switch off boot diagnostics in case you are using premium storage.
|
287
315
|
- The optional ```vm_tags``` parameter allows you to define key:value pairs to tag VMs with on creation.
|
316
|
+
- Managed disks are now enabled by default, to use the Storage account set ```use_managed_disks``` (default: true).
|
288
317
|
|
289
318
|
## Contributing
|
290
319
|
|
@@ -76,6 +76,10 @@ module Kitchen
|
|
76
76
|
false
|
77
77
|
end
|
78
78
|
|
79
|
+
default_config(:use_managed_disks) do |_config|
|
80
|
+
true
|
81
|
+
end
|
82
|
+
|
79
83
|
def create(state)
|
80
84
|
state = validate_state(state)
|
81
85
|
image_publisher, image_offer, image_sku, image_version = config[:image_urn].split(':', 4)
|
@@ -163,7 +167,7 @@ module Kitchen
|
|
163
167
|
state[:uuid] = SecureRandom.hex(8) unless existing_state_value?(state, :uuid)
|
164
168
|
state[:server_id] = "vm#{state[:uuid]}" unless existing_state_value?(state, :server_id)
|
165
169
|
state[:azure_resource_group_name] = azure_resource_group_name unless existing_state_value?(state, :azure_resource_group_name)
|
166
|
-
[:subscription_id, :username, :password, :vm_name, :azure_environment].each do |config_element|
|
170
|
+
[:subscription_id, :username, :password, :vm_name, :azure_environment, :use_managed_disks].each do |config_element|
|
167
171
|
state[config_element] = config[config_element] unless existing_state_value?(state, config_element)
|
168
172
|
end
|
169
173
|
state.delete(:password) unless instance.transport[:ssh_key].nil?
|
@@ -376,10 +380,10 @@ logoff
|
|
376
380
|
|
377
381
|
def virtual_machine_deployment_template
|
378
382
|
if config[:vnet_id] == ''
|
379
|
-
virtual_machine_deployment_template_file('public.erb', vm_tags: vm_tag_string(config[:vm_tags]))
|
383
|
+
virtual_machine_deployment_template_file('public.erb', vm_tags: vm_tag_string(config[:vm_tags]), use_managed_disks: config[:use_managed_disks])
|
380
384
|
else
|
381
385
|
info "Using custom vnet: #{config[:vnet_id]}"
|
382
|
-
virtual_machine_deployment_template_file('internal.erb', vnet_id: config[:vnet_id], subnet_id: config[:subnet_id], public_ip: config[:public_ip], vm_tags: vm_tag_string(config[:vm_tags]))
|
386
|
+
virtual_machine_deployment_template_file('internal.erb', vnet_id: config[:vnet_id], subnet_id: config[:subnet_id], public_ip: config[:public_ip], vm_tags: vm_tag_string(config[:vm_tags]), use_managed_disks: config[:use_managed_disks])
|
383
387
|
end
|
384
388
|
end
|
385
389
|
|
data/templates/internal.erb
CHANGED
@@ -107,6 +107,7 @@
|
|
107
107
|
"provider": "[toUpper('33194f91-eb5f-4110-827a-e95f640a9e46')]"
|
108
108
|
},
|
109
109
|
"resources": [
|
110
|
+
<%- unless use_managed_disks -%>
|
110
111
|
{
|
111
112
|
"type": "Microsoft.Storage/storageAccounts",
|
112
113
|
"name": "[parameters('newStorageAccountName')]",
|
@@ -119,6 +120,7 @@
|
|
119
120
|
"provider": "[variables('provider')]"
|
120
121
|
}
|
121
122
|
},
|
123
|
+
<%- end -%>
|
122
124
|
<%- if public_ip -%>
|
123
125
|
{
|
124
126
|
"apiVersion": "2015-05-01-preview",
|
@@ -169,12 +171,14 @@
|
|
169
171
|
}
|
170
172
|
},
|
171
173
|
{
|
172
|
-
"apiVersion": "
|
174
|
+
"apiVersion": "2016-04-30-preview",
|
173
175
|
"type": "Microsoft.Compute/virtualMachines",
|
174
176
|
"name": "[variables('vmName')]",
|
175
177
|
"location": "[variables('location')]",
|
176
|
-
"dependsOn": [
|
178
|
+
"dependsOn": [
|
179
|
+
<%- unless use_managed_disks -%>
|
177
180
|
"[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]",
|
181
|
+
<%- end -%>
|
178
182
|
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
179
183
|
],
|
180
184
|
"properties": {
|
@@ -193,6 +197,7 @@
|
|
193
197
|
"sku": "[parameters('imageSku')]",
|
194
198
|
"version": "[parameters('imageVersion')]"
|
195
199
|
},
|
200
|
+
<%- unless use_managed_disks -%>
|
196
201
|
"osDisk": {
|
197
202
|
"name": "osdisk",
|
198
203
|
"vhd": {
|
@@ -201,6 +206,13 @@
|
|
201
206
|
"caching": "ReadWrite",
|
202
207
|
"createOption": "FromImage"
|
203
208
|
}
|
209
|
+
<%- end -%>
|
210
|
+
<%- if use_managed_disks -%>
|
211
|
+
"osDisk": {
|
212
|
+
"name": "osdisk",
|
213
|
+
"createOption": "FromImage"
|
214
|
+
}
|
215
|
+
<%- end -%>
|
204
216
|
},
|
205
217
|
"networkProfile": {
|
206
218
|
"networkInterfaces": [
|
@@ -210,10 +222,12 @@
|
|
210
222
|
]
|
211
223
|
},
|
212
224
|
"diagnosticsProfile": {
|
225
|
+
<%- unless use_managed_disks -%>
|
213
226
|
"bootDiagnostics": {
|
214
227
|
"enabled": "[parameters('bootDiagnosticsEnabled')]",
|
215
228
|
"storageUri": "[reference(concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName')), '2015-06-15').primaryEndpoints.blob]"
|
216
229
|
}
|
230
|
+
<%- end -%>
|
217
231
|
}
|
218
232
|
},
|
219
233
|
"tags": {
|
data/templates/public.erb
CHANGED
@@ -82,9 +82,9 @@
|
|
82
82
|
},
|
83
83
|
"bootDiagnosticsEnabled": {
|
84
84
|
"type": "string",
|
85
|
-
"defaultValue": "
|
85
|
+
"defaultValue": "false",
|
86
86
|
"metadata": {
|
87
|
-
"description": "Whether to enable (true) or disable (false) boot diagnostics. Default:
|
87
|
+
"description": "Whether to enable (true) or disable (false) boot diagnostics. Default: false."
|
88
88
|
}
|
89
89
|
}
|
90
90
|
},
|
@@ -107,6 +107,7 @@
|
|
107
107
|
"provider": "[toUpper('33194f91-eb5f-4110-827a-e95f640a9e46')]"
|
108
108
|
},
|
109
109
|
"resources": [
|
110
|
+
<%- unless use_managed_disks -%>
|
110
111
|
{
|
111
112
|
"type": "Microsoft.Storage/storageAccounts",
|
112
113
|
"name": "[parameters('newStorageAccountName')]",
|
@@ -119,6 +120,7 @@
|
|
119
120
|
"provider": "[variables('provider')]"
|
120
121
|
}
|
121
122
|
},
|
123
|
+
<%- end -%>
|
122
124
|
{
|
123
125
|
"apiVersion": "2015-05-01-preview",
|
124
126
|
"type": "Microsoft.Network/publicIPAddresses",
|
@@ -188,12 +190,14 @@
|
|
188
190
|
}
|
189
191
|
},
|
190
192
|
{
|
191
|
-
"apiVersion": "
|
193
|
+
"apiVersion": "2016-04-30-preview",
|
192
194
|
"type": "Microsoft.Compute/virtualMachines",
|
193
195
|
"name": "[variables('vmName')]",
|
194
196
|
"location": "[variables('location')]",
|
195
197
|
"dependsOn": [
|
198
|
+
<%- unless use_managed_disks -%>
|
196
199
|
"[concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName'))]",
|
200
|
+
<%- end -%>
|
197
201
|
"[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
198
202
|
],
|
199
203
|
"properties": {
|
@@ -212,6 +216,7 @@
|
|
212
216
|
"sku": "[parameters('imageSku')]",
|
213
217
|
"version": "[parameters('imageVersion')]"
|
214
218
|
},
|
219
|
+
<%- unless use_managed_disks -%>
|
215
220
|
"osDisk": {
|
216
221
|
"name": "osdisk",
|
217
222
|
"vhd": {
|
@@ -220,6 +225,13 @@
|
|
220
225
|
"caching": "ReadWrite",
|
221
226
|
"createOption": "FromImage"
|
222
227
|
}
|
228
|
+
<%- end -%>
|
229
|
+
<%- if use_managed_disks -%>
|
230
|
+
"osDisk": {
|
231
|
+
"name": "osdisk",
|
232
|
+
"createOption": "FromImage"
|
233
|
+
}
|
234
|
+
<%- end -%>
|
223
235
|
},
|
224
236
|
"networkProfile": {
|
225
237
|
"networkInterfaces": [
|
@@ -229,10 +241,12 @@
|
|
229
241
|
]
|
230
242
|
},
|
231
243
|
"diagnosticsProfile": {
|
244
|
+
<%- unless use_managed_disks -%>
|
232
245
|
"bootDiagnostics": {
|
233
246
|
"enabled": "[parameters('bootDiagnosticsEnabled')]",
|
234
247
|
"storageUri": "[reference(concat('Microsoft.Storage/storageAccounts/', parameters('newStorageAccountName')), '2015-06-15').primaryEndpoints.blob]"
|
235
248
|
}
|
249
|
+
<%- end -%>
|
236
250
|
}
|
237
251
|
},
|
238
252
|
"tags": {
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kitchen-azurerm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stuart Preston
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: inifile
|