ideadevice / ansible-ahv-provider-plugin

Ansible plugins to interact with AHV APIs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Nutanix_vm not idempotent

yannickstruyf3 opened this issue · comments

Creating a VM using ansible and re-running the playbook without any difference triggers "changed" result.

Putting the state to absent afterwards deletes the vm (this is ok). Re-running the playbook with absent state results in:

TASK [Making sure vm yst-ansible-vm-test is absent] ***********************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: IndexError: list index out of range
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n  File \"/Users/yannick.struyf/.ansible/tmp/ansible-tmp-1628074279.8227048-50762-242166817382614/AnsiballZ_nutanix_vm.py\", line 100, in <module>\n    _ansiballz_main()\n  File \"/Users/yannick.struyf/.ansible/tmp/ansible-tmp-1628074279.8227048-50762-242166817382614/AnsiballZ_nutanix_vm.py\", line 92, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/Users/yannick.struyf/.ansible/tmp/ansible-tmp-1628074279.8227048-50762-242166817382614/AnsiballZ_nutanix_vm.py\", line 40, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.nutanix.nutanix.plugins.modules.nutanix_vm', init_globals=dict(_module_fqn='ansible_collections.nutanix.nutanix.plugins.modules.nutanix_vm', _modlib_path=modlib_path),\n  File \"/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py\", line 210, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  File \"/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  File \"/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  File \"/var/folders/7z/5m6qtyfs3m3_2cnh4jgvhg800000gn/T/ansible_nutanix_vm_payload_ulgql78w/ansible_nutanix_vm_payload.zip/ansible_collections/nutanix/nutanix/plugins/modules/nutanix_vm.py\", line 720, in <module>\n  File \"/var/folders/7z/5m6qtyfs3m3_2cnh4jgvhg800000gn/T/ansible_nutanix_vm_payload_ulgql78w/ansible_nutanix_vm_payload.zip/ansible_collections/nutanix/nutanix/plugins/modules/nutanix_vm.py\", line 366, in main\n  File \"/var/folders/7z/5m6qtyfs3m3_2cnh4jgvhg800000gn/T/ansible_nutanix_vm_payload_ulgql78w/ansible_nutanix_vm_payload.zip/ansible_collections/nutanix/nutanix/plugins/modules/nutanix_vm.py\", line 380, in entry_point\n  File \"/var/folders/7z/5m6qtyfs3m3_2cnh4jgvhg800000gn/T/ansible_nutanix_vm_payload_ulgql78w/ansible_nutanix_vm_payload.zip/ansible_collections/nutanix/nutanix/plugins/modules/nutanix_vm.py\", line 701, in _delete\nIndexError: list index out of range\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

Same for image..!