From aeb72dfb063cb732846f3e980e06006ca220ec8b Mon Sep 17 00:00:00 2001 From: Fred-sun <37327967+Fred-sun@users.noreply.github.com> Date: Fri, 14 Jun 2019 10:13:32 -0400 Subject: [PATCH] Update azure_rm_resource related document (#57786) * Update azure_rm_resource related document * resolve shippable check error * Resolve format error * resolve format error---02 * Redefine the type variable --- .../modules/cloud/azure/azure_rm_resource.py | 248 +++++++++++----- .../cloud/azure/azure_rm_resource_facts.py | 265 +++++++++++++++--- 2 files changed, 399 insertions(+), 114 deletions(-) diff --git a/lib/ansible/modules/cloud/azure/azure_rm_resource.py b/lib/ansible/modules/cloud/azure/azure_rm_resource.py index 4407a63c200..75aa0b3faec 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_resource.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_resource.py @@ -17,91 +17,98 @@ DOCUMENTATION = ''' --- module: azure_rm_resource version_added: "2.6" -short_description: Create any Azure resource. +short_description: Create any Azure resource description: - - Create, update or delete any Azure resource using Azure REST API. - - This module gives access to resources that are not supported via Ansible modules. - - Refer to https://docs.microsoft.com/en-us/rest/api/ regarding details related to specific resource REST API. + - Create, update or delete any Azure resource using Azure REST API. + - This module gives access to resources that are not supported via Ansible modules. + - Refer to U(https://docs.microsoft.com/en-us/rest/api/) regarding details related to specific resource REST API. options: - url: - description: - - Azure RM Resource URL. - api_version: - description: - - Specific API version to be used. - provider: - description: - - Provider type. - - Required if URL is not specified. - resource_group: - description: - - Resource group to be used. - - Required if URL is not specified. - resource_type: - description: - - Resource type. - - Required if URL is not specified. - resource_name: - description: - - Resource name. - - Required if URL Is not specified. - subresource: - description: - - List of subresources - suboptions: - namespace: + url: description: - - Subresource namespace - type: + - Azure RM Resource URL. + api_version: description: - - Subresource type - name: + - Specific API version to be used. + provider: description: - - Subresource name - body: - description: - - The body of the http request/response to the web service. - method: - description: - - The HTTP method of the request or response. It MUST be uppercase. - choices: [ "GET", "PUT", "POST", "HEAD", "PATCH", "DELETE", "MERGE" ] - default: "PUT" - status_code: - description: - - A valid, numeric, HTTP status code that signifies success of the - request. Can also be comma separated list of status codes. - default: [ 200, 201, 202 ] - idempotency: - description: - - If enabled, idempotency check will be done by using GET method first and then comparing with I(body) - default: no - type: bool - polling_timeout: - description: - - If enabled, idempotency check will be done by using GET method first and then comparing with I(body) - default: 0 - type: int - version_added: "2.8" - polling_interval: - description: - - If enabled, idempotency check will be done by using GET method first and then comparing with I(body) - default: 60 - type: int - version_added: "2.8" - state: - description: - - Assert the state of the resource. Use C(present) to create or update resource or C(absent) to delete resource. - default: present - choices: - - absent - - present + - Provider type. + - Required if URL is not specified. + resource_group: + description: + - Resource group to be used. + - Required if URL is not specified. + resource_type: + description: + - Resource type. + - Required if URL is not specified. + resource_name: + description: + - Resource name. + - Required if URL Is not specified. + subresource: + description: + - List of subresources. + suboptions: + namespace: + description: + - Subresource namespace. + type: + description: + - Subresource type. + name: + description: + - Subresource name. + body: + description: + - The body of the HTTP request/response to the web service. + method: + description: + - The HTTP method of the request or response. It must be uppercase. + choices: + - GET + - PUT + - POST + - HEAD + - PATCH + - DELETE + - MERGE + default: "PUT" + status_code: + description: + - A valid, numeric, HTTP status code that signifies success of the request. Can also be comma separated list of status codes. + type: list + default: [ 200, 201, 202 ] + idempotency: + description: + - If enabled, idempotency check will be done by using I(method=GET) first and then comparing with I(body). + default: no + type: bool + polling_timeout: + description: + - If enabled, idempotency check will be done by using I(method=GET) first and then comparing with I(body). + default: 0 + type: int + version_added: "2.8" + polling_interval: + description: + - If enabled, idempotency check will be done by using I(method=GET) first and then comparing with I(body). + default: 60 + type: int + version_added: "2.8" + state: + description: + - Assert the state of the resource. Use C(present) to create or update resource or C(absent) to delete resource. + default: present + choices: + - absent + - present extends_documentation_fragment: - - azure + - azure author: - - "Zim Kalinowski (@zikalino)" + - Zim Kalinowski (@zikalino) ''' @@ -118,9 +125,96 @@ EXAMPLES = ''' RETURN = ''' response: - description: Response specific to resource type. + description: + - Response specific to resource type. returned: always - type: dict + type: complex + contains: + id: + description: + - Resource ID. + type: str + returned: always + sample: "/subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Storage/storageAccounts/staccb57dc95183" + kind: + description: + - The kind of storage. + type: str + returned: always + sample: Storage + location: + description: + - The resource location, defaults to location of the resource group. + type: str + returned: always + sample: eastus + name: + description: + The storage account name. + type: str + returned: always + sample: staccb57dc95183 + properties: + description: + - The storage account's related properties. + type: dict + returned: always + sample: { + "creationTime": "2019-06-13T06:34:33.0996676Z", + "encryption": { + "keySource": "Microsoft.Storage", + "services": { + "blob": { + "enabled": true, + "lastEnabledTime": "2019-06-13T06:34:33.1934074Z" + }, + "file": { + "enabled": true, + "lastEnabledTime": "2019-06-13T06:34:33.1934074Z" + } + } + }, + "networkAcls": { + "bypass": "AzureServices", + "defaultAction": "Allow", + "ipRules": [], + "virtualNetworkRules": [] + }, + "primaryEndpoints": { + "blob": "https://staccb57dc95183.blob.core.windows.net/", + "file": "https://staccb57dc95183.file.core.windows.net/", + "queue": "https://staccb57dc95183.queue.core.windows.net/", + "table": "https://staccb57dc95183.table.core.windows.net/" + }, + "primaryLocation": "eastus", + "provisioningState": "Succeeded", + "secondaryLocation": "westus", + "statusOfPrimary": "available", + "statusOfSecondary": "available", + "supportsHttpsTrafficOnly": false + } + sku: + description: + - The storage account SKU. + type: dict + returned: always + sample: { + "name": "Standard_GRS", + "tier": "Standard" + } + tags: + decription: + - Resource tags. + type: dict + returned: always + sample: { 'key1': 'value1' } + type: + description: + - The resource type. + type: str + returned: always + sample: "Microsoft.Storage/storageAccounts" + ''' from ansible.module_utils.azure_rm_common import AzureRMModuleBase diff --git a/lib/ansible/modules/cloud/azure/azure_rm_resource_facts.py b/lib/ansible/modules/cloud/azure/azure_rm_resource_facts.py index 1e06a8db9a6..ed526661392 100644 --- a/lib/ansible/modules/cloud/azure/azure_rm_resource_facts.py +++ b/lib/ansible/modules/cloud/azure/azure_rm_resource_facts.py @@ -17,51 +17,51 @@ DOCUMENTATION = ''' --- module: azure_rm_resource_facts version_added: "2.6" -short_description: Generic facts of Azure resources. +short_description: Generic facts of Azure resources description: - - Obtain facts of any resource using Azure REST API. - - This module gives access to resources that are not supported via Ansible modules. - - Refer to https://docs.microsoft.com/en-us/rest/api/ regarding details related to specific resource REST API. + - Obtain facts of any resource using Azure REST API. + - This module gives access to resources that are not supported via Ansible modules. + - Refer to U(https://docs.microsoft.com/en-us/rest/api/) regarding details related to specific resource REST API. options: - url: - description: - - Azure RM Resource URL. - api_version: - description: - - Specific API version to be used. - provider: - description: - - Provider type, should be specified in no URL is given - resource_group: - description: - - Resource group to be used. - - Required if URL is not specified. - resource_type: - description: - - Resource type. - resource_name: - description: - - Resource name. - subresource: - description: - - List of subresources - suboptions: - namespace: + url: description: - - Subresource namespace - type: + - Azure RM Resource URL. + api_version: description: - - Subresource type - name: + - Specific API version to be used. + provider: description: - - Subresource name + - Provider type, should be specified in no URL is given. + resource_group: + description: + - Resource group to be used. + - Required if URL is not specified. + resource_type: + description: + - Resource type. + resource_name: + description: + - Resource name. + subresource: + description: + - List of subresources. + suboptions: + namespace: + description: + - Subresource namespace. + type: + description: + - Subresource type. + name: + description: + - Subresource name. extends_documentation_fragment: - - azure + - azure author: - - "Zim Kalinowski (@zikalino)" + - Zim Kalinowski (@zikalino) ''' @@ -82,9 +82,200 @@ EXAMPLES = ''' RETURN = ''' response: - description: Response specific to resource type. + description: + - Response specific to resource type. returned: always - type: dict + type: complex + contains: + id: + description: + - Id of the Azure resource. + type: str + returned: always + sample: "/subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Compute/virtualMachines/myVM" + location: + description: + - Resource location. + type: str + returned: always + sample: eastus + name: + description: + - Resource name. + type: str + returned: always + sample: myVM + properties: + description: + - Specifies the virtual machine's property. + type: complex + returned: always + contains: + diagnosticsProfile: + description: + - Specifies the boot diagnostic settings state. + type: complex + returned: always + contains: + bootDiagnostics: + description: + - A debugging feature, which to view Console Output and Screenshot to diagnose VM status. + type: dict + returned: always + sample: { + "enabled": true, + "storageUri": "https://vxisurgdiag.blob.core.windows.net/" + } + hardwareProfile: + description: + - Specifies the hardware settings for the virtual machine. + type: dict + returned: always + sample: { + "vmSize": "Standard_D2s_v3" + } + networkProfile: + description: + - Specifies the network interfaces of the virtual machine. + type: complex + returned: always + contains: + networkInterfaces: + description: + - Describes a network interface reference. + type: list + returned: always + sample: + - { + "id": "/subscriptions/xxxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Network/networkInterfaces/myvm441" + } + osProfile: + description: + - Specifies the operating system settings for the virtual machine. + type: complex + returned: always + contains: + adminUsername: + description: + - Specifies the name of the administrator account. + type: str + returned: always + sample: azureuser + allowExtensionOperations: + description: + - Specifies whether extension operations should be allowed on the virtual machine. + - This may only be set to False when no extentions are present on the virtual machine. + type: bool + returned: always + sample: true + computerName: + description: + - Specifies the host OS name of the virtual machine. + type: str + returned: always + sample: myVM + requireGuestProvisionSignale: + description: + - Specifies the host require guest provision siganl or not. + type: bool + returned: always + sample: true + secrets: + description: + - Specifies set of certificates that should be installed onto the virtual machine. + type: list + returned: always + sample: [] + linuxConfiguration: + description: + - Specifies the Linux operatiing system settings on the virtual machine. + type: dict + returned: when OS type is Linux + sample: { + "disablePasswordAuthentication": false, + "provisionVMAgent": true + } + provisioningState: + description: + - The provisioning state. + type: str + returned: always + sample: Succeeded + vmID: + description: + - Specifies the VM unique ID whic is a 128-bits identifier that is encoded and stored in all Azure laaS VMs SMBIOS. + - It can be read using platform BIOS commands. + type: str + returned: always + sample: "eb86d9bb-6725-4787-a487-2e497d5b340c" + storageProfile: + description: + - Specifies the storae account type for the managed disk. + type: complex + returned: always + contains: + dataDisks: + description: + - Specifies the parameters that are used to add a data disk to virtual machine. + type: list + returned: always + sample: + - { + "caching": "None", + "createOption": "Attach", + "diskSizeGB": 1023, + "lun": 2, + "managedDisk": { + "id": "/subscriptions/xxxx....xxxx/resourceGroups/V-XISURG/providers/Microsoft.Compute/disks/testdisk2", + "storageAccountType": "StandardSSD_LRS" + }, + "name": "testdisk2" + } + - { + "caching": "None", + "createOption": "Attach", + "diskSizeGB": 1023, + "lun": 1, + "managedDisk": { + "id": "/subscriptions/xxxx...xxxx/resourceGroups/V-XISURG/providers/Microsoft.Compute/disks/testdisk3", + "storageAccountType": "StandardSSD_LRS" + }, + "name": "testdisk3" + } + + imageReference: + description: + - Specifies information about the image to use. + type: dict + returned: always + sample: { + "offer": "UbuntuServer", + "publisher": "Canonical", + "sku": "18.04-LTS", + "version": "latest" + } + osDisk: + description: + - Specifies information about the operating system disk used by the virtual machine. + type: dict + returned: always + sample: { + "caching": "ReadWrite", + "createOption": "FromImage", + "diskSizeGB": 30, + "managedDisk": { + "id": "/subscriptions/xxx...xxxx/resourceGroups/v-xisuRG/providers/Microsoft.Compute/disks/myVM_disk1_xxx", + "storageAccountType": "Premium_LRS" + }, + "name": "myVM_disk1_xxx", + "osType": "Linux" + } + type: + description: + - The type of identity used for the virtual machine. + type: str + returned: always + sample: "Microsoft.Compute/virtualMachines" ''' from ansible.module_utils.azure_rm_common import AzureRMModuleBase