From 942924a19a7cbe99ec241bb41608ec2c790cee20 Mon Sep 17 00:00:00 2001 From: Bill Peck Date: Fri, 10 Jan 2025 14:27:55 -0500 Subject: [PATCH] Support managed_disk_type Add support for specifying managed_disk_type. This is a prerequisite for supporting snapshots. fixes #99 --- ...0110-azure_virtual_machine_with_public_ip.yml | 2 ++ .../meta/argument_specs.yml | 16 ++++++++++++++-- .../tasks/create.yml | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 changelogs/fragments/20250110-azure_virtual_machine_with_public_ip.yml diff --git a/changelogs/fragments/20250110-azure_virtual_machine_with_public_ip.yml b/changelogs/fragments/20250110-azure_virtual_machine_with_public_ip.yml new file mode 100644 index 0000000..9eaa87f --- /dev/null +++ b/changelogs/fragments/20250110-azure_virtual_machine_with_public_ip.yml @@ -0,0 +1,2 @@ +bugfixes: + - Adding managed_disk_type as possible option in role azure_virtual_machine_with_public_ip diff --git a/roles/azure_virtual_machine_with_public_ip/meta/argument_specs.yml b/roles/azure_virtual_machine_with_public_ip/meta/argument_specs.yml index cb25873..564aa03 100644 --- a/roles/azure_virtual_machine_with_public_ip/meta/argument_specs.yml +++ b/roles/azure_virtual_machine_with_public_ip/meta/argument_specs.yml @@ -70,6 +70,20 @@ argument_specs: - The image used to build the VM. For custom images, the name of the image. To narrow the search to a specific resource group, a dict with the keys name and resource_group. - For Marketplace images, a dict with the keys publisher, offer, sku, and version. - Set O(version=latest) to get the most recent version of a given image. + managed_disk_type: + type: "str" + description: + - Managed OS disk type. + - Create OS disk with managed disk if defined. + - If not defined, the OS disk will be created with virtual hard disk (VHD). + choices: + - "Standard_LRS" + - "StandardSSD_LRS" + - "StandardSSD_ZRS" + - "Premium_LRS" + - "Premium_ZRS" + - "UltraSSD_LRS" + required: false ssh_pw_enabled: description: Enable/disable SSH passwords. choices: ['yes', 'no'] @@ -93,8 +107,6 @@ argument_specs: description: - Initial disk size in GB for blank data disks. Cannot be larger than 1023 GB. - Can only be modified when VM is deallocated. - managed_disk_type: - description: Managed data disk type. storage_account_name: description: Name of an existing storage account that supports creation of VHD blobs. storage_blob_name: diff --git a/roles/azure_virtual_machine_with_public_ip/tasks/create.yml b/roles/azure_virtual_machine_with_public_ip/tasks/create.yml index 8a32ba5..45048e9 100644 --- a/roles/azure_virtual_machine_with_public_ip/tasks/create.yml +++ b/roles/azure_virtual_machine_with_public_ip/tasks/create.yml @@ -131,6 +131,7 @@ vm_size: "{{ azure_virtual_machine_with_public_ip_vm.size | default(omit) }}" network_interfaces: "{{ azure_virtual_machine_with_public_ip_vm.network_interfaces | default(vm_name) }}" os_type: "{{ azure_virtual_machine_with_public_ip_vm.os | default(omit) }}" + managed_disk_type: "{{ azure_virtual_machine_with_public_ip_vm.managed_disk_type | default(omit) }}" availability_set: "{{ azure_virtual_machine_with_public_ip_availability_set.name | default(omit) }}" image: "{{ azure_virtual_machine_with_public_ip_vm.image | default(omit) }}" admin_username: "{{ azure_virtual_machine_with_public_ip_vm.admin_username | default(omit) }}"