ansible-for-nsxt icon indicating copy to clipboard operation
ansible-for-nsxt copied to clipboard

Not able to update VM tags

Open rororiri opened this issue 3 years ago • 1 comments

Hi there,

I have been working with ansible-for-nsxt as part of our VM deployment workflow. Since we moved to NSX 3.1, I am not able to assign tags to VM using module nsxt_vm_tags anymore.

Any attempt returns the following error:

**"msg": "Failed to update tags on VM None as API returned error: (500, {'module_name': 'common-services', 'error_message': 'General error has occurred.', 'details': 'java.lang.NullPointerException', 'error_code': 100}). Please try again"**

Other modules work ok and I can update tags using POST request instead, but that is much less versatile.

Any chance this is reproduced and fixable ?

rororiri avatar Sep 29 '21 08:09 rororiri

I Have the same problem!

After diving in to code, i think the URLs in nsxt_resource_urls.py, need to be updated

https://github.com/vmware/ansible-for-nsxt/blob/e02182b71a7adb4634248e15c2750812d27c6f84/plugins/module_utils/nsxt_resource_urls.py#L63-L65

I have always used the https://<nsx-manager>/api/v1/fabric/virtual-machines/virtual-machines url when fetchig tags and id of the VM.

after looking around more i can see that the base url is har loocked to '/policy/api/v1' in this case the simpel solution is to talk ti the /fabrik end point. https://github.com/vmware/ansible-for-nsxt/blob/e02182b71a7adb4634248e15c2750812d27c6f84/plugins/module_utils/policy_communicator.py#L101

urskog84 avatar Oct 13 '21 07:10 urskog84