What version of Ansible and Python are you running? 

I have seen odd errors like your 
KeyError: 'diskSizeGB'
with the azure_rm_devtestlabvirtualmachine - seems almost like it isnt 
properly determining what fields are required and whats not. I was seeing 
things like the virtual network being a required field, even if I set state 
= absent which doesnt seem to make sense if all is wanted is to delete a 
VM. 



On Wednesday, June 5, 2019 at 11:55:23 AM UTC-4, Tuyen Nguyen wrote:
>
> An update on this is that if the VM is already on, and I use the playbook 
> to turn off the VM, then after that all subsequent requests to manage that 
> VM to turn on or off the VM will always work.
>
>
> On Tuesday, June 4, 2019 at 10:35:10 AM UTC-4, Tuyen Nguyen wrote:
>>
>> Hi
>>
>> I am getting the following error whenever I try to control an Azure VM to 
>> start or stop:
>>
>> The full traceback is:
>> Traceback (most recent call last):
>>   File 
>> "/tmp/ansible-tmp-1559657705.67-271285273530579/AnsiballZ_azure_rm_virtualmachine.py",
>>  
>> line 114, in 
>>     _ansiballz_main()
>>   File 
>> "/tmp/ansible-tmp-1559657705.67-271285273530579/AnsiballZ_azure_rm_virtualmachine.py",
>>  
>> line 106, in _ansiballz_main
>>     invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
>>   File 
>> "/tmp/ansible-tmp-1559657705.67-271285273530579/AnsiballZ_azure_rm_virtualmachine.py",
>>  
>> line 49, in invoke_module
>>     imp.load_module('__main__', mod, module, MOD_DESC)
>>   File "/tmp/ansible_azure_rm_virtualmachine_payload_I72j_4/__main__.py", 
>> line 2045, in 
>>   File "/tmp/ansible_azure_rm_virtualmachine_payload_I72j_4/__main__.py", 
>> line 2041, in main
>>   File "/tmp/ansible_azure_rm_virtualmachine_payload_I72j_4/__main__.py", 
>> line 853, in __init__
>>   File 
>> "/tmp/ansible_azure_rm_virtualmachine_payload_I72j_4/ansible_azure_rm_virtualmachine_payload.zip/ansible/module_utils/azure_rm_common.py",
>>  
>> line 325, in __init__
>>   File "/tmp/ansible_azure_rm_virtualmachine_payload_I72j_4/__main__.py", 
>> line 1434, in exec_module
>> KeyError: 'diskSizeGB'
>> fatal: [localhost]: FAILED! => {
>>     "changed": false, 
>>     "module_stderr": "Traceback (most recent call last):\n  File 
>> \"/tmp/ansible-tmp-1559657705.67-271285273530579/AnsiballZ_azure_rm_virtualmachine.py\",
>>  
>> line 114, in \n    _ansiballz_main()\n  File 
>> \"/tmp/ansible-tmp-1559657705.67-271285273530579/AnsiballZ_azure_rm_virtualmachine.py\",
>>  
>> line 106, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, 
>> ANSIBALLZ_PARAMS)\n  File 
>> \"/tmp/ansible-tmp-1559657705.67-271285273530579/AnsiballZ_azure_rm_virtualmachine.py\",
>>  
>> line 49, in invoke_module\n    imp.load_module('__main__', mod, module, 
>> MOD_DESC)\n  File 
>> \"/tmp/ansible_azure_rm_virtualmachine_payload_I72j_4/__main__.py\", line 
>> 2045, in \n  File 
>> \"/tmp/ansible_azure_rm_virtualmachine_payload_I72j_4/__main__.py\", line 
>> 2041, in main\n  File 
>> \"/tmp/ansible_azure_rm_virtualmachine_payload_I72j_4/__main__.py\", line 
>> 853, in __init__\n  File 
>> \"/tmp/ansible_azure_rm_virtualmachine_payload_I72j_4/ansible_azure_rm_virtualmachine_payload.zip/ansible/module_utils/azure_rm_common.py\",
>>  
>> line 325, in __init__\n  File 
>> \"/tmp/ansible_azure_rm_virtualmachine_payload_I72j_4/__main__.py\", line 
>> 1434, in exec_module\nKeyError: 'diskSizeGB'\n", 
>>     "module_stdout": "", 
>>     "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", 
>>     "rc": 1
>> }
>>
>> In the playbook, I have it configured as follows:
>>
>> - azure_rm_virtualmachine:
>>   resource_group: RESOURCEGROUP
>>   name: <VMName>
>>   started: yes
>>   allocated: yes
>>
>> or 
>>
>> - azure_rm_virtualmachine:
>>   resource_group: RESOURCEGROUP
>>   name: <VMName>
>>   started: no
>>   allocated: no
>>
>> Somehow I got it to work for one of my VMs, but it is not working 
>> others.  
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/547a459a-9aac-40de-bedd-d99ffc35f5ca%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to