Error: global name 'VirtuaMachineSizeTypes' is not defined

Hi,

I;m getting the following error when trying to sun a very simple playbook on a new Ubuntu server. See log for more details below.

Error: global name ‘VirtuaMachineSizeTypes’ is not defined

ansiblecontrol@AnsibleControl:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.4 LTS
Release: 14.04
Codename: trusty

ansiblecontrol@AnsibleControl:~$ ansible --version
ansible 2.1.0.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides

/////// Playbook /////////

  • hosts: localhost
    connection: local
    gather_facts: no
    tasks:
  • name: Create VM
    azure_rm_virtualmachine:
    resource_group: Ansible
    name: amktestvm01
    vm_size: Standard_D1
    admin_username: username
    admin_password: password
    image:
    offer: CentOS
    publisher: OpenLogic
    sku: ‘7.1’
    version: latest

/////// AD Credentials /////////

AD Credentials are in the credentials files at .azure/Credential in the format:

[default]
ad_user=
password=
subscription_id=

/////// Error Message /////////
ansiblecontrol@AnsibleControl:~$ ansible-playbook azuredeployvmtest.yml -vvv
Using /etc/ansible/ansible.cfg as config file
[WARNING]: provided hosts list is empty, only localhost is available

PLAYBOOK: azuredeployvmtest.yml ************************************************
1 plays in azuredeployvmtest.yml

PLAY [localhost] ***************************************************************

TASK [Create VM] ***************************************************************
task path: /home/ansiblecontrol/azuredeployvmtest.yml:6
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: ansiblecontrol
<127.0.0.1> EXEC /bin/sh -c ‘( umask 77 && mkdir -p “echo $HOME/.ansible/tmp/ansible-tmp-1468013697.75-124132492023031” && echo ansible-tmp-1468013697.75-124132492023031=“echo $HOME/.ansible/tmp/ansible-tmp-1468013697.75-124132492023031” ) && sleep 0’
<127.0.0.1> PUT /tmp/tmpJSKuVv TO /home/ansiblecontrol/.ansible/tmp/ansible-tmp-1468013697.75-124132492023031/azure_rm_virtualmachine
<127.0.0.1> EXEC /bin/sh -c ‘LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8 /usr/bin/python /home/ansiblecontrol/.ansible/tmp/ansible-tmp-1468013697.75-124132492023031/azure_rm_virtualmachine; rm -rf “/home/ansiblecontrol/.ansible/tmp/ansible-tmp-1468013697.75-124132492023031/” > /dev/null 2>&1 && sleep 0’
An exception occurred during task execution. The full traceback is:
Traceback (most recent call last):
File “/tmp/ansible_OV5bER/ansible_module_azure_rm_virtualmachine.py”, line 1284, in
main()
File “/tmp/ansible_OV5bER/ansible_module_azure_rm_virtualmachine.py”, line 1281, in main
AzureRMVirtualMachine()
File “/tmp/ansible_OV5bER/ansible_module_azure_rm_virtualmachine.py”, line 487, in init
for key in VirtualMachineSizeTypes:
NameError: global name ‘VirtualMachineSizeTypes’ is not defined

fatal: [localhost]: FAILED! => {“changed”: false, “failed”: true, “invocation”: {“module_name”: “azure_rm_virtualmachine”}, “module_stderr”: “Traceback (most recent call last):\n File "/tmp/ansible_OV5bER/ansible_module_azure_rm_virtualmachine.py", line 1284, in \n main()\n File "/tmp/ansible_OV5bER/ansible_module_azure_rm_virtualmachine.py", line 1281, in main\n AzureRMVirtualMachine()\n File "/tmp/ansible_OV5bER/ansible_module_azure_rm_virtualmachine.py", line 487, in init\n for key in VirtualMachineSizeTypes:\nNameError: global name ‘VirtualMachineSizeTypes’ is not defined\n”, “module_stdout”: “”, “msg”: “MODULE FAILURE”, “parsed”: false}

NO MORE HOSTS LEFT *************************************************************
to retry, use: --limit @azuredeployvmtest.retry

PLAY RECAP *********************************************************************
localhost : ok=0 changed=0 unreachable=0 failed=1

hey, any luck with the problem? is it solved?

you need to install azure (pip install azure==2.0.0rc2"

I believe there has been some change recently in the python library used to access azure.
I think right now you might be best off using latest devel version of ansible to try out azure support.

Hope this helps,
Jon

was this issue resolved? i am getting same error