Using Ansible 2.3 to Clone a VM from one VMware vDC to another vDC

180 views
Skip to first unread message

lcart...@gmail.com

unread,
Mar 24, 2017, 5:39:49 PM3/24/17
to Ansible Project
Hi Experts,

I'd like to know if it is possible to clone a VM from one VMware vDC to another vDC?

I know that I can clone a VM from a template within the same vDC but wanted to know if it was possible to clone between vDCs? 

admin@cso-1:~$ cat Test.yaml 
---
- name: Login to vCenter
  hosts: localhost
  connection: local
  gather_facts: false
  tasks: 
   - name: Clone
     vmware_guest:
       hostname: 10.53.232.168
       datacenter: NFV-vDC1
       username: ansible
       password: ansible123
       esxi_hostname: 10.53.232.180
       validate_certs: False
       name: "myvm"
       state: poweredoff
       disk:
         - size_gb: 150
           type: thin
           datastore: "datastore1"
       hardware:
        memory_mb: 2048
        num_cpus: 2
        osid: ubuntu64guest
        scsi: paravirtual
       template: CSO-1-Template

The template is located in a vDC called NFV-MGMT but I'd like to clone to NFV-vDC1 if possible.

I get the following error:

 "msg": "A specified parameter was not correct: spec.location.host"

Could anyone help please?

Regards,

Lewis

J Hawkesworth

unread,
Mar 27, 2017, 3:51:35 AM3/27/17
to Ansible Project
I haven't tried to do this myself but I know that vmware_guest module has had a lot of development work during 2.3 so might be worth checking if there is an open issue for this in the github project.  I don't have access to a multi-datacenter vsphere so I can't test this myself.

Jon
Reply all
Reply to author
Forward
0 new messages