Ansible: Vmware_guest_Snapshot module does not see the registered VM while creating the snapshot

Hi ,

I am using following code to create a snapshot for a VM already register in a datastore with esxcli command line but it fails in creating snapshot as it is not able to find the VM.

//registering a VM code

- name: Register a VM template
  command:  vim-cmd solo/registervm {{ template_file_path }}
  register: result
  ignore_errors: true

//snapshot creation code

- name: Create snapshot of a vGPU VM
  vmware_guest_snapshot:
     hostname: '{{ hostname }}'
     username: '{{ username }}'
     password: '{{ password }}'
     name: '{{ guest_name }}'
     datacenter: '{{ datacenter_name }}'
     validate_certs: False
     name_match: last
     state: present
     snapshot_name: '{{ snapshotname }}'
     description: snap-1 is the snapshot of '{{guest_name}}'
  delegate_to: localhost
  register: taskresult
  ignore_errors: true

//playbook

//This part registers the VM
- hosts: esx1
  become:  false
  roles:
   - ESX_REGVM  

//This part creates the cluster and add the ESX host to vcenter
- hosts: vcenter
  sudo: false
  roles:
   - VCENTER_HOST_ADD

//this Part( role) actually created the snapshot and fails because it could not see the mentioned VM in the dfatastore
- hosts: vcenter
  become: false
  roles:
     - VCENTER_VM_SnapRestore
*****************************************************************************

I am also not sure why it is passing "/VM" as a folder( below ) though i have not specified any such parameter in the Vmware_guest_Snapshot arguments.

atal: [xxxx -> localhost]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "datacenter": "Datacenter", 
            "description": "snap-1 is the snapshot of 'myvgpu_clone2'", 
            "folder": "/vm", 
            "hostname": "xxxxxx", 
            "name": "myvgpu_clone2", 
            "name_match": "last", 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "snapshot_name": "snap-1", 
            "state": "present", 
            "username": "aXXXX@vsphere.local", 
            "uuid": null, 
            "validate_certs": false
        }
    }, 
    "msg": "Unable to manage snapshots for non-existing VM myvgpu_clone2"
}
...ignoring

--
--

fatal: [xxx -> localhost]: FAILED! => {
    "changed": false, 
    "failed": true, 
    "invocation": {
        "module_args": {
            "datacenter": "Datacenter", 
            "description": "", 
            "folder": "/vm", 
            "hostname": "xxxxxxx", 
            "name": "myvgpu_clone2", 
            "name_match": "last", 
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER", 
            "snapshot_name": "snap-1", 
            "state": "revert", 
            "username": "XXXr@vsphere.local", 
            "uuid": null, 
            "validate_certs": false
        }
    }, 
    "msg": "Unable to manage snapshots for non-existing VM myvgpu_clone2"
}
...ignoring

"
I suspect my registering part of the VM as above. because if I manually register the VM and then call just only the "snapshot create code it succeeds.
also i am registering the VM to ESX's datastore before adding it to the vcenter so that should be OK(?).

Thanks in advance for help!

-VM