# Version (and other) problems with Ansible Azure Modules

**URL:** <https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907>\
**Category:** Ansible Project\
**Tags:** azure\
**Created:** [July 1, 2016, 3:29pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907 "2016-07-01T15:29:16Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Steven\_Carter](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Steven\_Carter](https://forum.ansible.com/u/Steven_Carter)\
**Post date:** [July 1, 2016, 3:29pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/1 "2016-07-01T15:29:16Z")

</div>

when trying to run:

- hosts: localhost  
connection: local  
gather\_facts: yes  
vars:  
azure\_region: ‘eastus’

tasks:

- name: Get facts for one resource group  
azure\_rm\_resourcegroup\_facts:  
name: stevenca-csr

I get:

fatal: [localhost]: FAILED! =\> {“changed”: false, “failed”: true, “invocation”: {“module\_args”: {“ad\_user”: null, “client\_id”: null, “name”: “stevenca-csr”, “password”: null, “profile”: null, “secret”: null, “subscription\_id”: null, “tags”: null, “tenant”: null}, “module\_name”: “azure\_rm\_resourcegroup\_facts”}, “msg”: “Expecting azure.mgmt.compute. **version** to be \>= 2016-03-30. Found version 0.30.0rc5 Do you have Azure \>= 2.0.0rc2 installed?”}

This seems to be related to:

[https://github.com/ansible/ansible/issues/16480](https://github.com/ansible/ansible/issues/16480)

Although I am using Ansible 2.1.0.0. When I work around that issue by replacing:

AZURE\_MIN\_VERSION = “2016-03-30” with AZURE\_MIN\_VERSION = “0.30.0rc5” in /usr/lib/python2.7/site-packages/ansible/module\_utils/azure\_rm\_common.py

I still get:

An exception occurred during task execution. The full traceback is:  
Traceback (most recent call last):  
File “/tmp/ansible\_J5TjZd/ansible\_module\_azure\_rm\_resourcegroup\_facts.py”, line 172, in   
main()  
File “/tmp/ansible\_J5TjZd/ansible\_module\_azure\_rm\_resourcegroup\_facts.py”, line 169, in main  
AzureRMResourceGroupFacts()  
File “/tmp/ansible\_J5TjZd/ansible\_module\_azure\_rm\_resourcegroup\_facts.py”, line 125, in **init**  
facts\_module=True)  
File “/tmp/ansible\_J5TjZd/ansible\_modlib.zip/ansible/module\_utils/azure\_rm\_common.py”, line 178, in **init**  
File “/tmp/ansible\_J5TjZd/ansible\_module\_azure\_rm\_resourcegroup\_facts.py”, line 133, in exec\_module  
self.results[‘objects’] = self.get\_item()  
File “/tmp/ansible\_J5TjZd/ansible\_module\_azure\_rm\_resourcegroup\_facts.py”, line 145, in get\_item  
item = self.rm\_client.resource\_groups.get(self.name)  
File “/tmp/ansible\_J5TjZd/ansible\_modlib.zip/ansible/module\_utils/azure\_rm\_common.py”, line 621, in rm\_client  
TypeError: **init** () takes at least 3 arguments (2 given)

fatal: [localhost]: FAILED! =\> {“changed”: false, “failed”: true, “invocation”: {“module\_name”: “azure\_rm\_resourcegroup\_facts”}, “module\_stderr”: “Traceback (most recent call last):\n File "/tmp/ansible\_J5TjZd/ansible\_module\_azure\_rm\_resourcegroup\_facts.py", line 172, in \n main()\n File "/tmp/ansible\_J5TjZd/ansible\_module\_azure\_rm\_resourcegroup\_facts.py", line 169, in main\n AzureRMResourceGroupFacts()\n File "/tmp/ansible\_J5TjZd/ansible\_module\_azure\_rm\_resourcegroup\_facts.py", line 125, in **init** \n facts\_module=True)\n File "/tmp/ansible\_J5TjZd/ansible\_modlib.zip/ansible/module\_utils/azure\_rm\_common.py", line 178, in **init** \n File "/tmp/ansible\_J5TjZd/ansible\_module\_azure\_rm\_resourcegroup\_facts.py", line 133, in exec\_module\n self.results[‘objects’] = self.get\_item()\n File "/tmp/ansible\_J5TjZd/ansible\_module\_azure\_rm\_resourcegroup\_facts.py", line 145, in get\_item\n item = self.rm\_client.resource\_groups.get(self.name)\n File "/tmp/ansible\_J5TjZd/ansible\_modlib.zip/ansible/module\_utils/azure\_rm\_common.py", line 621, in rm\_client\nTypeError: **init** () takes at least 3 arguments (2 given)\n”, “module\_stdout”: “”, “msg”: “MODULE FAILURE”, “parsed”: false}

This leads me to believe that I I have some substantial version problems with my setup or this stuff just does not work yet. Can someone make me less ignorant here (at least with this specific topic)?

Thanks,

Steven.

---

<div class="post-metadata">

**Author:** ![Steven\_Carter](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Steven\_Carter](https://forum.ansible.com/u/Steven_Carter)\
**Post date:** [July 1, 2016, 9:04pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/2 "2016-07-01T21:04:54Z")

</div>

I was able to work around this by using Ansible 2.2.0. Does the problem exist in 2.1.0.1? Should I be using that instead?

Thanks,

Steven.

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [July 1, 2016, 9:36pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/3 "2016-07-01T21:36:29Z")

</div>

The Azure Python SDK is unfortunately still unreleased and a bit of a moving target, which is the cause of the issues you’re seeing. Microsoft released a new RC on that stuff within a couple days of us shipping Ansible 2.1.0 that broke everything. We may end up retroactively labeling the new Azure RM modules as “tech preview” while their Python stuff settles down.

I’ve pushed some fixes to stable-2.1 and devel that should more-or-less make things work again in the next release, and Chris Houseknecht is doing a much more extensive pass over everything with the new Python SDK RC5 to make sure everything is good to go- those changes will hopefully land in 2.1.1 as well.

-Matt

---

<div class="post-metadata">

**Author:** ![Steven\_Carter](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Steven\_Carter](https://forum.ansible.com/u/Steven_Carter)\
**Post date:** [July 1, 2016, 10:10pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/4 "2016-07-01T22:10:15Z")

</div>

Is there a combination of azure python + Ansible that will work or is azure 2.0.0rc5 + stable-2.1 my best bet?

Thanks,

Steven.

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [July 5, 2016, 10:11pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/5 "2016-07-05T22:11:50Z")

</div>

Yep, if you’re happy running from source, that’s probably your best bet- we’ll be backporting fixes to the Azure modules to stable-2.1 at least until 2.2 releases in late summer/early fall. Last I heard, RC5 was supposed to become the final release of the Azure Python SDK. Doing “real work” from the bleeding edge on devel is definitely a recipe for, well, bleeding. 😉

---

<div class="post-metadata">

**Author:** ![Steven\_Carter](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Steven\_Carter](https://forum.ansible.com/u/Steven_Carter)\
**Post date:** [July 7, 2016, 3:26am UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/6 "2016-07-07T03:26:10Z")

</div>

Strange, I thought that I had this working with azure 2.0.0rc5 + ansible stable-2.1, but when I tried to re-install and run my ansible, I get:

An exception occurred during task execution. The full traceback is:  
Traceback (most recent call last):  
File “/tmp/ansible\_nsnYjC/ansible\_module\_azure\_rm\_deployment.py”, line 661, in   
main()  
File “/tmp/ansible\_nsnYjC/ansible\_module\_azure\_rm\_deployment.py”, line 657, in main  
AzureRMDeploymentManager()  
File “/tmp/ansible\_nsnYjC/ansible\_module\_azure\_rm\_deployment.py”, line 438, in **init**  
supports\_check\_mode=False)  
File “/tmp/ansible\_nsnYjC/ansible\_modlib.zip/ansible/module\_utils/azure\_rm\_common.py”, line 192, in **init**  
File “/tmp/ansible\_nsnYjC/ansible\_module\_azure\_rm\_deployment.py”, line 449, in exec\_module  
deployment = self.deploy\_template()  
File “/tmp/ansible\_nsnYjC/ansible\_module\_azure\_rm\_deployment.py”, line 476, in deploy\_template  
deploy\_parameter = DeploymentProperties()  
TypeError: **init** () takes at least 2 arguments (1 given)

fatal: [localhost]: FAILED! =\> {“changed”: false, “failed”: true, “invocation”: {“module\_name”: “azure\_rm\_deployment”}, “module\_stderr”: “Traceback (most recent call last):\n File "/tmp/ansible\_nsnYjC/ansible\_module\_azure\_rm\_deployment.py", line 661, in \n main()\n File "/tmp/ansible\_nsnYjC/ansible\_module\_azure\_rm\_deployment.py", line 657, in main\n AzureRMDeploymentManager()\n File "/tmp/ansible\_nsnYjC/ansible\_module\_azure\_rm\_deployment.py", line 438, in **init** \n supports\_check\_mode=False)\n File "/tmp/ansible\_nsnYjC/ansible\_modlib.zip/ansible/module\_utils/azure\_rm\_common.py", line 192, in **init** \n File "/tmp/ansible\_nsnYjC/ansible\_module\_azure\_rm\_deployment.py", line 449, in exec\_module\n deployment = self.deploy\_template()\n File "/tmp/ansible\_nsnYjC/ansible\_module\_azure\_rm\_deployment.py", line 476, in deploy\_template\n deploy\_parameter = DeploymentProperties()\nTypeError: **init** () takes at least 2 arguments (1 given)\n”, “module\_stdout”: “”, “msg”: “MODULE FAILURE”, “parsed”: false}

Would azure 2.0.0rc5 have changed in the past week? I had resorted to only using azure\_rm\_resourcegroup and azure\_rm\_deployment, but not azure\_rm\_deployment is not working. Any advice for, at least, getting azure\_rm\_deployment working again?

Thanks,

Steven.

---

<div class="post-metadata">

**Author:** ![j.r.hawkesworth](https://avatars.discourse-cdn.com/v4/letter/j/a3d4f5/32.png) [@j.r.hawkesworth](https://forum.ansible.com/u/j.r.hawkesworth)\
**Post date:** [July 7, 2016, 8:38am UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/7 "2016-07-07T08:38:04Z")

</div>

Just a guess but if you are running ansible from source and switching between branches, you may need to run a

make clean

to get rid of any .pyc files

Hope this helps,

Jon

---

<div class="post-metadata">

**Author:** ![Steven\_Carter](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Steven\_Carter](https://forum.ansible.com/u/Steven_Carter)\
**Post date:** [July 7, 2016, 12:51pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/8 "2016-07-07T12:51:00Z")

</div>

I am installing with ‘pip install --no-cache-dir git+git://[github.com/ansible/ansible.git@stable-2.1](http://github.com/ansible/ansible.git@stable-2.1)’, so the source directory gets plowed over every time.

Thanks,

Steven.

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [July 7, 2016, 6:02pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/9 "2016-07-07T18:02:07Z")

</div>

Yeah, looks like the azure\_rm\_deployment module got missed for rc5 updates. I’ve tested and pushed a fix to devel and stable-2.1 (just in the nick of time for 2.1.1rc2), so try updating from stable-2.1 with submodules- should work now.

-Matt

---

<div class="post-metadata">

**Author:** ![Steven\_Carter](https://avatars.discourse-cdn.com/v4/letter/s/a183cd/32.png) [@Steven\_Carter](https://forum.ansible.com/u/Steven_Carter)\
**Post date:** [July 8, 2016, 1:25am UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/10 "2016-07-08T01:25:14Z")

</div>

That worked! I really appreciate it! Should the other functions work at this point or will that still take some time?

Steven.

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [July 8, 2016, 7:06pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/11 "2016-07-08T19:06:08Z")

</div>

I’ve cherry-picked everything back to 2.1 that’s been fixed in devel, so it _should_ all work on current stable-2.1 (slash 2.1.1 RC2). If there’s stuff that still isn’t working, please file issues so we can get it fixed.

Thanks!

-Matt

---

<div class="post-metadata">

**Author:** ![Andrea\_Dixon](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@Andrea\_Dixon](https://forum.ansible.com/u/Andrea_Dixon)\
**Post date:** [August 26, 2016, 1:54pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/12 "2016-08-26T13:54:59Z")

</div>

Is azure 2.0.0rc5 + ansible stable-2.1 supposed to work now? I have azure python sdk 2.0.0rc5 installed and I’m trying to run the azure\_rm.py inventory file that I plucked from the head of stable-2.1 but I get the following error:

[cafex@cfx-ansible stable-2.1]$ ./azure\_rm.py --list  
Traceback (most recent call last):  
File “./azure\_rm.py”, line 763, in   
main()  
File “./azure\_rm.py”, line 760, in main  
AzureInventory()  
File “./azure\_rm.py”, line 369, in **init**  
self.\_compute\_client = rm.compute\_client  
File “./azure\_rm.py”, line 353, in compute\_client  
self.\_compute\_client = ComputeManagementClient(self.azure\_credentials, self.subscription\_id)  
File “/usr/lib/python2.7/site-packages/azure/mgmt/compute/compute\_management\_client.py”, line 146, in **init**  
self.\_serialize = Serializer(client\_models)  
TypeError: **init** () takes exactly 1 argument (2 given)

I’m assuming this azure\_rm.py just has a dependency on the azure sdk and not my ansible install? As my ansible is not from stable-2.1.

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [August 30, 2016, 12:58am UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/13 "2016-08-30T00:58:11Z")

</div>

It doesn’t look like your Azure SDK is at the correct version- the [rc5 version of ComputeManagementClient](https://github.com/Azure/azure-sdk-for-python/blob/master/azure-mgmt-compute/azure/mgmt/compute/compute_management_client.py#L66) does indeed take two positional args, and the version you have installed clearly only takes one.

---

<div class="post-metadata">

**Author:** ![Andrea\_Dixon](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@Andrea\_Dixon](https://forum.ansible.com/u/Andrea_Dixon)\
**Post date:** [August 30, 2016, 1:57pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/14 "2016-08-30T13:57:52Z")

</div>

The issue is not on the constructor line though it’s at line 146 of ComputeManagementClient which is the Serializer (inside the constructor)

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [September 1, 2016, 4:03pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/15 "2016-09-01T16:03:47Z")

</div>

That’s not us calling that, it’s the Azure Python SDK calling itself, so something is internally out of sync (possibly stale .pyc files?). The way they package “azure” as a empty meta-package that depends on lots of other packages makes it really easy for things to get out of sync, especially with some older busted versions of pip that can mask dependency failures. I’d suggest pip uninstalling every azure-\* package (uninstalling “azure” by itself is useless) and see if you can reinstall.

---

<div class="post-metadata">

**Author:** ![Andrea\_Dixon](https://avatars.discourse-cdn.com/v4/letter/a/bbe5ce/32.png) [@Andrea\_Dixon](https://forum.ansible.com/u/Andrea_Dixon)\
**Post date:** [October 18, 2016, 3:55pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/16 "2016-10-18T15:55:31Z")

</div>

Thanks! Uninstalling every azure-\* package certainly helped me get one of my environments working! That’s now running 2.1-stable from source with 2.0.0rc5.  
Is there a stable version of ansible that works with azure 2.0.0rc5?

---

<div class="post-metadata">

**Author:** ![Matt\_Davis](https://avatars.discourse-cdn.com/v4/letter/m/ce7236/32.png) [@Matt\_Davis](https://forum.ansible.com/u/Matt_Davis)\
**Post date:** [October 19, 2016, 7:52pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/17 "2016-10-19T19:52:46Z")

</div>

Everything 2.1.1+ should work with either rc5 or rc6 (TMK there were no breaking changes against our Azure footprint in rc6).

---

<div class="post-metadata">

**Author:** ![Brad\_Sturgis](https://avatars.discourse-cdn.com/v4/letter/b/76d3ee/32.png) [@Brad\_Sturgis](https://forum.ansible.com/u/Brad_Sturgis)\
**Post date:** [February 23, 2017, 5:06pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/18 "2017-02-23T17:06:15Z")

</div>

Hi Matt,

Please let me know if you can help.

I have gotten Ansible 2.2.1.0 working fine with Amazon AWS. But I am getting a 403 Forbidden Error when trying to provision a Resource group. I can delete a resource group I created on Azure though so my service principal must be correct. Here is the message on fail:

“module\_name”: “azure\_rm\_storageaccount”  
},  
“msg”: “Parameter error: resource group Fun2 not found”

msg": “Error checking for existence of name Fun2 - 403 Client Error: Forbidden”  
}

Or, if you know anyone who can help. I am trying to get started with Azure automation like I have successfully done with Amazon AWS.

Thanks,

Brad

---

<div class="post-metadata">

**Author:** ![Trond\_Hindenes](https://avatars.discourse-cdn.com/v4/letter/t/96bed5/32.png) [@Trond\_Hindenes](https://forum.ansible.com/u/Trond_Hindenes)\
**Post date:** [February 24, 2017, 5:49pm UTC](https://forum.ansible.com/t/version-and-other-problems-with-ansible-azure-modules/21907/19 "2017-02-24T17:49:12Z")

</div>

We’re using the Azure RG module all the time on RC5. Here’s my complete _azure_ pip freeze from our prod Ansible control node:

`

azure==2.0.0rc5  
azure-batch==0.30.0rc5  
azure-common==1.1.4  
azure-graphrbac==0.30.0rc5  
azure-mgmt==0.30.0rc5  
azure-mgmt-authorization==0.30.0rc5  
azure-mgmt-batch==0.30.0rc5  
azure-mgmt-cdn==0.30.0rc5  
azure-mgmt-cognitiveservices==0.30.0rc5  
azure-mgmt-commerce==0.30.0rc5  
azure-mgmt-compute==0.30.0rc5  
azure-mgmt-keyvault==0.30.0rc5  
azure-mgmt-logic==0.30.0rc5  
azure-mgmt-network==0.30.0rc5  
azure-mgmt-notificationhubs==0.30.0rc5  
azure-mgmt-nspkg==1.0.0  
azure-mgmt-powerbiembedded==0.30.0rc5  
azure-mgmt-redis==0.30.0rc5  
azure-mgmt-resource==0.30.0rc5  
azure-mgmt-scheduler==0.30.0rc5  
azure-mgmt-storage==0.30.0rc5  
azure-mgmt-web==0.30.0rc5  
azure-nspkg==1.0.0  
azure-servicebus==0.20.2  
azure-servicemanagement-legacy==0.20.3  
azure-storage==0.32.0  
msrestazure==0.4.3

`
