mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 05:42:50 +00:00
Update azure_rm_managed_disk.py --add zones (#53788)
This commit is contained in:
@@ -93,6 +93,15 @@ options:
|
||||
tags:
|
||||
description:
|
||||
- Tags to assign to the managed disk.
|
||||
zone:
|
||||
description:
|
||||
- "Allowed values: 1, 2, 3, ''."
|
||||
choices:
|
||||
- 1
|
||||
- 2
|
||||
- 3
|
||||
- ''
|
||||
version_added: "2.8"
|
||||
|
||||
extends_documentation_fragment:
|
||||
- azure
|
||||
@@ -182,7 +191,8 @@ def managed_disk_to_dict(managed_disk):
|
||||
disk_size_gb=managed_disk.disk_size_gb,
|
||||
os_type=managed_disk.os_type.lower() if managed_disk.os_type else None,
|
||||
storage_account_type=managed_disk.sku.name if managed_disk.sku else None,
|
||||
managed_by=managed_disk.managed_by
|
||||
managed_by=managed_disk.managed_by,
|
||||
zone=managed_disk.zones[0] if managed_disk.zones and len(managed_disk.zones) > 0 else ''
|
||||
)
|
||||
|
||||
|
||||
@@ -228,6 +238,10 @@ class AzureRMManagedDisk(AzureRMModuleBase):
|
||||
),
|
||||
managed_by=dict(
|
||||
type='str'
|
||||
),
|
||||
zone=dict(
|
||||
type='str',
|
||||
choices=['', '1', '2', '3']
|
||||
)
|
||||
)
|
||||
required_if = [
|
||||
@@ -248,6 +262,7 @@ class AzureRMManagedDisk(AzureRMModuleBase):
|
||||
self.os_type = None
|
||||
self.disk_size_gb = None
|
||||
self.tags = None
|
||||
self.zone = None
|
||||
self.managed_by = None
|
||||
super(AzureRMManagedDisk, self).__init__(
|
||||
derived_arg_spec=self.module_arg_spec,
|
||||
@@ -338,11 +353,13 @@ class AzureRMManagedDisk(AzureRMModuleBase):
|
||||
self.fail("Error getting virtual machine {0} - {1}".format(name, str(exc)))
|
||||
|
||||
def generate_managed_disk_property(self):
|
||||
# TODO: Add support for EncryptionSettings, DiskIOPSReadWrite, DiskMBpsReadWrite, Zones
|
||||
# TODO: Add support for EncryptionSettings, DiskIOPSReadWrite, DiskMBpsReadWrite
|
||||
disk_params = {}
|
||||
creation_data = {}
|
||||
disk_params['location'] = self.location
|
||||
disk_params['tags'] = self.tags
|
||||
if self.zone:
|
||||
disk_params['zones'] = [self.zone]
|
||||
if self.storage_account_type:
|
||||
storage_account_type = self.compute_models.DiskSku(name=self.storage_account_type)
|
||||
disk_params['sku'] = storage_account_type
|
||||
@@ -393,6 +410,9 @@ class AzureRMManagedDisk(AzureRMModuleBase):
|
||||
if new_disk.get('tags') is not None:
|
||||
if not found_disk['tags'] == new_disk['tags']:
|
||||
resp = True
|
||||
if self.zone is not None:
|
||||
if not found_disk['zone'] == self.zone:
|
||||
resp = True
|
||||
return resp
|
||||
|
||||
def delete_managed_disk(self):
|
||||
|
||||
Reference in New Issue
Block a user