community / community.azure / 1.0.0 / module / azure_rm_manageddisk Manage Azure Manage Disks Authors: Bruno Medina (@brusMX) preview | supported by communitycommunity.azure.azure_rm_manageddisk (1.0.0) — module
Install with ansible-galaxy collection install community.azure:==1.0.0
collections: - name: community.azure version: 1.0.0
Create, update and delete an Azure Managed Disk.
- name: Create managed disk community.azure.azure_rm_manageddisk: name: mymanageddisk location: eastus resource_group: myResourceGroup disk_size_gb: 4
- name: Create managed operating system disk from page blob community.azure.azure_rm_manageddisk: name: mymanageddisk location: eastus2 resource_group: myResourceGroup create_option: import source_uri: https://storageaccountname.blob.core.windows.net/containername/blob-name.vhd os_type: windows storage_account_type: Premium_LRS
- name: Mount the managed disk to VM community.azure.azure_rm_manageddisk: name: mymanageddisk location: eastus resource_group: myResourceGroup disk_size_gb: 4 managed_by: testvm001 attach_caching: read_only
- name: Unmount the managed disk to VM community.azure.azure_rm_manageddisk: name: mymanageddisk location: eastus resource_group: myResourceGroup disk_size_gb: 4
- name: Delete managed disk community.azure.azure_rm_manageddisk: name: mymanageddisk location: eastus resource_group: myResourceGroup state: absent
lun: description: - The logical unit number for data disk. - This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. type: int name: description: - Name of the managed disk. required: true tags: description: - Tags to assign to the managed disk. - Format tags as 'key' or 'key:value'. type: dict zone: choices: - 1 - 2 - 3 - '' description: - The Azure managed disk's zone. - Allowed values are C(1), C(2), C(3) and C(' '). state: choices: - absent - present default: present description: - Assert the state of the managed disk. Use C(present) to create or update a managed disk and C(absent) to delete a managed disk. secret: description: - Azure client secret. Use when authenticating with a Service Principal. type: str tenant: description: - Azure tenant ID. Use when authenticating with a Service Principal. type: str ad_user: description: - Active Directory username. Use when authenticating with an Active Directory user rather than service principal. type: str os_type: choices: - linux - windows description: - Type of Operating System. - Used when I(create_option=copy) or I(create_option=import) and the source is an OS disk. - If omitted during creation, no value is set. - If omitted during an update, no change is made. - Once set, this value cannot be cleared. profile: description: - Security profile found in ~/.azure/credentials file. type: str location: description: - Valid Azure location. Defaults to location of the resource group. log_mode: description: - Parent argument. type: str log_path: description: - Parent argument. type: str password: description: - Active Directory user password. Use when authenticating with an Active Directory user rather than service principal. type: str client_id: description: - Azure client ID. Use when authenticating with a Service Principal. type: str managed_by: description: - Name of an existing virtual machine with which the disk is or will be associated, this VM should be in the same resource group. - To detach a disk from a vm, explicitly set to ''. - If this option is unset, the value will not be changed. source_uri: aliases: - source_resource_uri description: - URI to a valid VHD file to be used or the resource ID of the managed disk to copy. thumbprint: description: - The thumbprint of the private key specified in I(x509_certificate_path). - Use when authenticating with a Service Principal. - Required if I(x509_certificate_path) is defined. type: str version_added: 1.14.0 version_added_collection: azure.azcollection api_profile: default: latest description: - Selects an API profile to use when communicating with Azure services. Default value of C(latest) is appropriate for public clouds; future values will allow use with Azure Stack. type: str version_added: 0.0.1 version_added_collection: azure.azcollection append_tags: default: true description: - Use to control if tags field is canonical or just appends to existing tags. - When canonical, any tags not found in the tags parameter will be removed from the object's metadata. type: bool auth_source: choices: - auto - cli - credential_file - env - msi default: auto description: - Controls the source of the credentials to use for authentication. - Can also be set via the C(ANSIBLE_AZURE_AUTH_SOURCE) environment variable. - When set to C(auto) (the default) the precedence is module parameters -> C(env) -> C(credential_file) -> C(cli). - When set to C(env), the credentials will be read from the environment variables - When set to C(credential_file), it will read the profile from C(~/.azure/credentials). - When set to C(cli), the credentials will be sources from the Azure CLI profile. C(subscription_id) or the environment variable C(AZURE_SUBSCRIPTION_ID) can be used to identify the subscription ID if more than one is present otherwise the default az cli subscription is used. - When set to C(msi), the host machine must be an azure resource with an enabled MSI extension. C(subscription_id) or the environment variable C(AZURE_SUBSCRIPTION_ID) can be used to identify the subscription ID if the resource is granted access to more than one subscription, otherwise the first subscription is chosen. - The C(msi) was added in Ansible 2.6. type: str version_added: 0.0.1 version_added_collection: azure.azcollection disk_size_gb: description: - Size in GB of the managed disk to be created. - If I(create_option=copy) then the value must be greater than or equal to the source's size. create_option: choices: - empty - import - copy description: - C(import) from a VHD file in I(source_uri) and C(copy) from previous managed disk I(source_uri). attach_caching: choices: - '' - read_only - read_write description: - Disk caching policy controlled by VM. Will be used when attached to the VM defined by C(managed_by). - If this option is different from the current caching policy, the managed disk will be deattached and attached with current caching option again. resource_group: description: - Name of a resource group where the managed disk exists or will be created. required: true subscription_id: description: - Your Azure subscription Id. type: str cloud_environment: default: AzureCloud description: - For cloud environments other than the US public cloud, the environment name (as defined by Azure Python SDK, eg, C(AzureChinaCloud), C(AzureUSGovernment)), or a metadata discovery endpoint URL (required for Azure Stack). Can also be set via credential file profile or the C(AZURE_CLOUD_ENVIRONMENT) environment variable. type: str version_added: 0.0.1 version_added_collection: azure.azcollection adfs_authority_url: description: - Azure AD authority url. Use when authenticating with Username/password, and has your own ADFS authority. type: str version_added: 0.0.1 version_added_collection: azure.azcollection cert_validation_mode: choices: - ignore - validate description: - Controls the certificate validation behavior for Azure endpoints. By default, all modules will validate the server certificate, but when an HTTPS proxy is in use, or against Azure Stack, it may be necessary to disable this behavior by passing C(ignore). Can also be set via credential file profile or the C(AZURE_CERT_VALIDATION) environment variable. type: str version_added: 0.0.1 version_added_collection: azure.azcollection storage_account_type: choices: - Standard_LRS - StandardSSD_LRS - Premium_LRS - UltraSSD_LRS description: - Type of storage for the managed disk. - If not specified, the disk is created as C(Standard_LRS). - C(Standard_LRS) is for Standard HDD. - C(StandardSSD_LRS) (added in 2.8) is for Standard SSD. - C(Premium_LRS) is for Premium SSD. - C(UltraSSD_LRS) (added in 2.8) is for Ultra SSD, which is in preview mode, and only available on select instance types. - See U(https://docs.microsoft.com/en-us/azure/virtual-machines/windows/disks-types) for more information about disk types. x509_certificate_path: description: - Path to the X509 certificate used to create the service principal in PEM format. - The certificate must be appended to the private key. - Use when authenticating with a Service Principal. type: path version_added: 1.14.0 version_added_collection: azure.azcollection
changed: description: - Whether or not the resource has changed. returned: always type: bool id: description: - The managed disk resource ID. returned: always type: dict state: description: - Current state of the managed disk. returned: always type: dict