mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-08-22 14:01:42 -07:00
Support for generalizing VMs (#49704)
This commit is contained in:
parent
aec98b6aab
commit
b89eb7a8c9
3 changed files with 60 additions and 7 deletions
|
@ -305,6 +305,9 @@ class AzureRMVirtualMachineFacts(AzureRMModuleBase):
|
|||
code = instance['statuses'][index]['code'].split('/')
|
||||
if code[0] == 'PowerState':
|
||||
power_state = code[1]
|
||||
elif code[0] == 'OSState' and code[1] == 'generalized':
|
||||
power_state = 'generalized'
|
||||
break
|
||||
|
||||
new_result = {}
|
||||
new_result['power_state'] = power_state
|
||||
|
@ -317,12 +320,17 @@ class AzureRMVirtualMachineFacts(AzureRMModuleBase):
|
|||
new_result['admin_username'] = result['properties']['osProfile']['adminUsername']
|
||||
image = result['properties']['storageProfile'].get('imageReference')
|
||||
if image is not None:
|
||||
new_result['image'] = {
|
||||
'publisher': image['publisher'],
|
||||
'sku': image['sku'],
|
||||
'offer': image['offer'],
|
||||
'version': image['version']
|
||||
}
|
||||
if image.get('publisher', None) is not None:
|
||||
new_result['image'] = {
|
||||
'publisher': image['publisher'],
|
||||
'sku': image['sku'],
|
||||
'offer': image['offer'],
|
||||
'version': image['version']
|
||||
}
|
||||
else:
|
||||
new_result['image'] = {
|
||||
'id': image.get('id', None)
|
||||
}
|
||||
|
||||
vhd = result['properties']['storageProfile']['osDisk'].get('vhd')
|
||||
if vhd is not None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue