Open plrnr opened 5 years ago
You would have to take a snapshot while it is still a VM, then mark it as a template and then link clone from that. Note that some versions of vSphere don't handle this properly, so try it on a test vm before hooking that up to your main automation.
The govc client from the govmomi project lets you create a clone with the following.
$ govc ls -json /mydc/vm/user/template/eval-win81x86-enterprise | jq .elements[].Object.Config | grep -i Template
"Template": true,
$ govc vm.clone -ds=mydc -vm=user/template/eval-win81x86-enterprise -link=true removethis
[05-08-20 17:24:22] Cloning /mydc/vm/user/template/eval-win81x86-enterprise to removethis...(42%)^C
$
So it's definitely possible...
According to this: https://github.com/vmware/pyvmomi/issues/362 you have to have a snapshot which is not possible on a template.
So, is it even possible to do a linked clone out of a template? If not, is there another method to create a VM fastly from template?