Version (and other) problems with Ansible Azure Modules

572 views
Skip to first unread message

Steven Carter

unread,
Jul 1, 2016, 11:29:17 AM7/1/16
to Ansible Project
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:


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 <module>
    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 <module>\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.

Steven Carter

unread,
Jul 1, 2016, 5:04:54 PM7/1/16
to Ansible Project
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.

Matt Davis

unread,
Jul 1, 2016, 5:36:29 PM7/1/16
to Ansible Project
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

Steven Carter

unread,
Jul 1, 2016, 6:10:15 PM7/1/16
to Ansible Project
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.

Matt Davis

unread,
Jul 5, 2016, 6:11:51 PM7/5/16
to Ansible Project
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. ;)

Steven Carter

unread,
Jul 6, 2016, 11:26:17 PM7/6/16
to ansible...@googlegroups.com
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 <module>
    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 <module>\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.

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/Ln51G5wx03g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/31a7b1c7-32e2-452a-afa4-4b499470db79%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

J Hawkesworth

unread,
Jul 7, 2016, 4:38:05 AM7/7/16
to Ansible Project
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

Steven Carter

unread,
Jul 7, 2016, 8:51:12 AM7/7/16
to ansible...@googlegroups.com
I am installing with 'pip install --no-cache-dir git+git://github.com/ansible/ansible.git@stable-2.1', so the source directory gets plowed over every time.

Thanks,

Steven.

Matt Davis

unread,
Jul 7, 2016, 2:02:08 PM7/7/16
to Ansible Project
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


On Thursday, July 7, 2016 at 5:51:12 AM UTC-7, Steven Carter wrote:
I am installing with 'pip install --no-cache-dir git+git://github.com/ansible/ansible.git@stable-2.1', so the source directory gets plowed over every time.

Thanks,

Steven.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.

Steven Carter

unread,
Jul 7, 2016, 9:25:25 PM7/7/16
to ansible...@googlegroups.com
That worked!  I really appreciate it!  Should the other functions work at this point or will that still take some time?

Steven.

On Thu, Jul 7, 2016 at 2:02 PM, Matt Davis <mda...@ansible.com> wrote:
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


On Thursday, July 7, 2016 at 5:51:12 AM UTC-7, Steven Carter wrote:
I am installing with 'pip install --no-cache-dir git+git://github.com/ansible/ansible.git@stable-2.1', so the source directory gets plowed over every time.

Thanks,

Steven.

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/Ln51G5wx03g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.

Matt Davis

unread,
Jul 8, 2016, 3:06:08 PM7/8/16
to Ansible Project
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


On Thursday, July 7, 2016 at 6:25:25 PM UTC-7, Steven Carter wrote:
That worked!  I really appreciate it!  Should the other functions work at this point or will that still take some time?

Steven.
On Thu, Jul 7, 2016 at 2:02 PM, Matt Davis <mda...@ansible.com> wrote:
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


On Thursday, July 7, 2016 at 5:51:12 AM UTC-7, Steven Carter wrote:
I am installing with 'pip install --no-cache-dir git+git://github.com/ansible/ansible.git@stable-2.1', so the source directory gets plowed over every time.

Thanks,

Steven.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/Ln51G5wx03g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-project+unsubscribe@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.

Andrea Dixon

unread,
Aug 29, 2016, 10:24:57 AM8/29/16
to Ansible Project
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 <module>
    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.
-Matt

--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/Ln51G5wx03g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.


--------------------

Note: The information contained in this message may be privileged and confidential and protected from disclosure. If the reader of this message is not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us immediately by replying to the message and deleting it from your computer.  Thank you.  CafeX Communications.


Matt Davis

unread,
Aug 29, 2016, 8:58:12 PM8/29/16
to Ansible Project
It doesn't look like your Azure SDK is at the correct version- the rc5 version of ComputeManagementClient does indeed take two positional args, and the version you have installed clearly only takes one. 

Andrea Dixon

unread,
Aug 30, 2016, 4:28:22 PM8/30/16
to Ansible Project
The issue is not on the constructor line though it's at line 146 of ComputeManagementClient which is the Serializer (inside the constructor)

Matt Davis

unread,
Sep 1, 2016, 12:03:47 PM9/1/16
to Ansible Project
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.

Andrea Dixon

unread,
Oct 19, 2016, 11:08:23 AM10/19/16
to Ansible Project
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?

Matt Davis

unread,
Oct 19, 2016, 3:52:46 PM10/19/16
to Ansible Project
Everything 2.1.1+ should work with either rc5 or rc6 (TMK there were no breaking changes against our Azure footprint in rc6).

Brad Sturgis

unread,
Feb 23, 2017, 12:06:15 PM2/23/17
to Ansible Project
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

Trond Hindenes

unread,
Feb 24, 2017, 12:49:13 PM2/24/17
to Ansible Project
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
Reply all
Reply to author
Forward
0 new messages