knife-azure 3.0.6 → 5.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/azure/azure_interface.rb +1 -1
- data/lib/azure/custom_errors.rb +2 -2
- data/lib/azure/helpers.rb +1 -1
- data/lib/azure/resource_management/ARM_deployment_template.rb +82 -27
- data/lib/azure/resource_management/ARM_interface.rb +112 -118
- data/lib/azure/resource_management/rest/arm_client.rb +208 -0
- data/lib/azure/resource_management/rest/environments.rb +89 -0
- data/lib/azure/resource_management/rest/errors.rb +57 -0
- data/lib/azure/resource_management/rest/http.rb +335 -0
- data/lib/azure/resource_management/rest/rest_object.rb +103 -0
- data/lib/azure/resource_management/rest/secure_connection.rb +57 -0
- data/lib/azure/resource_management/rest/token_provider.rb +125 -0
- data/lib/azure/resource_management/vnet_config.rb +4 -4
- data/lib/azure/resource_management/windows_credentials.rb +3 -3
- data/lib/chef/knife/azurerm_server_create.rb +22 -10
- data/lib/chef/knife/azurerm_server_delete.rb +1 -1
- data/lib/chef/knife/azurerm_server_list.rb +1 -1
- data/lib/chef/knife/azurerm_server_show.rb +1 -1
- data/lib/chef/knife/bootstrap/bootstrapper.rb +142 -14
- data/lib/chef/knife/bootstrap/common_bootstrap_options.rb +4 -6
- data/lib/chef/knife/bootstrap_azurerm.rb +1 -1
- data/lib/chef/knife/helpers/azurerm_base.rb +170 -9
- data/lib/knife-azure/version.rb +2 -2
- metadata +37 -95
- data/lib/azure/service_management/ASM_interface.rb +0 -310
- data/lib/azure/service_management/ag.rb +0 -99
- data/lib/azure/service_management/certificate.rb +0 -235
- data/lib/azure/service_management/connection.rb +0 -102
- data/lib/azure/service_management/deploy.rb +0 -221
- data/lib/azure/service_management/disk.rb +0 -68
- data/lib/azure/service_management/host.rb +0 -184
- data/lib/azure/service_management/image.rb +0 -94
- data/lib/azure/service_management/loadbalancer.rb +0 -78
- data/lib/azure/service_management/rest.rb +0 -126
- data/lib/azure/service_management/role.rb +0 -717
- data/lib/azure/service_management/storageaccount.rb +0 -127
- data/lib/azure/service_management/utility.rb +0 -40
- data/lib/azure/service_management/vnet.rb +0 -134
- data/lib/chef/knife/azure_ag_create.rb +0 -73
- data/lib/chef/knife/azure_ag_list.rb +0 -35
- data/lib/chef/knife/azure_image_list.rb +0 -56
- data/lib/chef/knife/azure_internal-lb_create.rb +0 -74
- data/lib/chef/knife/azure_internal-lb_list.rb +0 -35
- data/lib/chef/knife/azure_server_create.rb +0 -531
- data/lib/chef/knife/azure_server_delete.rb +0 -136
- data/lib/chef/knife/azure_server_list.rb +0 -38
- data/lib/chef/knife/azure_server_show.rb +0 -41
- data/lib/chef/knife/azure_vnet_create.rb +0 -74
- data/lib/chef/knife/azure_vnet_list.rb +0 -35
- data/lib/chef/knife/bootstrap_azure.rb +0 -191
- data/lib/chef/knife/helpers/azure_base.rb +0 -392
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b2b0c8e7095b9f0880e4d35af2728b7c71119ef5fd22138cc4e5f6ad37ab467b
|
|
4
|
+
data.tar.gz: a853c153d5d15328a0026c84f91c552329e72c87dc5935c32760435f10bff6f9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 352cf2e4f22eaed979e964367e98e0e9c80a18e1b44352207f9bad659e8197a4355b4f9ff4393bd85248c5ffeceff672424902428385e17800aad36a8201600d
|
|
7
|
+
data.tar.gz: d9956696c10ce1e4c0a96d9d8d46826c8d4d8fe448778c274d1c658ac9485d136871f5843c7b952fbc92ba235ba784952a3241bc303b758ffc18af06c4d2a6fa
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright:: Copyright (c)
|
|
2
|
+
# Copyright:: Copyright (c) 2012-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
3
3
|
# License:: Apache License, Version 2.0
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
data/lib/azure/custom_errors.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#
|
|
2
|
-
# Copyright:: Copyright (c)
|
|
2
|
+
# Copyright:: Copyright (c) 2012-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
3
3
|
# License:: Apache License, Version 2.0
|
|
4
4
|
#
|
|
5
5
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -29,6 +29,6 @@ module CustomErrors
|
|
|
29
29
|
caller.first =~ /in \`(.+)\'/
|
|
30
30
|
method_name = $1
|
|
31
31
|
raise CustomErrors::InterfaceNotImplementedError.new("#{klass.class.name} needs to implement '#{method_name}' for interface #{name}!")
|
|
32
|
-
|
|
32
|
+
end
|
|
33
33
|
end
|
|
34
34
|
end
|
data/lib/azure/helpers.rb
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: vasundhara.jagdale@clogeny.com
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) 2012-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#
|
|
2
2
|
# Author:: Nimisha Sharad (nimisha.sharad@clogeny.com)
|
|
3
|
-
# Copyright:: Copyright (c)
|
|
3
|
+
# Copyright:: Copyright (c) 2012-2026 Progress Software Corporation and/or its subsidiaries or affiliates. All Rights Reserved.
|
|
4
4
|
# License:: Apache License, Version 2.0
|
|
5
5
|
#
|
|
6
6
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -51,7 +51,7 @@ module Azure::ARM
|
|
|
51
51
|
# Security Rule priority can be set between 100 and 4096
|
|
52
52
|
rule_no = 300
|
|
53
53
|
incremental = 0
|
|
54
|
-
|
|
54
|
+
tcp_ports.each do |port|
|
|
55
55
|
rule_no += 2
|
|
56
56
|
sec_grp_json["properties"]["securityRules"].push(
|
|
57
57
|
"name" => vm_name + "_rule_" + incremental.to_s,
|
|
@@ -94,8 +94,8 @@ module Azure::ARM
|
|
|
94
94
|
vmId = "[resourceId('Microsoft.Compute/virtualMachines', concat(variables('vmName'),copyIndex()))]"
|
|
95
95
|
depVm2 = "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'), copyIndex())]"
|
|
96
96
|
computerName = "[concat(variables('vmName'),copyIndex())]"
|
|
97
|
-
uri = "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',concat(variables('vmName'),copyIndex()),'.vhd')]"
|
|
98
97
|
netid = "[resourceId('Microsoft.Network/networkInterfaces', concat(variables('nicName'), copyIndex()))]"
|
|
98
|
+
osDiskName = "[concat(variables('OSDiskName'),copyIndex())]"
|
|
99
99
|
|
|
100
100
|
# Extension Variables
|
|
101
101
|
extName = "[concat(variables('vmName'),copyIndex(),'/', variables('vmExtensionName'))]"
|
|
@@ -117,8 +117,8 @@ module Azure::ARM
|
|
|
117
117
|
vmId = "[resourceId('Microsoft.Compute/virtualMachines', variables('vmName'))]"
|
|
118
118
|
depVm2 = "[concat('Microsoft.Network/networkInterfaces/', variables('nicName'))]"
|
|
119
119
|
computerName = "[variables('vmName')]"
|
|
120
|
-
uri = "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net/',variables('vmStorageAccountContainerName'),'/',variables('vmName'),'.vhd')]"
|
|
121
120
|
netid = "[resourceId('Microsoft.Network/networkInterfaces', variables('nicName'))]"
|
|
121
|
+
osDiskName = "[variables('OSDiskName')]"
|
|
122
122
|
|
|
123
123
|
# Extension Variables
|
|
124
124
|
extName = "[concat(variables('vmName'),'/', variables('vmExtensionName'))]"
|
|
@@ -252,12 +252,41 @@ module Azure::ARM
|
|
|
252
252
|
"description" => "Optional. Path to a client.rb file for use by the bootstrapped node.",
|
|
253
253
|
},
|
|
254
254
|
},
|
|
255
|
+
"CHEF_LICENSE" => {
|
|
256
|
+
"type" => "string",
|
|
257
|
+
"defaultValue" => "accept-no-persist",
|
|
258
|
+
"metadata" => {
|
|
259
|
+
"description" => "Optional. Chef Infra license acceptance value read and exported as an " \
|
|
260
|
+
"environment variable by the VM extension's own bootstrap script, so it also covers " \
|
|
261
|
+
"the extension's separate chef-apply cron-setup step (which does not read client_rb).",
|
|
262
|
+
},
|
|
263
|
+
},
|
|
255
264
|
"bootstrap_version" => {
|
|
256
265
|
"type" => "string",
|
|
257
266
|
"metadata" => {
|
|
258
267
|
"description" => "Optional. The version of Chef to install.",
|
|
259
268
|
},
|
|
260
269
|
},
|
|
270
|
+
"chef_license_key" => {
|
|
271
|
+
# securestring keeps this out of ARM deployment history/logs and the
|
|
272
|
+
# Azure Portal's deployment "Inputs" view (same treatment as
|
|
273
|
+
# adminPassword above). Per chef-partners/azure-chef-extension#413
|
|
274
|
+
# (version 1210.15.11.1, rolled out to all regions for both
|
|
275
|
+
# ChefClient and LinuxChefClient), the VM extension's install
|
|
276
|
+
# scripts now decrypt protectedSettings for this value and prefer
|
|
277
|
+
# it over the deprecated publicSettings location, so it is
|
|
278
|
+
# forwarded via the "protectedSettings" block below instead of
|
|
279
|
+
# plain "settings" - delivered to the VM CMS/PKCS7-encrypted and
|
|
280
|
+
# decrypted locally, the same treatment already given to
|
|
281
|
+
# validation_key/chef_server_crt/encrypted_data_bag_secret.
|
|
282
|
+
"type" => "securestring",
|
|
283
|
+
"metadata" => {
|
|
284
|
+
"description" => "Optional. Chef/Progress license key, forwarded to the VM extension's " \
|
|
285
|
+
"install.sh as chef_license_key so it can download Chef Infra Client from the licensed " \
|
|
286
|
+
"endpoints. When omitted, the extension falls back to the unlicensed omnitruck.chef.io " \
|
|
287
|
+
"download host with a warning.",
|
|
288
|
+
},
|
|
289
|
+
},
|
|
261
290
|
"custom_json_attr" => {
|
|
262
291
|
"type" => "string",
|
|
263
292
|
"metadata" => {
|
|
@@ -302,7 +331,6 @@ module Azure::ARM
|
|
|
302
331
|
},
|
|
303
332
|
},
|
|
304
333
|
"variables" => {
|
|
305
|
-
"storageAccountName" => "[concat(uniquestring(resourceGroup().id), '#{params[:azure_storage_account]}')]",
|
|
306
334
|
"imagePublisher" => "#{params[:azure_image_reference_publisher]}",
|
|
307
335
|
"imageOffer" => "#{params[:azure_image_reference_offer]}",
|
|
308
336
|
"OSDiskName" => "#{params[:azure_os_disk_name]}",
|
|
@@ -311,7 +339,6 @@ module Azure::ARM
|
|
|
311
339
|
"storageAccountType" => "#{params[:azure_storage_account_type]}",
|
|
312
340
|
"publicIPAddressName" => "#{params[:azure_vm_name]}",
|
|
313
341
|
"publicIPAddressType" => "Dynamic",
|
|
314
|
-
"vmStorageAccountContainerName" => "#{params[:azure_vm_name]}",
|
|
315
342
|
"vmName" => "#{params[:azure_vm_name]}",
|
|
316
343
|
"vmSize" => "#{params[:vm_size]}",
|
|
317
344
|
"virtualNetworkName" => "#{params[:vnet_config][:virtualNetworkName]}",
|
|
@@ -323,15 +350,12 @@ module Azure::ARM
|
|
|
323
350
|
"sshKeyPath" => "[concat('/home/',parameters('adminUserName'),'/.ssh/authorized_keys')]",
|
|
324
351
|
},
|
|
325
352
|
"resources" => [
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
"accountType" => "[variables('storageAccountType')]",
|
|
333
|
-
},
|
|
334
|
-
},
|
|
353
|
+
# NOTE: Managed disks are used for the OS disk below, so no separate
|
|
354
|
+
# Microsoft.Storage/storageAccounts resource is created here. Existing
|
|
355
|
+
# deployments created with an unmanaged-disk storage account continue to
|
|
356
|
+
# function as-is; this only affects new VM deployments. See Azure's
|
|
357
|
+
# migration guide if you want to move existing VMs to managed disks:
|
|
358
|
+
# https://docs.microsoft.com/en-us/azure/virtual-machines/windows/convert-unmanaged-to-managed-disks
|
|
335
359
|
{
|
|
336
360
|
"apiVersion" => "[variables('apiVersion')]",
|
|
337
361
|
"type" => "Microsoft.Network/publicIPAddresses",
|
|
@@ -391,7 +415,15 @@ module Azure::ARM
|
|
|
391
415
|
},
|
|
392
416
|
},
|
|
393
417
|
{
|
|
394
|
-
|
|
418
|
+
# NOTE: apiVersion "2020-12-01" is required, not just for managed disk
|
|
419
|
+
# support and managed boot diagnostics (both available since
|
|
420
|
+
# "2020-06-01", using Azure's managed-storage boot diagnostics instead
|
|
421
|
+
# of the storage account this template no longer creates), but also
|
|
422
|
+
# for the StandardSSD_ZRS/Premium_ZRS managed disk SKUs accepted by
|
|
423
|
+
# --azure-storage-account-type, which older API versions reject at
|
|
424
|
+
# deployment time. Don't switch this back to an older apiVersion
|
|
425
|
+
# without re-verifying managed disk, ZRS, and boot diagnostics support.
|
|
426
|
+
"apiVersion" => "2020-12-01",
|
|
395
427
|
"type" => "Microsoft.Compute/virtualMachines",
|
|
396
428
|
"name" => vmName,
|
|
397
429
|
"location" => "[resourceGroup().location]",
|
|
@@ -400,7 +432,6 @@ module Azure::ARM
|
|
|
400
432
|
"count" => "[parameters('numberOfInstances')]",
|
|
401
433
|
},
|
|
402
434
|
"dependsOn" => [
|
|
403
|
-
"[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]",
|
|
404
435
|
depVm2,
|
|
405
436
|
],
|
|
406
437
|
"properties" => {
|
|
@@ -430,12 +461,12 @@ module Azure::ARM
|
|
|
430
461
|
"version" => "[parameters('imageVersion')]",
|
|
431
462
|
},
|
|
432
463
|
"osDisk" => {
|
|
433
|
-
"name" =>
|
|
434
|
-
"vhd" => {
|
|
435
|
-
"uri" => uri,
|
|
436
|
-
},
|
|
464
|
+
"name" => osDiskName,
|
|
437
465
|
"caching" => "ReadWrite",
|
|
438
466
|
"createOption" => "FromImage",
|
|
467
|
+
"managedDisk" => {
|
|
468
|
+
"storageAccountType" => "[variables('storageAccountType')]",
|
|
469
|
+
},
|
|
439
470
|
},
|
|
440
471
|
},
|
|
441
472
|
"networkProfile" => {
|
|
@@ -447,8 +478,11 @@ module Azure::ARM
|
|
|
447
478
|
},
|
|
448
479
|
"diagnosticsProfile" => {
|
|
449
480
|
"bootDiagnostics" => {
|
|
481
|
+
# Managed boot diagnostics: no storageUri is provided (or needed)
|
|
482
|
+
# since apiVersion 2020-12-01+ provisions Azure-managed storage
|
|
483
|
+
# for boot diagnostics automatically, instead of the storage
|
|
484
|
+
# account this template no longer creates.
|
|
450
485
|
"enabled" => "true",
|
|
451
|
-
"storageUri" => "[concat('http://',variables('storageAccountName'),'.blob.core.windows.net')]",
|
|
452
486
|
},
|
|
453
487
|
},
|
|
454
488
|
},
|
|
@@ -486,11 +520,17 @@ module Azure::ARM
|
|
|
486
520
|
"hints" => hints_json,
|
|
487
521
|
"client_rb" => "[parameters('client_rb')]",
|
|
488
522
|
"custom_json_attr" => "[parameters('custom_json_attr')]",
|
|
523
|
+
"CHEF_LICENSE" => "[parameters('CHEF_LICENSE')]",
|
|
489
524
|
},
|
|
490
525
|
"protectedSettings" => {
|
|
491
526
|
"validation_key" => "[parameters('validation_key')]",
|
|
492
527
|
"chef_server_crt" => "[parameters('chef_server_crt')]",
|
|
493
528
|
"encrypted_data_bag_secret" => "[parameters('encrypted_data_bag_secret')]",
|
|
529
|
+
# Per chef-partners/azure-chef-extension#413 (version
|
|
530
|
+
# 1210.15.11.1, rolled out to all regions), the extension's
|
|
531
|
+
# install scripts decrypt this from protectedSettings and
|
|
532
|
+
# prefer it over the deprecated publicSettings location.
|
|
533
|
+
"chef_license_key" => "[parameters('chef_license_key')]",
|
|
494
534
|
},
|
|
495
535
|
},
|
|
496
536
|
},
|
|
@@ -501,8 +541,17 @@ module Azure::ARM
|
|
|
501
541
|
set_val = {
|
|
502
542
|
"name" => "[parameters('availabilitySetName')]",
|
|
503
543
|
"type" => "Microsoft.Compute/availabilitySets",
|
|
504
|
-
|
|
544
|
+
# NOTE: variables('apiVersion') ("2015-06-15") is intentionally not used
|
|
545
|
+
# here. That old API version (and the absence of an explicit "Aligned"
|
|
546
|
+
# sku) creates a classic (unmanaged-disk-only) availability set, which
|
|
547
|
+
# Azure rejects VMs with managed OS disks from joining. Managed-disk
|
|
548
|
+
# compatible ("Aligned") availability sets require apiVersion
|
|
549
|
+
# 2016-04-30-preview or later plus this explicit sku.
|
|
550
|
+
"apiVersion" => "2020-12-01",
|
|
505
551
|
"location" => "[resourceGroup().location]",
|
|
552
|
+
"sku" => {
|
|
553
|
+
"name" => "Aligned",
|
|
554
|
+
},
|
|
506
555
|
"properties" => {
|
|
507
556
|
"platformFaultDomainCount" => "[parameters('availabilitySetPlatformFaultDomainCount')]",
|
|
508
557
|
"platformUpdateDomainCount" => "[parameters('availabilitySetPlatformUpdateDomainCount')]",
|
|
@@ -510,7 +559,7 @@ module Azure::ARM
|
|
|
510
559
|
}
|
|
511
560
|
|
|
512
561
|
length = template["resources"].length.to_i - 1
|
|
513
|
-
|
|
562
|
+
(0..length).each do |i|
|
|
514
563
|
if template["resources"][i]["type"] == "Microsoft.Compute/virtualMachines"
|
|
515
564
|
template["resources"][i]["dependsOn"] << "[concat('Microsoft.Compute/availabilitySets/', parameters('availabilitySetName'))]"
|
|
516
565
|
template["resources"][i]["properties"]["availabilitySet"] = { "id" => "[resourceId('Microsoft.Compute/availabilitySets', parameters('availabilitySetName'))]" }
|
|
@@ -523,7 +572,7 @@ module Azure::ARM
|
|
|
523
572
|
sec_grp_json = tcp_ports(params[:tcp_endpoints], params[:azure_vm_name])
|
|
524
573
|
template["resources"].insert(1, sec_grp_json)
|
|
525
574
|
length = template["resources"].length.to_i - 1
|
|
526
|
-
|
|
575
|
+
(0..length).each do |i|
|
|
527
576
|
if template["resources"][i]["type"] == "Microsoft.Network/virtualNetworks"
|
|
528
577
|
template["resources"][i] = template["resources"][i].merge({ "dependsOn" => [sec_grp] })
|
|
529
578
|
end
|
|
@@ -558,7 +607,7 @@ module Azure::ARM
|
|
|
558
607
|
end
|
|
559
608
|
if params[:server_count].to_i > 1 && params[:chef_extension_private_param][:validation_key].nil?
|
|
560
609
|
template["resources"].last["properties"]["protectedSettings"]["client_pem"] = "[parameters(concat('client_pem',copyIndex()))]"
|
|
561
|
-
0.upto
|
|
610
|
+
0.upto(params[:server_count].to_i - 1) do |count|
|
|
562
611
|
template["parameters"]["client_pem" + count.to_s] = {
|
|
563
612
|
"type" => "string",
|
|
564
613
|
"metadata" => {
|
|
@@ -644,6 +693,12 @@ module Azure::ARM
|
|
|
644
693
|
"client_rb" => {
|
|
645
694
|
"value" => "#{params[:chef_extension_public_param][:client_rb]}",
|
|
646
695
|
},
|
|
696
|
+
"CHEF_LICENSE" => {
|
|
697
|
+
"value" => "#{params[:chef_extension_public_param][:CHEF_LICENSE]}",
|
|
698
|
+
},
|
|
699
|
+
"chef_license_key" => {
|
|
700
|
+
"value" => "#{params[:chef_extension_private_param][:chef_license_key]}",
|
|
701
|
+
},
|
|
647
702
|
"bootstrap_version" => {
|
|
648
703
|
"value" => "#{params[:chef_extension_public_param][:bootstrap_options][:bootstrap_version]}",
|
|
649
704
|
},
|
|
@@ -658,7 +713,7 @@ module Azure::ARM
|
|
|
658
713
|
},
|
|
659
714
|
}
|
|
660
715
|
if params[:server_count].to_i > 1 && params[:chef_extension_private_param][:validation_key].nil?
|
|
661
|
-
0.upto
|
|
716
|
+
0.upto(params[:server_count].to_i - 1) do |count|
|
|
662
717
|
parameters["client_pem#{count}"] = {
|
|
663
718
|
"value" => "#{params[:chef_extension_private_param][("client_pem" + count.to_s).to_sym]}",
|
|
664
719
|
}
|