mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-08 06:12:51 +00:00
committed by
Matt Davis
parent
a7d372c3ba
commit
16fa49a894
@@ -144,6 +144,10 @@ options:
|
|||||||
- Standard_LRS
|
- Standard_LRS
|
||||||
- Premium_LRS
|
- Premium_LRS
|
||||||
version_added: "2.4"
|
version_added: "2.4"
|
||||||
|
os_disk_name:
|
||||||
|
description:
|
||||||
|
- OS disk name
|
||||||
|
version_added: "2.8"
|
||||||
os_disk_caching:
|
os_disk_caching:
|
||||||
description:
|
description:
|
||||||
- Type of OS disk caching.
|
- Type of OS disk caching.
|
||||||
@@ -706,6 +710,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||||||
default='ReadOnly'),
|
default='ReadOnly'),
|
||||||
os_disk_size_gb=dict(type='int'),
|
os_disk_size_gb=dict(type='int'),
|
||||||
managed_disk_type=dict(type='str', choices=['Standard_LRS', 'Premium_LRS']),
|
managed_disk_type=dict(type='str', choices=['Standard_LRS', 'Premium_LRS']),
|
||||||
|
os_disk_name=dict(type='str'),
|
||||||
os_type=dict(type='str', choices=['Linux', 'Windows'], default='Linux'),
|
os_type=dict(type='str', choices=['Linux', 'Windows'], default='Linux'),
|
||||||
public_ip_allocation_method=dict(type='str', choices=['Dynamic', 'Static', 'Disabled'], default='Static',
|
public_ip_allocation_method=dict(type='str', choices=['Dynamic', 'Static', 'Disabled'], default='Static',
|
||||||
aliases=['public_ip_allocation']),
|
aliases=['public_ip_allocation']),
|
||||||
@@ -743,6 +748,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||||||
self.os_disk_caching = None
|
self.os_disk_caching = None
|
||||||
self.os_disk_size_gb = None
|
self.os_disk_size_gb = None
|
||||||
self.managed_disk_type = None
|
self.managed_disk_type = None
|
||||||
|
self.os_disk_name = None
|
||||||
self.network_interface_names = None
|
self.network_interface_names = None
|
||||||
self.remove_on_absent = set()
|
self.remove_on_absent = set()
|
||||||
self.tags = None
|
self.tags = None
|
||||||
@@ -894,6 +900,13 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||||||
changed = True
|
changed = True
|
||||||
vm_dict['properties']['storageProfile']['osDisk']['caching'] = self.os_disk_caching
|
vm_dict['properties']['storageProfile']['osDisk']['caching'] = self.os_disk_caching
|
||||||
|
|
||||||
|
if self.os_disk_name and \
|
||||||
|
self.os_disk_name != vm_dict['properties']['storageProfile']['osDisk']['name']:
|
||||||
|
self.log('CHANGED: virtual machine {0} - OS disk name'.format(self.name))
|
||||||
|
differences.append('OS Disk name')
|
||||||
|
changed = True
|
||||||
|
vm_dict['properties']['storageProfile']['osDisk']['name'] = self.os_disk_name
|
||||||
|
|
||||||
if self.os_disk_size_gb and \
|
if self.os_disk_size_gb and \
|
||||||
self.os_disk_size_gb != vm_dict['properties']['storageProfile']['osDisk']['diskSizeGB']:
|
self.os_disk_size_gb != vm_dict['properties']['storageProfile']['osDisk']['diskSizeGB']:
|
||||||
self.log('CHANGED: virtual machine {0} - OS disk size '.format(self.name))
|
self.log('CHANGED: virtual machine {0} - OS disk size '.format(self.name))
|
||||||
@@ -1038,7 +1051,7 @@ class AzureRMVirtualMachine(AzureRMModuleBase):
|
|||||||
),
|
),
|
||||||
storage_profile=self.compute_models.StorageProfile(
|
storage_profile=self.compute_models.StorageProfile(
|
||||||
os_disk=self.compute_models.OSDisk(
|
os_disk=self.compute_models.OSDisk(
|
||||||
name=self.storage_blob_name,
|
name=self.os_disk_name if self.os_disk_name else self.storage_blob_name,
|
||||||
vhd=vhd,
|
vhd=vhd,
|
||||||
managed_disk=managed_disk,
|
managed_disk=managed_disk,
|
||||||
create_option=self.compute_models.DiskCreateOptionTypes.from_image,
|
create_option=self.compute_models.DiskCreateOptionTypes.from_image,
|
||||||
|
|||||||
@@ -323,6 +323,7 @@
|
|||||||
short_hostname: testvm
|
short_hostname: testvm
|
||||||
os_type: Linux
|
os_type: Linux
|
||||||
os_disk_size_gb: 64
|
os_disk_size_gb: 64
|
||||||
|
os_disk_name: testosdiskxx
|
||||||
network_interfaces: "{{ niclist }}"
|
network_interfaces: "{{ niclist }}"
|
||||||
availability_set: "{{ abs_name2 }}"
|
availability_set: "{{ abs_name2 }}"
|
||||||
image:
|
image:
|
||||||
@@ -334,6 +335,7 @@
|
|||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- azure_vm.properties.availabilitySet.id
|
- azure_vm.properties.availabilitySet.id
|
||||||
|
- azure_vm.properties.storageProfile.osDisk.name == 'testosdiskxx'
|
||||||
|
|
||||||
- name: Retrieve vms facts (filtering by name)
|
- name: Retrieve vms facts (filtering by name)
|
||||||
azure_rm_virtualmachine_facts:
|
azure_rm_virtualmachine_facts:
|
||||||
|
|||||||
Reference in New Issue
Block a user