Failed to clone a VM with Ansible

  • 20 April 2023
  • 3 replies

Badge +1

In waiting for possibility to deploy VMs from templates with Ansible (see, i’tm trying to use cloning, see playbook below.


The demo playbook with same parameters works fine to get cluster info for "{{ prism_cluster }}".
The cloning fails with error  :
KeyError: 'cluster_reference'

What is missing in playbook ?



This topic has been closed for comments

3 replies

Userlevel 4
Badge +5

Not sure from where you got the option to add a key named cluster. 

Have a look to this example and also use the help option from the CLI to see the syntax and what’s optional or required. 

Badge +1

I found the option in  “ansible-doc nutanix.ncp.ntnx_vms_clone”.

If I don’t add it , I get the following error :

If I add the option with a bad cluster name, I get :

If I set the good cluster name , I get :


What should I do ?

Userlevel 4
Badge +5

Check the steps on the PC GUI with the values you are passing in Ansible and confirm everything works. You don’t need to provide the cluster attribute in Ansible, it is optional. Also, you cannot clone a VM to a different cluster to the source VM. 

The only mandatory attribute for clone module is “src_vm_uuid”. Keep it simple until you find where the issue is.