# Error: global name 'VirtuaMachineSizeTypes' is not defined

**URL:** <https://forum.ansible.com/t/error-global-name-virtuamachinesizetypes-is-not-defined/21965>\
**Category:** Ansible Project\
**Tags:** azure, ubuntu\
**Created:** [July 8, 2016, 9:54pm UTC](https://forum.ansible.com/t/error-global-name-virtuamachinesizetypes-is-not-defined/21965 "2016-07-08T21:54:22Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adnan\_Khan](https://avatars.discourse-cdn.com/v4/letter/a/dfb087/32.png) [@Adnan\_Khan](https://forum.ansible.com/u/Adnan_Khan)\
**Post date:** [July 8, 2016, 9:54pm UTC](https://forum.ansible.com/t/error-global-name-virtuamachinesizetypes-is-not-defined/21965/1 "2016-07-08T21:54:22Z")

</div>

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:~$](mailto: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:~$](mailto: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:~$](mailto: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

---

<div class="post-metadata">

**Author:** ![M\_Ghaleb](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@M\_Ghaleb](https://forum.ansible.com/u/M_Ghaleb)\
**Post date:** [July 18, 2016, 7:35pm UTC](https://forum.ansible.com/t/error-global-name-virtuamachinesizetypes-is-not-defined/21965/2 "2016-07-18T19:35:13Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![M\_Ghaleb](https://avatars.discourse-cdn.com/v4/letter/m/f4b2a3/32.png) [@M\_Ghaleb](https://forum.ansible.com/u/M_Ghaleb)\
**Post date:** [July 18, 2016, 8:05pm UTC](https://forum.ansible.com/t/error-global-name-virtuamachinesizetypes-is-not-defined/21965/3 "2016-07-18T20:05:21Z")

</div>

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

---

<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 19, 2016, 10:52am UTC](https://forum.ansible.com/t/error-global-name-virtuamachinesizetypes-is-not-defined/21965/4 "2016-07-19T10:52:43Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![girish\_kumar](https://avatars.discourse-cdn.com/v4/letter/g/35a633/32.png) [@girish\_kumar](https://forum.ansible.com/u/girish_kumar)\
**Post date:** [October 20, 2016, 11:26am UTC](https://forum.ansible.com/t/error-global-name-virtuamachinesizetypes-is-not-defined/21965/5 "2016-10-20T11:26:39Z")

</div>

was this issue resolved? i am getting same error
