Error: global name 'VirtuaMachineSizeTypes' is not defined

368 views
Skip to first unread message

Adnan Khan

unread,
Jul 8, 2016, 6:09:43 PM7/8/16
to Ansible Project
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 <module>
    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 <module>\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

Mohamed Ghaleb

unread,
Jul 18, 2016, 3:35:20 PM7/18/16
to Ansible Project
hey, any luck with the problem? is it solved?


On Saturday, July 9, 2016 at 12:09:43 AM UTC+2, Adnan Khan wrote:
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



No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:        14.04
Codename:       trusty


/////// Error Message  /////////
ansible...@AnsibleControl:~$ ansible-playbook azuredeployvmtest.yml -vvv

J Hawkesworth

unread,
Jul 19, 2016, 6:52:43 AM7/19/16
to Ansible Project
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

Mohamed Ghaleb

unread,
Jul 20, 2016, 10:53:18 AM7/20/16
to Ansible Project
you need to install azure (pip install azure==2.0.0rc2"

girish kumar

unread,
Oct 20, 2016, 1:01:29 PM10/20/16
to Ansible Project
was this issue resolved? i am getting same error


On Saturday, 9 July 2016 03:39:43 UTC+5:30, Adnan Khan wrote:
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



No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:        14.04
Codename:       trusty


/////// Error Message  /////////
ansible...@AnsibleControl:~$ ansible-playbook azuredeployvmtest.yml -vvv

Reply all
Reply to author
Forward
0 new messages