foreman_azure_rm 2.2.4 → 2.2.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: 29c728e81ac2e3c154212c1111ce0b0fa018ebfe33ae4e449c456c3a08013dca
4
- data.tar.gz: fa67a435918ba3580f4fe0d74b493626d130b3a67d0eabf140de5103590afe09
3
+ metadata.gz: 39f6ca7eb686ea697b8c9f506303f41e545e46e2ad5aeb72fe376edb9780ee64
4
+ data.tar.gz: bfd45c748455ba48ced60736ec4682708a223e862fc726e567eeb424c27fa874
5
5
  SHA512:
6
- metadata.gz: 305ea84bed5a5fff7313fc02febfbfff7407c9b0f7588670fef97065e8c78cb2d5e34b8932ee324b3052f06d97fd6455e8d2e5890c5f8322fc6530bd12f5905b
7
- data.tar.gz: 07ed5bc2005637ba507ea057625794c082a40a19e083792b92de224318e9f477973a8c9df71cd6587af805b913a91c9f544f4527ffb5d883bcb1eac3d6701a2a
6
+ metadata.gz: cf021fdd847e111d38db05a4ace1070dd4bbaa4d03979405a424b55eb84b94da216b36883a6bc9957ba0c6041a0301e77586b687619a9ad23742dd26229d08b1
7
+ data.tar.gz: d8ff32ba98f6125b0a1200b4d93491c5735c355747aba3d5e951db72c58883879b7bab6021162f5979dda3fbac6bd325c1588881a9c000b3f1725677a8627f15
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Foreman AzureRm Plugin
2
2
 
3
3
  ## Description
4
- ```foreman_azure_rm``` adds [Microsoft Azure Resource Manager](http://azure.com/) as a compute resource for The Foreman
4
+ ```foreman_azure_rm``` adds [Microsoft Azure Resource Manager](http://azure.com/) as a Compute Resource for The Foreman
5
5
 
6
6
  * Website: [TheForeman.org](http://theforeman.org)
7
7
  * ForemanAzureRm: [Plugin manual](https://theforeman.org/plugins/foreman_azure)
@@ -11,7 +11,7 @@
11
11
 
12
12
  ### Bundle (Gem)
13
13
 
14
- Add the following to bundler.d/Gemfile.local.rb in your Foreman installation directory (/usr/share/foreman by default)
14
+ Add the following to `bundler.d/Gemfile.local.rb` in your Foreman installation directory `/usr/share/foreman`
15
15
 
16
16
  ```console
17
17
  $ gem 'foreman_azure_rm'
@@ -55,7 +55,6 @@ Then run `bundle install` from the same directory
55
55
  * VM creation
56
56
  * Provisions using Finish and User data templates from Foreman
57
57
  * Supports cloud-config provisioning
58
- * Currently supports only provisioning of Linux platforms
59
58
  * Provisioning using [Public Images](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/cli-ps-findimage)
60
59
  * Provision using custom images
61
60
  * Provision using shared image galleries
@@ -64,6 +63,7 @@ Then run `bundle install` from the same directory
64
63
  * Support to add multiple data disks/volumes (standard or premium)
65
64
  * VM Extension with Custom Script and File URIs support
66
65
  * Static or dynamic addresses on a per NIC basis
66
+ * Support for NVIDIA Drivers or CUDA on Linux and Windows
67
67
  * Limited extension support
68
68
  * Microsoft's custom script extension
69
69
  * Puppet Lab's Puppet agent extension for Windows
@@ -74,16 +74,16 @@ Go to **Infrastructure > Compute Resources** and click on "New Compute Resource"
74
74
 
75
75
  Choose the **Azure Resource Manager provider**, and fill in all the fields. You need a Subscription ID, Tenant ID, Client ID and a Client Secret which you can generate from your [Microsoft Azure subscription](https://docs.bmc.com/docs/cloudlifecyclemanagement/46/setting-up-a-tenant-id-client-id-and-client-secret-for-azure-resource-manager-provisioning-669202145.html#SettingupaTenantID,ClientID,andClientSecretforAzureResourceManagerprovisioning-SetupTenantIDPrereqPrerequisites)
76
76
 
77
- That's it. You're now ready to create and manage Azure resources in your new Azure Resource Manager compute resource. You should see something like this in the Compute Resource page:
77
+ That's it. You're now ready to create and manage Azure resources in your new Azure Resource Manager Compute Resource. You should see something like this in the Compute Resource page:
78
78
 
79
79
 
80
- ![](https://i.imgur.com/vsamP4G.png)
80
+ ![](https://i.imgur.com/yMGg3A6.png)
81
81
 
82
82
 
83
83
  ![](https://i.imgur.com/Ag9tH55.png)
84
84
 
85
85
 
86
- ![](https://i.imgur.com/fNjlFci.png)
86
+ ![](https://i.imgur.com/OKoGgUY.png)
87
87
 
88
88
 
89
89
  ## Planned Features
@@ -261,12 +261,43 @@ module ForemanAzureRm
261
261
  'commandToExecute' => args[:script_command],
262
262
  'fileUris' => args[:script_uris].split(',')
263
263
  }
264
+
265
+ extension_for_log = "#{extension.publisher}/#{extension.virtual_machine_extension_type}/#{extension.type_handler_version}"
266
+ Foreman::Logging.logger('app').info "Azure RM machine #{args[:name]}: creating #{extension_for_log} extension"
264
267
  sdk.create_or_update_vm_extensions(args[:resource_group],
265
268
  args[:vm_name],
266
269
  'ForemanCustomScript',
267
270
  extension)
268
271
  end
269
272
  end
273
+
274
+ def create_vm_nvidia_gpu_extension(region, args = {})
275
+ extension = ComputeModels::VirtualMachineExtension.new
276
+ extension.publisher = 'Microsoft.HpcCompute'
277
+ extension.type_handler_version = '1.3'
278
+ extension.auto_upgrade_minor_version = true
279
+ extension.location = region
280
+
281
+ case args[:platform]
282
+ # https://docs.microsoft.com/fr-fr/azure/virtual-machines/extensions/hpccompute-gpu-linux
283
+ when 'Linux'
284
+ extension_name = 'NvidiaGpuDriverLinux'
285
+ # https://docs.microsoft.com/fr-fr/azure/virtual-machines/extensions/hpccompute-gpu-windows
286
+ when 'Windows'
287
+ extension_name = 'NvidiaGpuDriverWindows'
288
+ else
289
+ raise RuntimeError, "Unsupported platform #{args[:platform]}"
290
+ end
291
+ extension.virtual_machine_extension_type = extension_name
292
+
293
+ extension_for_log = "#{extension.publisher}/#{extension.virtual_machine_extension_type}/#{extension.type_handler_version}"
294
+ Foreman::Logging.logger('app').info "Azure RM machine #{args[:name]}: creating #{extension_for_log} extension"
295
+ sdk.create_or_update_vm_extensions(args[:resource_group],
296
+ args[:vm_name],
297
+ extension_name,
298
+ extension)
299
+ end
300
+
270
301
  end
271
302
  end
272
303
  end
@@ -116,7 +116,8 @@ module ForemanAzureRm
116
116
  ssh_key_data: opts[:ssh_key_data],
117
117
  os_disk_caching: opts[:os_disk_caching],
118
118
  premium_os_disk: opts[:premium_os_disk],
119
- os_disk_size_gb: opts[:os_disk_size_gb]
119
+ os_disk_size_gb: opts[:os_disk_size_gb],
120
+ nvidia_gpu_extension: opts[:nvidia_gpu_extension],
120
121
  )
121
122
  if opts[:interfaces].present?
122
123
  ifaces = []
@@ -127,7 +128,16 @@ module ForemanAzureRm
127
128
 
128
129
  vols = opts.fetch(:volumes, []).map { |vols_attrs| new_volume(vols_attrs) } if opts[:volumes].present?
129
130
 
130
- AzureRmCompute.new(azure_vm: raw_vm ,sdk: sdk, resource_group: opts[:resource_group], nics: ifaces, volumes: vols, script_command: opts[:script_command], script_uris: opts[:script_uris])
131
+ AzureRmCompute.new(
132
+ azure_vm: raw_vm,
133
+ sdk: sdk,
134
+ resource_group: opts[:resource_group],
135
+ nics: ifaces,
136
+ volumes: vols,
137
+ script_command: opts[:script_command],
138
+ script_uris: opts[:script_uris],
139
+ nvidia_gpu_extension: Foreman::Cast.to_bool(opts[:nvidia_gpu_extension]),
140
+ )
131
141
  end
132
142
 
133
143
  def provided_attributes
@@ -310,11 +320,26 @@ module ForemanAzureRm
310
320
  custom_data: args[:user_data],
311
321
  script_command: args[:script_command],
312
322
  script_uris: args[:script_uris],
323
+ nvidia_gpu_extension: args[:nvidia_gpu_extension],
313
324
  )
314
325
  logger.debug "Virtual Machine #{args[:vm_name]} Created Successfully."
326
+ # request NVIDIA GPU driver and CUDA stack
327
+ if Foreman::Cast.to_bool(args[:nvidia_gpu_extension])
328
+ create_vm_nvidia_gpu_extension(region, args)
329
+ end
330
+ # as this extension may contains postinstall script, call it after others
315
331
  create_vm_extension(region, args)
316
332
  # return the vm object using azure_vm
317
- AzureRmCompute.new(azure_vm: vm, sdk: sdk, resource_group: args[:resource_group], nics: vm_nics(vm), volumes: vm_disks(vm), script_command: user_command, script_uris: args[:script_uris])
333
+ AzureRmCompute.new(
334
+ azure_vm: vm,
335
+ sdk: sdk,
336
+ resource_group: args[:resource_group],
337
+ nics: vm_nics(vm),
338
+ volumes: vm_disks(vm),
339
+ script_command: user_command,
340
+ script_uris: args[:script_uris],
341
+ nvidia_gpu_extension: Foreman::Cast.to_bool(args[:nvidia_gpu_extension]),
342
+ )
318
343
  rescue RuntimeError => e
319
344
  Foreman::Logging.exception('Unhandled AzureRm error', e)
320
345
  destroy_vm vm.id if vm
@@ -5,6 +5,7 @@ module ForemanAzureRm
5
5
  attr_accessor :resource_group
6
6
  attr_accessor :nics
7
7
  attr_accessor :script_command, :script_uris
8
+ attr_accessor :nvidia_gpu_extension
8
9
  attr_accessor :volumes
9
10
 
10
11
  delegate :name, to: :azure_vm, allow_nil: true
@@ -15,7 +16,8 @@ module ForemanAzureRm
15
16
  nics: [],
16
17
  volumes: [],
17
18
  script_command: nil,
18
- script_uris: nil)
19
+ script_uris: nil,
20
+ nvidia_gpu_extension: false)
19
21
 
20
22
  @azure_vm = azure_vm
21
23
  @sdk = sdk
@@ -24,6 +26,7 @@ module ForemanAzureRm
24
26
  @volumes ||= volumes
25
27
  @script_command ||= script_command
26
28
  @script_uris ||= script_uris
29
+ @nvidia_gpu_extension ||= nvidia_gpu_extension
27
30
  @azure_vm.hardware_profile ||= ComputeModels::HardwareProfile.new
28
31
  @azure_vm.os_profile ||= ComputeModels::OSProfile.new
29
32
  @azure_vm.os_profile.linux_configuration ||= ComputeModels::LinuxConfiguration.new
@@ -208,8 +211,24 @@ module ForemanAzureRm
208
211
  def vm_extension
209
212
  return nil unless @azure_vm.resources
210
213
  @vm_extension ||= begin
211
- ext_name = @azure_vm.resources.first.id.split('/')[-1]
212
- sdk.get_vm_extension(@azure_vm.resource_group, name, ext_name)
214
+ @azure_vm.resources.each do |ext|
215
+ ext_name = ext.id.split('/')[-1]
216
+ next unless ext_name == 'ForemanCustomScript'
217
+ return sdk.get_vm_extension(@azure_vm.resource_group, name, ext_name)
218
+ end
219
+ nil
220
+ end
221
+ end
222
+
223
+ def vm_nvidia_gpu_extension
224
+ return nil unless @azure_vm.resources
225
+ @vm_nvidia_gpu_extension ||= begin
226
+ @azure_vm.resources.each do |ext|
227
+ ext_name = ext.id.split('/')[-1]
228
+ next unless ['NvidiaGpuDriverLinux', 'NvidiaGpuDriverWindows'].include? ext_name
229
+ return sdk.get_vm_extension(@azure_vm.resource_group, name, ext_name)
230
+ end
231
+ nil
213
232
  end
214
233
  end
215
234
 
@@ -219,7 +238,7 @@ module ForemanAzureRm
219
238
  # Index is based on script_command that is being injected
220
239
  # from the code in #create_vm. It can be partly hard-coded
221
240
  # since the command shall no change frequently.
222
- if ssh_key_data.nil?
241
+ if ssh_key_data.nil? && platform == 'Linux'
223
242
  user_cmd_index = (vm_extension.settings["commandToExecute"].index("-c"))+ 4
224
243
  script_command = vm_extension.settings["commandToExecute"][user_cmd_index..-2]
225
244
  else
@@ -238,5 +257,14 @@ module ForemanAzureRm
238
257
  @script_uris
239
258
  end
240
259
  end
260
+
261
+ def nvidia_gpu_extension
262
+ if vm_nvidia_gpu_extension.present?
263
+ true
264
+ else
265
+ @nvidia_gpu_extension
266
+ end
267
+ end
268
+
241
269
  end
242
270
  end
@@ -185,6 +185,16 @@
185
185
  }
186
186
  %>
187
187
 
188
+ <%= checkbox_f f, :nvidia_gpu_extension,
189
+ {
190
+ :label => _('NVIDIA driver / CUDA'),
191
+ :label_size => "col-md-2",
192
+ :label_help => _("Deploy NVIDIA GPU driver and CUDA (Azure Extension Microsoft.HpcCompute/NvidiaGpuDriver{Linux,Windows}/1.3)"),
193
+ },
194
+ 'true',
195
+ 'false'
196
+ %>
197
+
188
198
  <div id="image_selection">
189
199
  <%= select_f f, :image_id, images, :uuid, :name,
190
200
  { :include_blank => (images.empty? or images.size == 1) ? false : _('Please select an image') },
@@ -1,3 +1,3 @@
1
1
  module ForemanAzureRm
2
- VERSION = '2.2.4'.freeze
2
+ VERSION = '2.2.5'.freeze
3
3
  end
@@ -22,6 +22,9 @@ msgstr ""
22
22
  msgid "%{vm_size} VM Size"
23
23
  msgstr ""
24
24
 
25
+ msgid "Abstract async task"
26
+ msgstr ""
27
+
25
28
  msgid "Action with sub plans"
26
29
  msgstr ""
27
30
 
@@ -31,6 +34,18 @@ msgstr "Accions"
31
34
  msgid "Additional number of disks can be added based on VM Size. For more details, please refer to Microsoft Azure's documentation"
32
35
  msgstr ""
33
36
 
37
+ msgid "Agent action"
38
+ msgstr ""
39
+
40
+ msgid "Attach subscriptions"
41
+ msgstr ""
42
+
43
+ msgid "Auto attach subscriptions"
44
+ msgstr ""
45
+
46
+ msgid "Azure Image Name"
47
+ msgstr ""
48
+
34
49
  msgid "Azure Region"
35
50
  msgstr ""
36
51
 
@@ -46,6 +61,9 @@ msgstr ""
46
61
  msgid "Azure's default"
47
62
  msgstr ""
48
63
 
64
+ msgid "Bulk generate applicability for hosts"
65
+ msgstr ""
66
+
49
67
  msgid "Client ID"
50
68
  msgstr ""
51
69
 
@@ -58,9 +76,30 @@ msgstr ""
58
76
  msgid "Client Secret for AzureRm"
59
77
  msgstr ""
60
78
 
79
+ msgid "Cloud"
80
+ msgstr ""
81
+
82
+ msgid "Combined Profile Update"
83
+ msgstr ""
84
+
61
85
  msgid "Comma seperated file URIs"
62
86
  msgstr ""
63
87
 
88
+ msgid "Copy version units to library"
89
+ msgstr ""
90
+
91
+ msgid "Create"
92
+ msgstr ""
93
+
94
+ msgid "Create Export History"
95
+ msgstr ""
96
+
97
+ msgid "Create Import History"
98
+ msgstr ""
99
+
100
+ msgid "Create Package Group"
101
+ msgstr ""
102
+
64
103
  msgid "Custom Script Command"
65
104
  msgstr ""
66
105
 
@@ -70,25 +109,121 @@ msgstr ""
70
109
  msgid "Default ReadWrite"
71
110
  msgstr ""
72
111
 
112
+ msgid "Delete"
113
+ msgstr ""
114
+
115
+ msgid "Delete Activation Key"
116
+ msgstr ""
117
+
118
+ msgid "Delete Lifecycle Environment"
119
+ msgstr ""
120
+
121
+ msgid "Delete Package Group"
122
+ msgstr ""
123
+
124
+ msgid "Delete Product"
125
+ msgstr ""
126
+
127
+ msgid "Deploy NVIDIA GPU driver and CUDA (Azure Extension Microsoft.HpcCompute/NvidiaGpuDriver{Linux,Windows}/1.3)"
128
+ msgstr ""
129
+
130
+ msgid "Destroy"
131
+ msgstr ""
132
+
133
+ msgid "Destroy Content Host"
134
+ msgstr ""
135
+
136
+ msgid "Disable"
137
+ msgstr ""
138
+
139
+ msgid "Discover"
140
+ msgstr ""
141
+
73
142
  msgid "Does this image support user data input?"
74
143
  msgstr "La imatge admet l'entrada de dades d'usuari?"
75
144
 
145
+ msgid "Enable"
146
+ msgstr ""
147
+
148
+ msgid "Errata mail"
149
+ msgstr ""
150
+
151
+ msgid "Export"
152
+ msgstr ""
153
+
154
+ msgid "Export Library"
155
+ msgstr ""
156
+
157
+ msgid "Fetch pxe files"
158
+ msgstr ""
159
+
160
+ msgid "Filtered index content"
161
+ msgstr ""
162
+
163
+ msgid "For custom or shared gallery image, use prefix 'custom://' or 'gallery://'. For public and RHEL-byos images, prefix the uuid with 'marketplace://'. (e.g. 'marketplace://OpenLogic:CentOS:7.5:latest' or 'custom://image-name')"
164
+ msgstr ""
165
+
166
+ msgid "Generate host applicability"
167
+ msgstr ""
168
+
169
+ msgid "Generate repository applicability"
170
+ msgstr ""
171
+
172
+ msgid "Hypervisors"
173
+ msgstr ""
174
+
175
+ msgid "Hypervisors update"
176
+ msgstr ""
177
+
76
178
  msgid "Image"
77
179
  msgstr "Imatge"
78
180
 
181
+ msgid "Import"
182
+ msgstr ""
183
+
184
+ msgid "Import Content View Version"
185
+ msgstr ""
186
+
187
+ msgid "Import Default Content View"
188
+ msgstr ""
189
+
79
190
  msgid "Import Puppet classes"
80
191
  msgstr ""
81
192
 
82
193
  msgid "Import facts"
83
194
  msgstr ""
84
195
 
85
- msgid "Load Regions"
196
+ msgid "Incremental Update"
197
+ msgstr ""
198
+
199
+ msgid "Incremental Update of Content View Version(s) "
86
200
  msgstr ""
87
201
 
88
- msgid "Marketplace Image URN"
202
+ msgid "Index content"
89
203
  msgstr ""
90
204
 
91
- msgid "Marketplace URN (e.g. OpenLogic:CentOS:7.5:latest)"
205
+ msgid "Index errata"
206
+ msgstr ""
207
+
208
+ msgid "Index module streams"
209
+ msgstr ""
210
+
211
+ msgid "Index package groups"
212
+ msgstr ""
213
+
214
+ msgid "Install Applicable Errata"
215
+ msgstr ""
216
+
217
+ msgid "Instance update"
218
+ msgstr ""
219
+
220
+ msgid "Leave empty to use default image size"
221
+ msgstr ""
222
+
223
+ msgid "Load Regions"
224
+ msgstr ""
225
+
226
+ msgid "NVIDIA driver / CUDA"
92
227
  msgstr ""
93
228
 
94
229
  msgid "Name"
@@ -97,6 +232,12 @@ msgstr "Nom"
97
232
  msgid "OS Disk Caching"
98
233
  msgstr ""
99
234
 
235
+ msgid "Override OS Disk Size (GB)"
236
+ msgstr ""
237
+
238
+ msgid "Package Profile Update"
239
+ msgstr ""
240
+
100
241
  msgid "Password"
101
242
  msgstr "Contrasenya"
102
243
 
@@ -118,24 +259,66 @@ msgstr "Si us plau, seleccioneu una imatge"
118
259
  msgid "Premium OS Disk"
119
260
  msgstr ""
120
261
 
262
+ msgid "Product Create"
263
+ msgstr ""
264
+
265
+ msgid "Promote"
266
+ msgstr ""
267
+
268
+ msgid "Promotion to Environment"
269
+ msgstr ""
270
+
121
271
  msgid "Properties"
122
272
  msgstr "Propietats"
123
273
 
124
274
  msgid "Public IP"
125
275
  msgstr ""
126
276
 
277
+ msgid "Publish"
278
+ msgstr ""
279
+
280
+ msgid "Publish Lifecycle Environment Repositories"
281
+ msgstr ""
282
+
127
283
  msgid "Region"
128
284
  msgstr "Regió"
129
285
 
286
+ msgid "Reindex subscriptions"
287
+ msgstr ""
288
+
130
289
  msgid "Reload Images, Sizes, vNets"
131
290
  msgstr ""
132
291
 
133
292
  msgid "Remote action:"
134
293
  msgstr ""
135
294
 
295
+ msgid "Remove Content"
296
+ msgstr ""
297
+
298
+ msgid "Remove Version"
299
+ msgstr ""
300
+
301
+ msgid "Remove Versions and Associations"
302
+ msgstr ""
303
+
304
+ msgid "Remove from Environment"
305
+ msgstr ""
306
+
307
+ msgid "Remove subscriptions"
308
+ msgstr ""
309
+
310
+ msgid "Report"
311
+ msgstr ""
312
+
313
+ msgid "Republish Version Repositories"
314
+ msgstr ""
315
+
136
316
  msgid "Resource Group"
137
317
  msgstr ""
138
318
 
319
+ msgid "Run Sync Plan:"
320
+ msgstr ""
321
+
139
322
  msgid "SSH Key"
140
323
  msgstr ""
141
324
 
@@ -160,6 +343,15 @@ msgstr "ID de subscripció"
160
343
  msgid "Subscription ID for AzureRm"
161
344
  msgstr ""
162
345
 
346
+ msgid "Sync capsule"
347
+ msgstr ""
348
+
349
+ msgid "Synchronize"
350
+ msgstr ""
351
+
352
+ msgid "Synchronize smart proxy"
353
+ msgstr ""
354
+
163
355
  msgid "Tenant ID"
164
356
  msgstr ""
165
357
 
@@ -178,8 +370,44 @@ msgstr ""
178
370
  msgid "To perform commands as root, prefix it with 'sudo'"
179
371
  msgstr ""
180
372
 
373
+ msgid "Update"
374
+ msgstr ""
375
+
376
+ msgid "Update Content Overrides"
377
+ msgstr ""
378
+
379
+ msgid "Update content urls"
380
+ msgstr ""
381
+
382
+ msgid "Update for host"
383
+ msgstr ""
384
+
385
+ msgid "Update http proxy"
386
+ msgstr ""
387
+
388
+ msgid "Update http proxy details"
389
+ msgstr ""
390
+
391
+ msgid "Update redhat repository"
392
+ msgstr ""
393
+
394
+ msgid "Update release version for host"
395
+ msgstr ""
396
+
397
+ msgid "Updating System Purpose for host"
398
+ msgstr ""
399
+
400
+ msgid "Upload errata into"
401
+ msgstr ""
402
+
403
+ msgid "Upload into"
404
+ msgstr ""
405
+
181
406
  msgid "Username"
182
407
  msgstr "Nom d'usuari"
183
408
 
184
409
  msgid "VM Size"
185
410
  msgstr ""
411
+
412
+ msgid "Verify checksum"
413
+ msgstr ""