GithubHelp home page GithubHelp logo

azure / azure_preview_modules Goto Github PK

View Code? Open in Web Editor NEW
43.0 19.0 48.0 2.11 MB

Azure preview modules for Ansible

Home Page: https://galaxy.ansible.com/azure/azure_preview_modules

Python 100.00% Shell 0.01%
azure ansible azure-resources playbook azure-modules

azure_preview_modules's Introduction

This repo is not maintained anymore, instead please go to AzCollection.

azure.azure_preview_modules

This role is the most complete and includes all the latest Azure modules. The update and bug fix are done in a more timely manner than official Ansible release.

If you use Ansible for Azure resource provisioning purpose, you're strongly encouraged to install this role.

Prerequisite

The usage of this playbook role assumes that you've already setup an Ansible environment for Azure. For details, please refer to Ansible tutorial Getting Started with Azure or Install and configure Ansible.

Installation

  1. Install the role.
$ ansible-galaxy install azure.azure_preview_modules
  1. Upgrade Azure Python SDKs required by new Azure modules.
$ pip install -r ~/.ansible/roles/azure.azure_preview_modules/files/requirements-azure.txt

    or

$ sudo pip install -r ~/.ansible/roles/azure.azure_preview_modules/files/requirements-azure.txt

Several reasons for installing Python SDKs are listed here.

  • New module is added to the role and this module is for one new Azure resource, which is not included in existing Ansible releases yet. Corresponding SDK for this new resource needs to be installed.

  • Newer versions of SDKs may introduce breaking API change. One specific working version should be installed here.

The required SDKs are listed in the ~/files/requirements-azure.txt file. The requirements-azure.txt file can be found in the installed role folder, which is usually at ~/.ansible/roles/files folder.

The tricky part is the installation location, which has to be the same as where existing Azure Python SDKs are installed. If you meet any error when executing above command, please read below part carefully to double check the installation location.

Taking Ubuntu for example, the existing SDKs may be located in folders like /home/<your-user-name>/.local/lib/python2.7/site-packages or /usr/local/lib/python2.7/dist-packages. The former is a user folder and the latter is a system folder, which requires sudo access. This depends on how you have installed ansible. In short, you should install the SDKs the same way as you installed ansible so that the SDKs are in the same site-packages folder.

On macOS, the existing SDKs may be located in folders like /Users/<your-user-name>/Library/Python/2.7/lib/python/site-packages or /Library/Python/2.7/site-packages. Like Ubuntu, the former is an user folder and the latter is a system folder.

One way to figure out the correct site-packages path is to check the details of existing packages, say azure-mgmt-storage by running below command.

$ pip show azure-mgmt-storage

You can get the output like below.

your-user-name@ansible:~$ pip show azure-mgmt-storage
Name: azure-mgmt-storage
Version: 1.5.0
Summary: Microsoft Azure Storage Management Client Library for Python
Home-page: https://github.com/Azure/azure-sdk-for-python
Author: Microsoft Corporation
Author-email: [email protected]
License: MIT License
Location: /home/<your-user-name>/.local/lib/python2.7/site-packages
Requires: azure-common, azure-mgmt-nspkg, msrestazure

From above information you can learn that the SDKs are installed in user site-packages folder and use pip install to install the listed packages. If the SDKs are installed in system path, use sudo pip install to install the listed packages.

Role Variables

No.

Dependencies

No dependencies on other roles.

Example Playbook

- hosts: localhost
  roles:
    - { role: azure.azure_preview_modules }
  tasks:
  - name: create storage account
    azure_rm_storageaccount:
      resource_group: resourcegroupname
      name: storagename
      account_type: Standard_LRS

License

MIT

azure_preview_modules's People

Contributors

caohai avatar coreywan avatar fred-sun avatar haiyuazhang avatar jdashton avatar microsoft-github-policy-service[bot] avatar msftgits avatar ovisan avatar patocl avatar rdtechie avatar xuzhang3 avatar yungezz avatar yuwzho avatar zhijunzhao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure_preview_modules's Issues

azure_rm_keyvaultkey is failing No handlers could be found for logger \"msrestazure.azure_active_directory

Hi,
I have troubles using azure_rm_keyvaultkey. This is how to reproduce the issue.

docker
 run -it centos:7.4.1708 bash
inside the container
yum check-update; sudo yum install -y gcc libffi-devel python-devel openssl-devel epel-release
yum install -y python-pip python-wheel
pip install ansible[azure]
export AZURE_SUBSCRIPTION_ID=<your-subscription_id>
export AZURE_CLIENT_ID=<security-principal-appid>
export AZURE_SECRET=<security-principal-password>
export AZURE_TENANT=<security-principal-tenant>
export AZURE_CLOUD_ENVIRONMENT=AzureChinaCloud

the following module works:

---
- hosts: localhost
  connection: local
  tasks:
    - name: Create a resource group
      azure_rm_resourcegroup:
        name: ansible-rg
        location: eastus
      register: rg
    - debug:
        var: rg

But when I try to use azure_rm_keyvaultkey:

---
- hosts: localhost
  connection: local
  tasks:
    - name: create a secret
      azure_rm_keyvaultkey:
        key_name: MyKey
        keyvault_uri: https://ansibletest.vault.azure.cn/

I have the following error:

fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "No handlers could be found for logger \"msrestazure.azure_active_directory\"\nTraceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-xxx-xxx/AnsiballZ_azure_rm_keyvaultkey.py\", line 113, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-xxxxx.3-xxxxxx/AnsiballZ_azure_rm_keyvaultkey.py\", line 105, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-xxxx.3-xxx/AnsiballZ_azure_rm_keyvaultkey.py\", line 48, in invoke_module\n imp.load_module('__main__', mod, module, MOD_DESC)\n File \"/tmp/ansible_azure_rm_keyvaultkey_payload_gNrmri/__main__.py\", line 296, in <module>\n File \"/tmp/ansible_azure_rm_keyvaultkey_payload_gNrmri/__main__.py\", line 292, in main\n File \"/tmp/ansible_azure_rm_keyvaultkey_payload_gNrmri/__main__.py\", line 133, in __init__\n File \"/tmp/ansible_azure_rm_keyvaultkey_payload_gNrmri/ansible_azure_rm_keyvaultkey_payload.zip/ansible/module_utils/azure_rm_common.py\", line 311, in __init__\n File \"/tmp/ansible_azure_rm_keyvaultkey_payload_gNrmri/__main__.py\", line 164, in exec_module\n File \"/tmp/ansible_azure_rm_keyvaultkey_payload_gNrmri/__main__.py\", line 200, in get_key\n File \"/usr/lib/python2.7/site-packages/azure/keyvault/key_vault_client.py\", line 441, in get_key\n response = self._client.send(request, header_parameters, **operation_config)\n File \"/usr/lib/python2.7/site-packages/msrest/service_client.py\", line 257, in send\n **kwargs)\n File \"/usr/lib/python2.7/site-packages/requests/sessions.py\", line 512, in request\n resp = self.send(prep, **send_kwargs)\n File \"/usr/lib/python2.7/site-packages/requests/sessions.py\", line 629, in send\n r = dispatch_hook('response', hooks, r, **kwargs)\n File \"/usr/lib/python2.7/site-packages/requests/hooks.py\", line 31, in dispatch_hook\n _hook_data = hook(hook_data, **kwargs)\n File \"/usr/lib/python2.7/site-packages/azure/keyvault/custom/key_vault_authentication.py\", line 146, in _handle_401\n security = self._get_message_security(prep, challenge)\n File \"/usr/lib/python2.7/site-packages/azure/keyvault/custom/key_vault_authentication.py\", line 172, in _get_message_security\n scheme))\n File \"/usr/lib/python2.7/site-packages/azure/keyvault/custom/key_vault_authentication.py\", line 61, in _auth_callback_compat\n if len(inspect.getargspec(self._user_callback).args) == 3 \\\n File \"/tmp/ansible_azure_rm_keyvaultkey_payload_gNrmri/__main__.py\", line 153, in auth_callback\n File \"/usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py\", line 453, in __init__\n self.set_token()\n File \"/usr/lib/python2.7/site-packages/msrestazure/azure_active_directory.py\", line 480, in set_token\n raise_with_traceback(AuthenticationError, \"\", err)\n File \"/usr/lib/python2.7/site-packages/msrest/exceptions.py\", line 48, in raise_with_traceback\n raise error\nmsrest.exceptions.AuthenticationError: , InvalidClientIdError: (invalid_request) AADSTS90002: Tenant xxxx not found. This may happen if there are no active subscriptions for the tenant. Check with your subscription administrator.\r\nTrace ID: xx-xx-x-xx-xx\r\nCorrelation ID: xx-xx-xx-xx-xx\r\nTimestamp: 2018-10-18 00:32:22Z\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

I hid some information by replacing it with xxxx.

adal==1.1.0
ansible==2.7.0
applicationinsights==0.11.7
argcomplete==1.9.4
asn1crypto==0.24.0
azure-cli-core==2.0.35
azure-cli-nspkg==3.0.2
azure-common==1.1.11
azure-graphrbac==0.40.0
azure-keyvault==1.0.0a1
azure-mgmt-batch==4.1.0
azure-mgmt-compute==2.1.0
azure-mgmt-containerinstance==0.4.0
azure-mgmt-containerregistry==2.0.0
azure-mgmt-containerservice==3.0.1
azure-mgmt-dns==1.2.0
azure-mgmt-keyvault==0.40.0
azure-mgmt-marketplaceordering==0.1.0
azure-mgmt-monitor==0.5.2
azure-mgmt-network==1.7.1
azure-mgmt-nspkg==2.0.0
azure-mgmt-rdbms==1.2.0
azure-mgmt-resource==1.2.2
azure-mgmt-sql==0.7.1
azure-mgmt-storage==1.5.0
azure-mgmt-trafficmanager==0.50.0
azure-mgmt-web==0.32.0
azure-nspkg==2.0.0
azure-storage==0.35.1
bcrypt==3.1.4
certifi==2018.10.15
cffi==1.11.5
chardet==3.0.4
colorama==0.4.0
configparser==3.5.0
cryptography==2.3.1
entrypoints==0.2.3
enum34==1.1.6
humanfriendly==4.16.1
idna==2.7
iniparse==0.4
ipaddress==1.0.22
isodate==0.6.0
Jinja2==2.10
jmespath==0.9.3
keyring==15.1.0
kitchen==1.1.1
knack==0.3.3
MarkupSafe==1.0
monotonic==1.5
msrest==0.4.29
msrestazure==0.4.31
oauthlib==2.1.0
packaging==18.0
paramiko==2.4.2
pyasn1==0.4.4
pycparser==2.19
pycurl==7.19.0
Pygments==2.2.0
pygobject==3.22.0
pygpgme==0.3
PyJWT==1.6.4
pyliblzma==0.5.3
PyNaCl==1.3.0
pyOpenSSL==18.0.0
pyparsing==2.2.2
python-dateutil==2.7.3
pyxattr==0.5.1
PyYAML==3.13
requests==2.19.1
requests-oauthlib==1.0.0
SecretStorage==2.3.1
six==1.11.0
tabulate==0.8.2
urlgrabber==3.10
urllib3==1.23
yum-metadata-parser==1.1.4```

Creating LoadBalancer fails with __init__() takes exactly 1 argument (2 given).

Hello,

while trying to create LoadBalancer resource in AzureStack Ansible run fails with the Python error. Ansible playbooks works perfectly against AzureCloud, however our target environment is AzureStack and we are using AzureCloud only for temporary development.

UPDATE: It seems I was missing - { role: azure.azure_preview_modules } in my playbook. After I have added it, I was immediately greeted API not found error so API compatibility issues are the same as for Ansible Azure modules.

When using Ansible Azure modules I have been facing API version compatibility issues. By changing hardcoded versions in Azure modules or switching to Azure preview modules, allowed to solve the API version issue. However both Azure and Azure Preview modules fails with init() takes exactly 1 argument (2 given)"` error, when creating LoadBalancer.

fatal: [localhost]: FAILED! => { "changed": false, "module_stderr": "/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n InsecureRequestWarning)\nTraceback (most recent call last):\n File \"/home/atlas-admin/.ansible/tmp/ansible-tmp-1556604815.54-67422344188759/AnsiballZ_azure_rm_loadbalancer.py\", line 261, in <module>\n _ansiballz_main()\n File \"/home/atlas-admin/.ansible/tmp/ansible-tmp-1556604815.54-67422344188759/AnsiballZ_azure_rm_loadbalancer.py\", line 251, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/atlas-admin/.ansible/tmp/ansible-tmp-1556604815.54-67422344188759/AnsiballZ_azure_rm_loadbalancer.py\", line 119, in invoke_module\n imp.load_module('__main__', mod, module, MOD_DESC)\n File \"/tmp/ansible_azure_rm_loadbalancer_payload_JDUoLJ/__main__.py\", line 981, in <module>\n File \"/tmp/ansible_azure_rm_loadbalancer_payload_JDUoLJ/__main__.py\", line 977, in main\n File \"/tmp/ansible_azure_rm_loadbalancer_payload_JDUoLJ/__main__.py\", line 624, in __init__\n File \"/tmp/ansible_azure_rm_loadbalancer_payload_JDUoLJ/ansible_azure_rm_loadbalancer_payload.zip/ansible/module_utils/azure_rm_common.py\", line 308, in __init__\n File \"/tmp/ansible_azure_rm_loadbalancer_payload_JDUoLJ/__main__.py\", line 738, in exec_module\nTypeError: __init__() takes exactly 1 argument (2 given)\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1 }
When trying to rerun temporary payload it now gives the error below. I have looked at the file and at exploded temporary payload file contents, however my Python foo is not strong enough to identify the issue.

Traceback (most recent call last): File "./AnsiballZ_azure_rm_loadbalancer.py", line 261, in <module> _ansiballz_main() File "./AnsiballZ_azure_rm_loadbalancer.py", line 248, in _ansiballz_main exitcode = debug(sys.argv[1], zipped_mod, ANSIBALLZ_PARAMS) File "./AnsiballZ_azure_rm_loadbalancer.py", line 216, in debug importer = imp.load_module('__main__', f, script_path, ('.py', 'r', imp.PY_SOURCE)) File "/home/atlas-admin/.ansible/tmp/ansible-tmp-1556604815.54-67422344188759/debug_dir/__main__.py", line 981, in <module> main() File "/home/atlas-admin/.ansible/tmp/ansible-tmp-1556604815.54-67422344188759/debug_dir/__main__.py", line 977, in main AzureRMLoadBalancer() File "/home/atlas-admin/.ansible/tmp/ansible-tmp-1556604815.54-67422344188759/debug_dir/__main__.py", line 624, in __init__ supports_check_mode=True File "/home/atlas-admin/.ansible/tmp/ansible-tmp-1556604815.54-67422344188759/debug_dir/ansible/module_utils/azure_rm_common.py", line 308, in __init__ res = self.exec_module(**self.module.params) File "/home/atlas-admin/.ansible/tmp/ansible-tmp-1556604815.54-67422344188759/debug_dir/__main__.py", line 738, in exec_module ) for item in self.inbound_nat_pools] if self.inbound_nat_pools else None TypeError: __init__() takes exactly 1 argument (2 given)

Environment:
OS: Ubuntu 18.04.1 LTS
Ansible:
ansible 2.7.9 config file = None configured module search path = [u'/home/atlas-admin/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible executable location = /usr/local/bin/ansible python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
Azure preview modules installed as defined in https://galaxy.ansible.com/Azure/azure_preview_modules
AzureStack: 1.1901.0.95

Load balancer definition (snip from the role):

- name: Create Load Balancer
  azure_rm_loadbalancer:
    name: "{{ definedLoadbalancer }}"
    resource_group:  "{{ resourceGroup }}"
    frontend_ip_configurations:
      - name: frontendipconf0
        public_ip_address: "{{ definedPublicipaddress }}"
    probes:
      - name: probhttp
        port: 32080
        protocol: Tcp
        interval: 10
        fail_count: 3
      - name: probhttps
        port: 32443
        protocol: Tcp
        interval: 10
        fail_count: 3
    backend_address_pools:
      - name: "{{ definedLBBackendpool }}"
    inbound_nat_pools:
      - name: inboundnatpool0
        frontend_ip_configuration_name: frontendipconf0
        protocol: Tcp
        frontend_port_range_start: 80
        frontend_port_range_end: 81
        backend_port: 8080
    load_balancing_rules:
      - name: lbrbalancingrulehttp
        frontend_ip_configuration: frontendipconf0
        backend_address_pool: "{{ definedLBBackendpool }}"
        frontend_port: 80
        backend_port: 32080
        probe: probhttp
      - name: lbrbalancingrulehttps
        frontend_ip_configuration: frontendipconf0
        backend_address_pool: "{{ definedLBBackendpool }}"
        frontend_port: 443
        backend_port: 32443
        probe: probhttps
    sku: Basic

Unable to create a azure_rm_networkinterface with private only IP config

I'm trying to setup a azure_rm_networkinterface with a static private IP address and no Public IP address. However, I get the following error:

msrest.exceptions.ValidationError: Parameter 'public_ip_address_name' can not be None.

Sample task:

- name: Create the  NIC
  azure_rm_networkinterface:
    name: "MyTestNic"
    resource_group: "demo"
    security_group_name: "nsg-private"
    subnet_name: "private"
    ip_configurations:
      - name: primary
        private_ip_allocation_method: Static
        private_ip_address: "172.16.1.42"
        primary: True
    virtual_network_name: "vnet-demo"

Note that I get the same error when I remove the private_ip_allocation_method and private_ip_address elements.

Full error output:

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: msrest.exceptions.ValidationError: Parameter 'public_ip_address_name' can not be None.
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_5ynwcvi_/ansible_module_azure_rm_networkinterface.py\", line 595, in <module>\n    main()\n  File \"/tmp/ansible_5ynwcvi_/ansible_module_azure_rm_networkinterface.py\", line 591, in main\n    AzureRMNetworkInterface()\n  File \"/tmp/ansible_5ynwcvi_/ansible_module_azure_rm_networkinterface.py\", line 408, in __init__\n    required_if=required_if)\n  File \"/tmp/ansible_5ynwcvi_/ansible_modlib.zip/ansible/module_utils/azure_rm_common.py\", line 345, in __init__\n  File \"/tmp/ansible_5ynwcvi_/ansible_module_azure_rm_networkinterface.py\", line 516, in exec_module\n    ) for ip_config in self.ip_configurations\n  File \"/tmp/ansible_5ynwcvi_/ansible_module_azure_rm_networkinterface.py\", line 516, in <listcomp>\n    ) for ip_config in self.ip_configurations\n  File \"/tmp/ansible_5ynwcvi_/ansible_module_azure_rm_networkinterface.py\", line 546, in get_or_create_public_ip_address\n    poller = self.network_client.public_ip_addresses.create_or_update(self.resource_group, name, params)\n  File \"/usr/local/lib/python3.5/dist-packages/azure/mgmt/network/v2017_06_01/operations/public_ip_addresses_operations.py\", line 212, in create_or_update\n    'publicIpAddressName': self._serialize.url(\"public_ip_address_name\", public_ip_address_name, 'str'),\n  File \"/usr/local/lib/python3.5/dist-packages/msrest/serialization.py\", line 488, in url\n    data = self.validate(data, name, required=True, **kwargs)\n  File \"/usr/local/lib/python3.5/dist-packages/msrest/serialization.py\", line 558, in validate\n    raise ValidationError(\"required\", name, True)\nmsrest.exceptions.ValidationError: Parameter 'public_ip_address_name' can not be None.\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}

azure API limits returns first 50 results

Azure API limits return to 50 results, need to make the page limit when wrapping an API call transparent. Otherwise azure_rm_resource_facts works when you have less than 50 resources...
Anyone faces the same issue?

from azure.mgmt.rdbms.mariadb import MariaDBManagementClient

Hi Dear,

This error be occurring in my playbook with Ansible Tower. Whats lib is need install?

I installed azure.mgmt.rdbms, but not success.

Whats problem?

"exception": "Traceback (most recent call last):\n File "/tmp/ansible_azure_rm_networkinterface_payload_nKUJGv/ansible_azure_rm_networkinterface_payload.zip/ansible/module_utils/azure_rm_common.py", line 173, in \n from azure.mgmt.rdbms.mariadb import MariaDBManagementClient\nImportError: No module named mariadb\n",

azure_rm_virtualmachine >> diagnostics_profile supported ?

Hi,
Is it possible to set a 'diagnostics_profile' in the azure_rm_virtualmachine module ?
I am looking for equivalent parameters below as I used in Azure SDK :

            'diagnostics_profile': {
                'boot_diagnostics': {
                    'enabled': True,
                    'storage_uri': "Microsoft.Storage/storageAccounts/myDataStorageAccountName...",
                },
            },

Image Reference ID support in azure_rm_virtualmachine

Now that the new service Shared Image Gallery is GA, I'd like to be able to consume those type of images in my code. Does the azure_rm_virtualmachine module supports Image Reference ID's like the az cli and PowerShell Az module does?

Examples here:

I've tried to use a reference id on the parameter image, like this:

image: '/subscriptions/<our-subscription-id>/resourceGroups/<our-shared-image-gallery-rsg>/providers/Microsoft.Compute/galleries/<our-gallery-name>/images/rhel-7-cis/versions/1.0.1'

But this doesn't work.

azure_rm_hdinsightcluster creation failing

I am using Ansible version: 2.8.0 to create HDinsights cluster but I am getting this error

The full traceback is:
Traceback (most recent call last):
  File "/root/.ansible/tmp/ansible-tmp-1558070366.18-101606109807868/AnsiballZ_azure_rm_hdinsightcluster.py", line 114, in <module>
    _ansiballz_main()
  File "/root/.ansible/tmp/ansible-tmp-1558070366.18-101606109807868/AnsiballZ_azure_rm_hdinsightcluster.py", line 106, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/root/.ansible/tmp/ansible-tmp-1558070366.18-101606109807868/AnsiballZ_azure_rm_hdinsightcluster.py", line 49, in invoke_module
    imp.load_module('__main__', mod, module, MOD_DESC)
  File "/tmp/ansible_azure_rm_hdinsightcluster_payload_T09hfG/__main__.py", line 555, in <module>
  File "/tmp/ansible_azure_rm_hdinsightcluster_payload_T09hfG/__main__.py", line 551, in main
  File "/tmp/ansible_azure_rm_hdinsightcluster_payload_T09hfG/__main__.py", line 252, in __init__
  File "/tmp/ansible_azure_rm_hdinsightcluster_payload_T09hfG/ansible_azure_rm_hdinsightcluster_payload.zip/ansible/module_utils/azure_rm_common.py", line 325, in __init__
  File "/tmp/ansible_azure_rm_hdinsightcluster_payload_T09hfG/__main__.py", line 337, in exec_module
  File "/tmp/ansible_azure_rm_hdinsightcluster_payload_T09hfG/__main__.py", line 366, in create_update_cluster
  File "/usr/local/lib/python2.7/dist-packages/azure/mgmt/hdinsight/operations/clusters_operations.py", line 122, in create
    **operation_config
  File "/usr/local/lib/python2.7/dist-packages/azure/mgmt/hdinsight/operations/clusters_operations.py", line 75, in _create_initial
    response = self._client.send(request, stream=False, **operation_config)
  File "/usr/local/lib/python2.7/dist-packages/msrest/service_client.py", line 219, in send
    pipeline_response = self.config.pipeline.run(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/msrest/pipeline/__init__.py", line 203, in run
    return first_node.send(pipeline_request, **kwargs)  # type: ignore
  File "/usr/local/lib/python2.7/dist-packages/msrest/pipeline/__init__.py", line 156, in send
    response = self.next.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/msrest/pipeline/requests.py", line 72, in send
    return self.next.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/msrest/pipeline/requests.py", line 137, in send
    return self.next.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/msrest/pipeline/__init__.py", line 156, in send
    response = self.next.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/msrest/pipeline/requests.py", line 193, in send
    self.driver.send(request.http_request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/msrest/universal_http/requests.py", line 328, in send
    return super(RequestsHTTPSender, self).send(request, **requests_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/msrest/universal_http/requests.py", line 140, in send
    raise_with_traceback(ClientRequestError, msg, err)
  File "/usr/local/lib/python2.7/dist-packages/msrest/exceptions.py", line 57, in raise_with_traceback
    raise error
msrest.exceptions.ClientRequestError: Error occurred in request., RetryError: HTTPSConnectionPool(host='management.azure.com', port=443): Max retries exceeded with url: /subscriptions/xxx/resourceGroups/xx/providers/Microsoft.HDInsight/clusters/xxx?api-version=2015-03-01-preview (Caused by ResponseError('too many 500 error responses',))

This is my Playbook

- name: Create instance of HDInsight Cluster
  azure_rm_hdinsightcluster:
    resource_group: "{{pl_resource_group_name}}"
    name: "{{pl_hdinsight_name}}"
    location: "{{pl_location}}"
    cluster_version: "{{pl_hdinsight_cluster_version}}"
    os_type: "{{pl_hdinsight_os_type}}"
    tier: "{{pl_hdinsight_tire}}"
    cluster_definition:
      kind: "{{pl_hdinsight_kind}}"
      gateway_rest_username: "{{pl_gateway_rest_username}}"
      gateway_rest_password: "{{pl_gateway_rest_password}}"
    storage_accounts:
      - name: "{{pl_blob_name}}"
        is_default: yes
        container: "{{pl_blob_name}}"
        key: "{{pl_create_storageaccount_output.stdout}}"
    compute_profile_roles:
      - name: headnode
        target_instance_count: "{{pl_hdinsight_headnode_vm_count}}"
        hardware_profile:
          vm_size: "{{pl_hdinsight_headnode_vm_size}}"
        linux_profile:
          username: "{{pl_gateway_rest_username}}"
          password: "{{pl_gateway_rest_password}}"
      - name: workernode
        target_instance_count: "{{pl_hdinsight_workernode_vm_count}}"
        vm_size: "{{pl_hdinsight_workernode_vm_size}}"
        linux_profile:
          username: "{{pl_gateway_rest_username}}"
          password: "{{pl_gateway_rest_password}}"
    state: present
    auth_source: env
  environment:
    AZURE_SUBSCRIPTION_ID: '{{pl_azure_subscription_id}}'
    AZURE_CLIENT_ID: '{{pl_azure_client_id}}'
    AZURE_SECRET: '{{pl_azure_secret}}'
    AZURE_TENANT: '{{pl_azure_tenant}}'

azure_rm_cosmosdbaccount_facts - issue with 'name' parameter

When specifying the 'name' parameter on the azure_rm_cosmosdbaccount_facts module, no results seem to be returning.

First attempt:

- name: List all instances
  azure_rm_cosmosdbaccount_facts:
    resource_group: ansible-rg

The above works fine and returns all of the data you would expect for cosmosdb account 'testdb01'.

{
    "_ansible_parsed": true,
    "_ansible_no_log": false,
    "warnings": [
        "Azure API profile latest does not define an entry for CosmosDB"
    ],
    "changed": false,
    "accounts": [
        {
            "enable_table": false,
            "kind": "global_document_db",
            "enable_automatic_failover": false,
            "name": "testdb01",
            "resource_group": "rg-ansible",
            "read_locations": [
                {
                    "failover_priority": 0,
                    "provisioning_state": "Succeeded",
                    "document_endpoint": "https://testdb01-southcentralus.documents.azure.com:443/",
                    "id": "testdb01-southcentralus",
                    "name": "southcentralus"
                }
            ],
            "document_endpoint": "https://testdb01.documents.azure.com:443/",
            "enable_gremlin": false,
            "write_locations": [
                {
                    "failover_priority": 0,
                    "provisioning_state": "Succeeded",
                    "document_endpoint": "https://testdb01-southcentralus.documents.azure.com:443/",
                    "id": "testdb01-southcentralus",
                    "name": "southcentralus"
                }
            ],
            "virtual_network_rules": [],
            "ip_range_filter": "",
            "id": "/subscriptions/<redacted>/resourceGroups/rg-ansible/providers/Microsoft.DocumentDB/databaseAccounts/testdb01",
            "location": "centralus",
            "enable_cassandra": false,
            "is_virtual_network_filter_enabled": false,
            "database_account_offer_type": "Standard",
            "enable_multiple_write_locations": false,
            "provisioning_state": "Succeeded",
            "consistency_policy": {
                "max_staleness_prefix": 100,
                "default_consistency_level": "session",
                "max_interval_in_seconds": 5
            },
            "failover_policies": [
                {
                    "failover_priority": 0,
                    "name": "southcentralus",
                    "id": "testdb01-southcentralus"
                }
            ],
            "tags": {}
        }
    ],
    "invocation": {
        "module_args": {
            "profile": null,
            "name": null,
            "resource_group": "ansible-rg",
            "tags": null,
            "cloud_environment": "AzureCloud",
            "ad_user": null,
            "secret": null,
            "cert_validation_mode": null,
            "client_id": null,
            "retrieve_keys": null,
            "api_profile": "latest",
            "adfs_authority_url": null,
            "auth_source": null,
            "subscription_id": null,
            "password": null,
            "tenant": null,
            "retrieve_connection_strings": null
        }
    }
}

However, when I attempt to specify the 'name' parameter, no results are returned:

- name: List instances of Database Account testdb01
  azure_rm_cosmosdbaccount_facts:
    resource_group: ansible-rg
    name: testdb01

Result:

{
    "_ansible_parsed": true,
    "_ansible_no_log": false,
    "warnings": [
        "Azure API profile latest does not define an entry for CosmosDB"
    ],
    "changed": false,
    "accounts": [],
    "invocation": {
        "module_args": {
            "profile": null,
            "retrieve_keys": null,
            "name": "testdb01",
            "resource_group": "ansible-rg",
            "tags": null,
            "cloud_environment": "AzureCloud",
            "ad_user": null,
            "secret": null,
            "cert_validation_mode": null,
            "client_id": null,
            "api_profile": "latest",
            "adfs_authority_url": null,
            "auth_source": null,
            "subscription_id": null,
            "password": null,
            "tenant": null,
            "retrieve_connection_strings": null
        }
    }
}

Microsoft.RecoveryServices/vaults/backupPolicies powershell timezone issue

I am trying to create a new policy via powershell based off an existing policy already in a recovery vault.
When I do so, I use New-AzureRmRecoveryServicesBackupProtectionPolicy.
This command successfully creates a new policy. However, when creating the policy it does not copy the timezone.

To be more explicit, here is a run through. As a result of this run through, you will see that the time zone is not copied.

This policy "PCI" was created through the portal

image

image

image

image

azure container registry module doesn't work in the role

the readme isn't clear to provide solution on install necessary azure sdk.
and it's better to add link to this git repo readme in galaxy, because user install roles by following instruction there has no idea of the tricky workaround.

Create release for Ansible Role

Hi,
Is it possible to create a release ? It would help to manage this role in ansible requirements file. As of now we can only reference master branch and always take the latest version.

RFE: Support for Application Settings and Connection Strings in AppService

I don't see any way to add application settings strings when provisioning appservices.

Ideally, the following would be available:

  1. Connection Strings
  2. Application Strings (arbitrary Key/Value with Slot Setting bool)
  3. Anything else in Configuration->General Settings or Configuration sub panels (WebSockets, AlwaysOn, RemoteDebugging, etc.).

Is this already in the works? Would a PR for such a feature be accepted (assuming it's supported by the underlying sdk. I haven't checked yet what these features map back to.)?

azure_rm_virtualmachine > accept_terms > error not handled

Hi,
I encounter this error when I set "accept terms" for an image that does not need to. Maybe this error can be handled for a cosmetic point of view.

SYMPTOM

{
"_ansible_parsed": false,
"exception": "Traceback (most recent call last):\n File "/var/lib/awx/.ansible/tmp/ansible-tmp-1554152497.12-261253049497350/AnsiballZ_azure_rm_virtualmachine.py", line 113, in \n _ansiballz_main()\n File "/var/lib/awx/.ansible/tmp/ansible-tmp-1554152497.12-261253049497350/AnsiballZ_azure_rm_virtualmachine.py", line 105, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/var/lib/awx/.ansible/tmp/ansible-tmp-1554152497.12-261253049497350/AnsiballZ_azure_rm_virtualmachine.py", line 48, in invoke_module\n imp.load_module('main', mod, module, MOD_DESC)\n File "/tmp/ansible_azure_rm_virtualmachine_payload_u26OpA/main.py", line 1950, in \n File "/tmp/ansible_azure_rm_virtualmachine_payload_u26OpA/main.py", line 1946, in main\n File "/tmp/ansible_azure_rm_virtualmachine_payload_u26OpA/main.py", line 809, in init\n File "/tmp/ansible_azure_rm_virtualmachine_payload_u26OpA/ansible_azure_rm_virtualmachine_payload.zip/ansible/module_utils/azure_rm_common.py", line 324, in init\n File "/tmp/ansible_azure_rm_virtualmachine_payload_u26OpA/main.py", line 1196, in exec_module\nAttributeError: 'NoneType' object has no attribute 'get'\n",
"_ansible_no_log": false,
"_ansible_delegated_vars": {
"ansible_delegated_host": "localhost",
"ansible_host": "localhost"
},
"module_stderr": "Traceback (most recent call last):\n File "/var/lib/awx/.ansible/tmp/ansible-tmp-1554152497.12-261253049497350/AnsiballZ_azure_rm_virtualmachine.py", line 113, in \n _ansiballz_main()\n File "/var/lib/awx/.ansible/tmp/ansible-tmp-1554152497.12-261253049497350/AnsiballZ_azure_rm_virtualmachine.py", line 105, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File "/var/lib/awx/.ansible/tmp/ansible-tmp-1554152497.12-261253049497350/AnsiballZ_azure_rm_virtualmachine.py", line 48, in invoke_module\n imp.load_module('main', mod, module, MOD_DESC)\n File "/tmp/ansible_azure_rm_virtualmachine_payload_u26OpA/main.py", line 1950, in \n File "/tmp/ansible_azure_rm_virtualmachine_payload_u26OpA/main.py", line 1946, in main\n File "/tmp/ansible_azure_rm_virtualmachine_payload_u26OpA/main.py", line 809, in init\n File "/tmp/ansible_azure_rm_virtualmachine_payload_u26OpA/ansible_azure_rm_virtualmachine_payload.zip/ansible/module_utils/azure_rm_common.py", line 324, in init\n File "/tmp/ansible_azure_rm_virtualmachine_payload_u26OpA/main.py", line 1196, in exec_module\nAttributeError: 'NoneType' object has no attribute 'get'\n",
"changed": false,
"module_stdout": "",
"rc": 1,
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error"
}

CONDITION

  • name: Create VM
    delegate_to: localhost
    azure_rm_virtualmachine:
    resource_group: "rg-{{ extra_platform_name }}"
    name: "{{ extra_vm_name }}"
    location: "{{ extra_location }}"
    short_hostname: "{{ extra_vm_name }}"
    vm_size: "{{ app_vm_size }}"
    tags: "{{ extra_platform_tags }}
    Name={{ extra_vm_name }}
    owner={{ owner }}
    zone={{ extra_zone_name }}"
    admin_username: "{{ app_admin_username }}"
    ssh_password_enabled: false
    ssh_public_keys:
    - path: "/home/{{ app_admin_username }}/.ssh/authorized_keys"
    key_data: "{{ key_data }}"
    image:
    offer: CentOS
    publisher: OpenLogic
    sku: '7.5'
    version: latest
    managed_disk_type: Standard_LRS
    os_type: Linux
    network_interface_names:
    - "nic-{{ extra_platform_name }}-{{ extra_vm_name }}-management"
    - "nic-{{ extra_platform_name }}-{{ extra_vm_name }}-app"
    accept_terms: true

Error in azure_rm_keyvaultsecret

When trying to create a Azure Key Vault secret with the latest preview module, I'm receiving this error:

fatal: [localhost]: FAILED! => {
    "changed": false, 
    "module_stderr": "No handlers could be found for logger \"msrest.pipeline.requests\"\nTraceback (most recent call last):\n  File \"<stdin>\", line 114, in <module>\n  File \"<stdin>\", line 106, in _ansiballz_main\n  File \"<stdin>\", line 49, in invoke_module\n
 File \"/tmp/ansible_azure_rm_keyvaultsecret_payload_ASnlKS/__main__.py\", line 214, in <module>\n  File \"/tmp/ansible_azure_rm_keyvaultsecret_payload_ASnlKS/__main__.py\", line 210, in main\n  File \"/tmp/ansible_azure_rm_keyvaultsecret_payload_ASnlKS/__main__.py\", line 124, in __init__\n  File \"/tmp/ansible_azure_rm_keyvaultsecret_payload_ASnlKS/ansible_azure_rm_keyvaultsecret_payload.zip/ansible/module_utils/azure_rm_common.py\", line 315, in __init__\n  File \"/tmp/ansible_azure_rm_keyvaultsecret_payload_ASnlKS/__main__.py\", line 156, in exec_module\n  File \"/tmp/ansible_azure_rm_keyvaultsecret_payload_ASnlKS/__main__.py\", line 191, in get_secret\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/azure/keyvault/key_vault_client.py\", line 1795, in get_secret\n    response = self._client.send(request, header_parameters, **operation_config)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/msrest/service_client.py\", line 219, in send\n    pipeline_response = self.config.pipeline.run(request, **kwargs)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/msrest/pipeline/__init__.py\", line 203, in run\n    return first_node.send(pipeline_request, **kwargs)  # type: ignore\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/msrest/pipeline/__init__.py\", line 156, in send\n    response = self.next.send(request, **kwargs)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/msrest/pipeline/requests.py\", line 72, in send\n    return self.next.send(request, **kwargs)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/msrest/pipeline/requests.py\", line 137, in send\n    return self.next.send(request, **kwargs)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/msrest/pipeline/__init__.py\", line 156, in send\n    response = self.next.send(request, **kwargs)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/msrest/pipeline/requests.py\", line 193, in send\n    self.driver.send(request.http_request, **kwargs)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/msrest/universal_http/requests.py\", line 328, in send\n    return super(RequestsHTTPSender, self).send(request, **requests_kwargs)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/msrest/universal_http/requests.py\", line 137, in send\n    **kwargs)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/requests/sessions.py\", line 533, in request\n    resp = self.send(prep, **send_kwargs)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/requests/sessions.py\", line 653, in send\n    r = dispatch_hook('response', hooks, r, **kwargs)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/requests/hooks.py\", line 31, in dispatch_hook\n    _hook_data = hook(hook_data, **kwargs)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/azure/keyvault/custom/key_vault_authentication.py\", line 146, in _handle_401\n    security = self._get_message_security(prep, challenge)\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/azure/keyvault/custom/key_vault_authentication.py\", line 172, in _get_message_security\n    scheme))\n  File \"/opt/ansible/venv/ansible_dev_azure/lib/python2.7/site-packages/azure/keyvault/custom/key_vault_authentication.py\", line 61, in _auth_callback_compat\n    if len(inspect.getargspec(self._user_callback).args) == 3 \\\n  File \"/tmp/ansible_azure_rm_keyvaultsecret_payload_ASnlKS/__main__.py\", line 133, in auth_callback\nKeyError: 'client_id'\n",
    "module_stdout": "", 
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
    "rc": 1
}

I'm using a MSI as authentication method, and this MSI has permissions to the key vault. It's added with the correct permissions to the Access Policy on the Key Vault.

This succeeds from the same machine:
az keyvault secret set --subscription <fakenumber> --vault-name vault01 --name secret01 --value secret01

pip freeze:

adal==1.2.1
ansible==2.8.0.dev0
ansible-lint==3.4.23
anyconfig==0.9.7
applicationinsights==0.11.7
argcomplete==1.9.4
arrow==0.13.1
asn1crypto==0.24.0
atomicwrites==1.3.0
attrs==18.2.0
azure-cli-core==2.0.35
azure-cli-nspkg==3.0.2
azure-common==1.1.11
azure-graphrbac==0.40.0
azure-keyvault==1.0.0a1
azure-mgmt-batch==4.1.0
azure-mgmt-cdn==3.0.0
azure-mgmt-compute==4.4.0
azure-mgmt-containerinstance==0.4.0
azure-mgmt-containerregistry==2.0.0
azure-mgmt-containerservice==4.2.2
azure-mgmt-cosmosdb==0.5.1
azure-mgmt-devtestlabs==2.2.0
azure-mgmt-dns==2.1.0
azure-mgmt-hdinsight==0.1.0
azure-mgmt-keyvault==0.40.0
azure-mgmt-marketplaceordering==0.1.0
azure-mgmt-monitor==0.5.2
azure-mgmt-network==2.3.0
azure-mgmt-nspkg==2.0.0
azure-mgmt-rdbms==1.4.1
azure-mgmt-redis==5.0.0
azure-mgmt-resource==1.2.2
azure-mgmt-sql==0.10.0
azure-mgmt-storage==3.1.0
azure-mgmt-trafficmanager==0.50.0
azure-mgmt-web==0.32.0
azure-nspkg==2.0.0
azure-storage==0.35.1
backports.functools-lru-cache==1.5
bcrypt==3.1.6
binaryornot==0.4.4
Cerberus==1.2
certifi==2018.11.29
cffi==1.12.1
chardet==3.0.4
click==6.7
click-completion==0.3.1
colorama==0.3.9
configparser==3.7.1
cookiecutter==1.6.0
cryptography==2.5
enum34==1.1.6
fasteners==0.14.1
flake8==3.5.0
funcsigs==1.0.2
future==0.17.1
git-url-parse==1.2.0
humanfriendly==4.17
idna==2.8
ipaddress==1.0.22
isodate==0.6.0
Jinja2==2.10
jinja2-time==0.2.0
jmespath==0.9.3
knack==0.3.3
MarkupSafe==1.1.0
mccabe==0.6.1
molecule==2.19.0
monotonic==1.5
more-itertools==5.0.0
msrest==0.6.1
msrestazure==0.5.0
ntlm-auth==1.2.0
oauthlib==3.0.1
packaging==19.0
paramiko==2.4.2
pathlib2==2.3.3
pathspec==0.5.9
pbr==4.1.0
pexpect==4.6.0
pluggy==0.8.1
poyo==0.4.2
psutil==5.4.6
ptyprocess==0.6.0
py==1.7.0
pyasn1==0.4.5
pycodestyle==2.3.1
pycparser==2.19
pyflakes==1.6.0
Pygments==2.3.1
PyJWT==1.7.1
PyNaCl==1.3.0
pyOpenSSL==19.0.0
pyparsing==2.3.1
pytest==4.3.0
python-dateutil==2.8.0
python-gilt==1.2.1
pywinrm==0.3.0
PyYAML==3.13
requests==2.21.0
requests-ntlm==1.1.0
requests-oauthlib==1.2.0
scandir==1.9.0
sh==1.12.14
six==1.11.0
tabulate==0.8.2
testinfra==1.16.0
tree-format==0.1.2
typing==3.6.6
urllib3==1.24.1
whichcraft==0.5.2
xmltodict==0.11.0
yamllint==1.11.1

Feature Request - Add a parameter for specifying backend pool of LoadBalancer while creating VMSS

The az cli allows for creating a VMSS that references an already existing load balancer by its name and the backend pool - Docs

Can this be considered? Our use case is to manage multiple VMSS on the same load balancer - say, for example, staging and production - using ansible. Right now, it always defaults to 'default' or the first backend pool available on the load balancer.

The workaround we follow is to manage VMSS separately but then that defeats the purpose of using something like Ansible for provisioning.

Any other suggestions / workarounds?

Feature Request: Application Security Groups in NSG Port Rules

There's a new module for creating Application Security Groups, and the Network Interface Module also supports ASG tags.

But the one missing piece is that on this moment the modules azure_rm_securitygroup.py doesn't support ASG's in NSG Port Rules.

Can you please add the support for it? Maybe a suggestion to add two dictionary parameters, source_application_security_groups & destination_application_security_groups Both support list items (in which the ID can be put to the ASG) or a dict with two properties: name & resource_group.

I also mentioned this here: ansible/ansible#43802 but I feel that this repository is a better place to put this issue.

Public IP create fails with AttributeError: 'PublicIPAddress' object has no attribute 'ip_tags'

while trying to create LoadBalancer resource in AzureStack Ansible run fails with the Python error. Ansible playbooks works perfectly against AzureCloud, however our target environment is AzureStack and we are using AzureCloud only for temporary development.

To be able to run I have had to patch azure_rm_common.py to have API version to match available API on our AzureStack environment.

When using Ansible supplied Azure modules, I was getting error at next playbook step:
Creating LoadBalancer fails with init() takes exactly 1 argument (2 given) #253.

Environment:
OS: Ubuntu 18.04.1 LTS
Ansible:
ansible 2.7.9 config file = None configured module search path = [u'/home/atlas-admin/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible executable location = /usr/local/bin/ansible python version = 2.7.15rc1 (default, Nov 12 2018, 14:31:15) [GCC 7.3.0]
Azure preview modules installed as defined in https://galaxy.ansible.com/Azure/azure_preview_modules
AzureStack: 1.1901.0.95

Ansible snippet

- name: Create public IP
  azure_rm_publicipaddress:
    name: "{{ definedPiblicipaddress }}"
    resource_group: "{{ resourceGroup }}"
    allocation_method: Static
    domain_name:  "{{ resourceGroup }}"
    sku: Basic

Python Error

fatal: [localhost]: FAILED! => {
    "changed": false,
    "module_stderr": "/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\n/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py:847: InsecureRequestWarning: Unverified HTTPS request is being made. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings\n  InsecureRequestWarning)\nTraceback (most recent call last):\n  File \"/home/atlas-admin/.ansible/tmp/ansible-tmp-1556778849.87-147610747740374/AnsiballZ_azure_rm_publicipaddress.py\", line 261, in <module>\n    _ansiballz_main()\n  File \"/home/atlas-admin/.ansible/tmp/ansible-tmp-1556778849.87-147610747740374/AnsiballZ_azure_rm_publicipaddress.py\", line 251, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/atlas-admin/.ansible/tmp/ansible-tmp-1556778849.87-147610747740374/AnsiballZ_azure_rm_publicipaddress.py\", line 119, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/tmp/ansible_azure_rm_publicipaddress_payload_ak4rpr/__main__.py\", line 355, in <module>\n  File \"/tmp/ansible_azure_rm_publicipaddress_payload_ak4rpr/__main__.py\", line 351, in main\n  File \"/tmp/ansible_azure_rm_publicipaddress_payload_ak4rpr/__main__.py\", line 216, in __init__\n  File \"/tmp/ansible_azure_rm_publicipaddress_payload_ak4rpr/ansible_azure_rm_publicipaddress_payload.zip/ansible/module_utils/azure_rm_common.py\", line 347, in __init__\n  File \"/tmp/ansible_azure_rm_publicipaddress_payload_ak4rpr/__main__.py\", line 243, in exec_module\n  File \"/tmp/ansible_azure_rm_publicipaddress_payload_ak4rpr/__main__.py\", line 170, in pip_to_dict\nAttributeError: 'PublicIPAddress' object has no attribute 'ip_tags'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

Azure azure_rm_common.py patch diff

--- azure_rm_common.py.ORIG     2019-04-18 02:58:37.000000000 +0000
+++ azure_rm_common.py.NEW      2019-05-02 06:22:21.644381615 +0000
@@ -865,13 +865,13 @@
         if not self._network_client:
             self._network_client = self.get_mgmt_svc_client(NetworkManagementClient,
                                                             base_url=self._cloud_environment.endpoints.resource_manager,
-                                                            api_version='2018-08-01')
+                                                            api_version='2017-10-01')
         return self._network_client

     @property
     def network_models(self):
         self.log("Getting network models...")
-        return NetworkManagementClient.models("2018-08-01")
+        return NetworkManagementClient.models("2017-10-01")

     @property
     def rm_client(self):
@@ -893,13 +893,13 @@
         if not self._compute_client:
             self._compute_client = self.get_mgmt_svc_client(ComputeManagementClient,
                                                             base_url=self._cloud_environment.endpoints.resource_manager,
-                                                            api_version='2018-06-01')
+                                                            api_version='2017-12-01')
         return self._compute_client

     @property
     def compute_models(self):
         self.log("Getting compute models")
-        return ComputeManagementClient.models("2018-06-01")
+        return ComputeManagementClient.models("2017-12-01")

     @property
     def dns_client(self):

custom_data

Is that possible to get custom_data with VMSS like it is with VM?

Thanks,
Nicolas

azure_rm_storageaccount | Always already taken. - Reason.already_exists

Hi,

Trying to run this module but it's not idempotent. It keeps returning:

"The storage account named xxx is already taken. - Reason.already_exists"

  • name: Ensure Storage Account Exists
    azure_rm_storageaccount:
    resource_group: "{{ app_resourcegroup }}"
    name: "{{ sta_name }}"
    type: "{{ sta_.type }}"
    tags: "{{ azure_tags }}"
    state: "present"

Returns:

TASK [az_create_storage_account : Ensure Storage Account Exists] *****************************************************************************************************************************************************************************
task path: /opt/ansible/roles/ansible_role_az_create_storage_account/tasks/main.yml:2
fatal: [localhost]: FAILED! => {"changed": false, "msg": "The storage account named xxx is already taken. - Reason.already_exists"}

azure_rm_virtualmachinescaleset > upgrade_policy required

Hi,

Regarding azure_rm_virtualmachinescaleset module, examples does not provide "upgrade_policy" parameter while it is required: Azure Error: InvalidParameter\nMessage: Required parameter 'upgradePolicy.mode' is missing (null).\nTarget: upgradePolicy.mode

Add vnet-subnet-id options to AKS Ansible module azure_rm_aks

I am currently working on deploying an AKS cluster that is only accessible within the company. I am planning to automate the cluster creation using Ansible module azure_rm_aks. Would it be possible to add options for specifying vnet-id? If it is possible to add these options in the existing module, are there any docs that I could refer to?

Proposal / Request - Re-enable pip task

I would like to propose an update to the tasks/main.yml file. The current commented out task for installing the pip requirements is very very useful. This is especially true when we are talking about using this role in a green field environment, where the Ansible worker nodes may be ephemeral and the python modules you are requiring may not be loaded up at the time of running.

The suggestion is to change the task to be:

- name: Install Azure Python SDK required by modules.
  pip:
    requirements: "{{ role_path }}/files/requirements-azure.txt"
    extra_args: -I
  when: skip_azure_sdk

Then also add the following into defaults/main.yml to make skip_azure_sdk a default of true, unless the playbook calling the role states otherwise.

---
skip_azure_sdk: true

If you don't like that method, you could also create a new tasks file (IE tasks/setup.yaml) and the contents of that file just be:

---
- name: Install Azure Python SDK required by modules.
  pip:
    requirements: "{{ role_path }}/files/requirements-azure.txt"
    extra_args: -I

Then the playbook developer could just write a play like so:

---
- hosts: localhost
  tasks:
    - include_role:
         name: azure_preview_modules
         tasks_from: setup.yaml

That way the pip command is never ran unless someone explicitly calls for that task file to be used.

After gathering your thoughts, I could create the PR for it if you would like.

Microsoft.RecoveryServices/vaults/backupPolicies: Provided parameter value not valid - ScheduleRunTimes

Error message: 'The provided value for the template parameter 'scheduleRunTimes' at line '1' and column '1408' is not valid.'.

When: Using azure_rm_deployment module

Parameter and value provided: extract from multiple examples Protection policies API
Parameters:
"scheduleRunTimes": {
"type": "array",
"metadata": {
"description": "Times in day when backup should be triggered. e.g. 01:00, 13:00 [2018-06-01T01:00:00Z]. This will be used in LTR too for daily, weekly, monthly and yearly backup."
}
Resources:
"scheduleRunTimes": [
"2018-06-07T01:00:00Z"
]

Any help is pretty much apprecited.

Thanks in advance.

Different filenames for Managed Disk Module

I noticed that in Ansible 2.7.x vs. 2.8 that the filename for the managed disk module has been changed from azure_rm_managed_disk.py to azure_rm_manageddisk.py. Is there a reason for it?

example of ip_tags expected syntax

Hi,
Could you give an example of ip_tags expected syntax please ?

This doesn't work:
ip_tags: - type1: value1 - type2: value2
Regards

Regards

Error creating the Database Account instance: 400 Client Error:

I am getting this error while creating a cosmosdb

fatal: [localhost]: FAILED! => {"changed": false, "msg": "Error creating the Database Account instance: 400 Client Error: BadRequest for url: https://management.azure.com/subscriptions/xxxxxxxxxxxxx/resourceGroups/xxxxxx/providers/Microsoft.DocumentDB/databaseAccounts/xxxxxx?api-version=2015-04-08"}

Can someone please help me debug this?

Azure_rm_managed_disks does not support availability zones

Hi all,

I've configured an Ansible Tower server to be able to use these preview modules to support a request to build VM's in availability zones. So far so good, however some of the servers need some data disks, and the managed_disks module doesn't support the zones parameter like the virtual_machine module does.

However ... I took a look at the main Ansible devel branch and noticed there is a manageddisks module that DOES support the parameter, so I'm sorta trying to get things working with that file ( https://raw.githubusercontent.com/ansible/ansible/devel/lib/ansible/modules/cloud/azure/azure_rm_manageddisk.py ) included in a library/ dir for my playbook.

Looks to be working! However I am a bit confused as I assumed this repo would have the latest / bleeding edge parameters available in the modules? Would someone be able to explain how this repos' azure modules, and the ones from Ansible development branch relate to each other? I was under the possibly-misguided assumption that if I spot something in the Ansible devel branch that I need, I should use the modules from this repo instead as it's easy to keep things up to date with ansible-galaxy that way.

How does the development process looks like for the modules?

Hi folks, I would like to have some more insight into the development process of these modules, as this will help to decide when to use which modules. As I understand till now it's as following:

  1. Latest updates are always in https://github.com/Azure/azure_preview_modules.
  2. One time per week (on wednesday) this repo gets integrated into Ansible devel.
  3. Fixes/changes on Ansible devel for these modules get developed in the repo https://github.com/Azure/azure_modules

If my assumption is right, then the fixes/changes to https://github.com/Azure/azure_preview_modules gets merged back into https://github.com/Azure/azure_preview_modules?

If not, then I'm a bit lost. Can one of the devs explain me the process?

Standard SSD managed storage account type crashes azure_rm_virtualmachine_facts module

Summary

Running this module against a resource group with a VM that has a managed data disk set to Standard SSD storage causes the module to throw an exception.

Steps to Reproduce

  • Create a new resource group, named "az-temp-rg"
  • Create a virtual machine via the Azure portal, OS disk can be Premium SSD
  • Add a managed Data Disk with Storage type of Standard SSD
  • Execute module against the resource group (see below)
- azure_rm_virtualmachine_facts:
  auth_source: msi
  resource_group: "az-temp-rg"

Expected Output

I expect this to return a dict of vm facts

Actual Output

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'storageAccountType'
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/home/kizanAdmin/.ansible/tmp/ansible-tmp-1547598227.64-106764736031393/AnsiballZ_azure_rm_virtualmachine_facts.py\", line 113, in <module>\n    _ansiballz_main()\n  File \"/home/kizanAdmin/.ansible/tmp/ansible-tmp-1547598227.64-106764736031393/AnsiballZ_azure_rm_virtualmachine_facts.py\", line 105, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/kizanAdmin/.ansible/tmp/ansible-tmp-1547598227.64-106764736031393/AnsiballZ_azure_rm_virtualmachine_facts.py\", line 48, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload_XlsJGR/__main__.py\", line 370, in <module>\n    \n  File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload_XlsJGR/__main__.py\", line 366, in main\n    \n  File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload_XlsJGR/__main__.py\", line 229, in __init__\n    \n  File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload_XlsJGR/ansible_azure_rm_virtualmachine_facts_payload.zip/ansible/module_utils/azure_rm_common.py\", line 310, in __init__\n  File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload_XlsJGR/__main__.py\", line 241, in exec_module\n    \n  File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload_XlsJGR/__main__.py\", line 270, in list_items\n    \n  File \"/tmp/ansible_azure_rm_virtualmachine_facts_payload_XlsJGR/__main__.py\", line 352, in serialize_vm\n    \nKeyError: 'storageAccountType'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

Additional Notes

If you follow the steps to reproduce, changing the VM data disk to managed Premium SSD storage, the module does not crash. I believe this is a wide-spread issue, as Standard SSD storage is not supported in various modules.

Standard SSD storage went GA on 4 June 2018 (see https://azure.microsoft.com/en-us/blog/preview-standard-ssd-disks-for-azure-virtual-machine-workloads/).

I believe other issues in the ansible/ansible (like ansible/ansible#39958 (comment)) may be related, as the error is similar. I'll note this post in ansible/ansible to tie these reports together.

Subnet endpoints not being created on first run

I am trying to create an subnet with endpoints. The enpoints are not being created along with the subnet. If the task is run a second time the enpoints are added. I'm using the 2.8 release of the preview modules.

Here is the variable and task I'm using:

subnets:
  - name: "{{ env_name }}-sn"
    cidr: 27
    index: 0
    endpoints: []
  - name: "{{ env_name }}-k8s-sn"
    cidr: 24
    index: 1
    endpoints: 
      - service: Microsoft.Sql
      - service: Microsoft.AzureCosmosDB
      - service: Microsoft.EventHub

- name: Create subnet
  azure_rm_subnet:
    resource_group: "{{ env_rg }}"
    virtual_network_name: "{{ env_name }}-vnet"
    name: "{{ item.name }}-subnet"
    address_prefix_cidr: "{{ vnet_base | ipsubnet(item.cidr, item.index) }}"
    service_endpoints: "{{ item.endpoints }}"
  loop: "{{ subnets }}"
  register: create_subnet
  retries: 2
  delay: 30
  until: create_subnet is succeeded

This is run and the subnet is created.
An az network vnet subnet show shows us there are no endpoints:

{
  "addressPrefix": "<REDACTED>",
  "addressPrefixes": null,
  "delegations": [],
  "etag": "W/\"<REDACTED>"",
  "id": "<REDACTED>",
  "interfaceEndpoints": null,
  "ipConfigurationProfiles": null,
  "ipConfigurations": null,
  "name": "sl-k8s-sn-subnet",
  "networkSecurityGroup": null,
  "provisioningState": "Succeeded",
  "purpose": null,
  "resourceGroup": "<REDACTED>",
  "resourceNavigationLinks": null,
  "routeTable": null,
  "serviceAssociationLinks": null,
  "serviceEndpointPolicies": null,
  "serviceEndpoints": null,
  "type": "Microsoft.Network/virtualNetworks/subnets"
}

If the above task is run for a second time the subnet is updated and the endpoints added:

{
  "addressPrefix": "<REDACTED>",
  "addressPrefixes": null,
  "delegations": [],
  "etag": "W/\""<REDACTED>"",
  "id": ""<REDACTED>",
  "interfaceEndpoints": null,
  "ipConfigurationProfiles": null,
  "ipConfigurations": null,
  "name": "sl-k8s-sn-subnet",
  "networkSecurityGroup": null,
  "provisioningState": "Succeeded",
  "purpose": null,
  "resourceGroup": ""<REDACTED>",
  "resourceNavigationLinks": null,
  "routeTable": null,
  "serviceAssociationLinks": null,
  "serviceEndpointPolicies": null,
  "serviceEndpoints": [
    {
      "locations": [
        "northeurope"
      ],
      "provisioningState": "Succeeded",
      "service": "Microsoft.Sql"
    },
    {
      "locations": [
        "*"
      ],
      "provisioningState": "Succeeded",
      "service": "Microsoft.AzureCosmosDB"
    },
    {
      "locations": [
        "*"
      ],
      "provisioningState": "Succeeded",
      "service": "Microsoft.EventHub"
    }
  ],
  "type": "Microsoft.Network/virtualNetworks/subnets"
}

I have tried adding the locations to the subnet variable but it does not appear to make a difference.

Error in azure_rm_storageaccount module

When trying to create a storage account with the latest preview module, I'm receiving this error:

The full traceback is:
Traceback (most recent call last):
  File "<stdin>", line 113, in <module>
  File "<stdin>", line 105, in _ansiballz_main
  File "<stdin>", line 48, in invoke_module
  File "/tmp/ansible_azure_rm_storageaccount_payload_hLoWj8/__main__.py", line 589, in <module>
    
  File "/tmp/ansible_azure_rm_storageaccount_payload_hLoWj8/__main__.py", line 585, in main
    
  File "/tmp/ansible_azure_rm_storageaccount_payload_hLoWj8/__main__.py", line 282, in __init__
    
  File "/tmp/ansible_azure_rm_storageaccount_payload_hLoWj8/ansible_azure_rm_storageaccount_payload.zip/ansible/module_utils/azure_rm_common.py", line 310, in __init__
  File "/tmp/ansible_azure_rm_storageaccount_payload_hLoWj8/__main__.py", line 304, in exec_module
    
  File "/tmp/ansible_azure_rm_storageaccount_payload_hLoWj8/__main__.py", line 346, in get_account
    
AttributeError: 'StorageManagementClient' object has no attribute 'blob_services'

failed: [localhost] (item=noeus03devsasimp01) => {
    "changed": false, 
    "item": {
        "storage_account_name": "noeus03devsasimp01", 
        "storage_account_resource_group_name": "NoEu-S03-Dev-Rsg-Simp-01"
    }, 
    "module_stderr": "Traceback (most recent call last):\n  File \"<stdin>\", line 113, in <module>\n  File \"<stdin>\", line 105, in _ansiballz_main\n  File \"<stdin>\", line 48, in invoke_module\n  File \"/tmp/ansible_azure_rm_storageaccount_payload_hLoWj8/__main__.py\", line 589, in <module>\n    \n  File \"/tmp/ansible_azure_rm_storageaccount_payload_hLoWj8/__main__.py\", line 585, in main\n    \n  File \"/tmp/ansible_azure_rm_storageaccount_payload_hLoWj8/__main__.py\", line 282, in __init__\n    \n  File \"/tmp/ansible_azure_rm_storageaccount_payload_hLoWj8/ansible_azure_rm_storageaccount_payload.zip/ansible/module_utils/azure_rm_common.py\", line 310, in __init__\n  File \"/tmp/ansible_azure_rm_storageaccount_payload_hLoWj8/__main__.py\", line 304, in exec_module\n    \n  File \"/tmp/ansible_azure_rm_storageaccount_payload_hLoWj8/__main__.py\", line 346, in get_account\n    \nAttributeError: 'StorageManagementClient' object has no attribute 'blob_services'\n",
    "module_stdout": "", 
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
    "rc": 1
}

azure_rm_deployment - error with "name" parameter

Hi,
In azure_rm_deployment module, when I use "name" parameter I get an error (see below). It's OK when using the alias "deployment_name"

"msg": "Unsupported parameters for (azure_rm_virtualmachine) module: deployment_mode, parameters, template_link, wait_for_deployment_completion Supported parameters include: accept_terms, ad_user, adfs_authority_url, admin_password, admin_username, allocated, api_profile, append_tags, auth_source, availability_set, cert_validation_mode, client_id, cloud_environment, custom_data, data_disks, generalized, image, location, managed_disk_type, name, network_interface_names, open_ports, os_disk_caching, os_disk_name, os_disk_size_gb, os_type, password, plan, profile, public_ip_allocation_method, remove_on_absent, resource_group, restarted, secret, short_hostname, ssh_password_enabled, ssh_public_keys, started, state, storage_account_name, storage_blob_name, storage_container_name, subnet_name, subscription_id, tags, tenant, virtual_network_name, virtual_network_resource_group, vm_size, zones"

ImportError: No module named monitor.version

Hi dear,

My playbook azure, be this error:

The full traceback is:
Traceback (most recent call last):
File "/tmp/ansible_azure_rm_subnet_payload_beyNLU/ansible_azure_rm_subnet_payload.zip/ansible/module_utils/azure_rm_common.py", line 147, in
from azure.mgmt.monitor.version import VERSION as monitor_client_version
ImportError: No module named monitor.version
fatal: [localhost]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"ad_user": null,
"address_prefix_cidr": "10.4.0.0/22",
"adfs_authority_url": null,
"api_profile": "latest",
"append_tags": true,
"auth_source": null,
"cert_validation_mode": null,
"client_id": null,
"cloud_environment": "AzureCloud",

Whats problem?
I installed ansible[azure], azure-mgmt-monitor ,....

using module azure_rm_containerregistry failed

error as below: is it possible to install docker-py dependency in requirements.txt instead of error out later?

ASK [Login docker registry] *******************************************************************************************************************************************************************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "Failed to import docker-py - No module named docker. Try pip install docker-py"}
to retry, use: --limit @/Users/yungez/src/ansible-testapp/role.retry

SDK defaults to api_version 2014-04-01

Hi,

Currently i'm working with the azure_rm_sqldatabase module.

Somehow it always defaults back to api_version=2014-04-01

I've tried adding the module parameter api_version: 'latest' which also results in version 2014-04-01

I've also tried naming it explicitly api_version: '2017-10-01-preview' which results to: 'unknown Azure API profile: 2017-10-01-preview'"}

Also tried: api_version: '2017-10-01' which results in 'unknown Azure API profile: 2017-10-01'

Looking at: https://docs.microsoft.com/en-us/rest/api/sql/databases/createorupdate

'2017-10-01-preview' should be the latest. Which is kind of a problem since the structure has changed slightly.

Am i trying with incorrect parameter values?
Why is latest 2014-04-01 and not 2017-10-01?
Any workaround available to force version 2017?

Please help

Thanks!

storage_mb parameter is not working in azure_rm_postgresqlserver

I can see the storage_mb is always configured with a default value for 5GB.
I'm executing the following provision in the module:

TASK [Create ADP server instance] *************************************************************************************************************************************************
task path: /home/baikal/delivery/ansible/playbook_infra_create_15_dbaas_azure.yml:40
Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/cloud/azure/azure_rm_postgresqlserver.py
<localhost> ESTABLISH LOCAL CONNECTION FOR USER: root
<localhost> EXEC /bin/sh -c 'AZURE_SUBSCRIPTION_ID=xxxxxxxxx python && sleep 0'
 [WARNING]: Azure API profile latest does not define an entry for PostgreSQLManagementClient

changed: [localhost] => {
    "changed": true,
    "fully_qualified_domain_name": "adptest-db.postgres.database.azure.com",
    "id": "/subscriptions/xxxxxxxxx/resourceGroups/adptest-rg/providers/Microsoft.DBforPostgreSQL/servers/adptest-db",
    "invocation": {
        "module_args": {
            "ad_user": null,
            "adfs_authority_url": null,
            "admin_password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "admin_username": "postgres",
            "api_profile": "latest",
            "auth_source": null,
            "cert_validation_mode": null,
            "client_id": null,
            "cloud_environment": "AzureCloud",
            "create_mode": "Default",
            "enforce_ssl": false,
            "location": "northeurope",
            "name": "adptest-db",
            "password": null,
            "profile": null,
            "resource_group": "adptest-rg",
            "secret": null,
            "sku": {
                "capacity": "4",
                "name": "GP_Gen5_4",
                "tier": "GeneralPurpose"
            },
            "state": "present",
            "storage_mb": 307200,
            "subscription_id": null,
            "tenant": null,
            "version": "10"
        }
    },
    "state": "Ready",
    "version": "10"
}

After the ansible module execution I can check the postgres server configuration and I can find the following:

$ az postgres server show --resource-group adptest-rg --name adptest-db
{
  "administratorLogin": "postgres",
  "earliestRestoreDate": "2018-11-09T11:07:05.180000+00:00",
  "fullyQualifiedDomainName": "adptest-db.postgres.database.azure.com",
  "id": "/subscriptions/xxxxxxxxxx/resourceGroups/adptest-rg/providers/Microsoft.DBforPostgreSQL/servers/adptest-db",
  "location": "northeurope",
  "name": "adptest-db",
  "resourceGroup": "adptest-rg",
  "sku": {
    "capacity": 4,
    "family": "Gen5",
    "name": "GP_Gen5_4",
    "size": null,
    "tier": "GeneralPurpose"
  },
  "sslEnforcement": "Disabled",
  "storageProfile": {
    "backupRetentionDays": 7,
    "geoRedundantBackup": "Disabled",
    "storageMb": 5120
  },
  "tags": null,
  "type": "Microsoft.DBforPostgreSQL/servers",
  "userVisibleState": "Ready",
  "version": "10"
}

Where you can see the storageMb capacity of the database server has been provisioned with 5Gb instead the value specified in storage_mb param of azure_rm_postgresqlserver for 300 Gb.

As workaround, after the database server provision I'm executing the following command:

az postgres server update --storage-size 307200 --resource-group adptest-rg --name adptest-db

Now if we check again the current configuration of the database instance we can see it has been correctly provisioned:

$ az postgres server show --resource-group adptest-rg --name adptest-db
{
  "administratorLogin": "postgres",
  "earliestRestoreDate": "2018-11-09T11:07:05.180000+00:00",
  "fullyQualifiedDomainName": "adptest-db.postgres.database.azure.com",
  "id": "/subscriptions/xxxxxxx/resourceGroups/adptest-rg/providers/Microsoft.DBforPostgreSQL/servers/adptest-db",
  "location": "northeurope",
  "name": "adptest-db",
  "resourceGroup": "adptest-rg",
  "sku": {
    "capacity": 4,
    "family": "Gen5",
    "name": "GP_Gen5_4",
    "size": null,
    "tier": "GeneralPurpose"
  },
  "sslEnforcement": "Disabled",
  "storageProfile": {
    "backupRetentionDays": 7,
    "geoRedundantBackup": "Disabled",
    "storageMb": 307200
  },
  "tags": null,
  "type": "Microsoft.DBforPostgreSQL/servers",
  "userVisibleState": "Ready",
  "version": "10"
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.