Converting a VM to a template with VMware vSphere vCenter 6.7

Templates are good for automating the deployment of new virtual machines with tools like Ansible. This guide shows you how to convert a VM managed by vCenter to a template.

Introduction

One of the benefits of virtualization, is that you can quickly deploy new systems without having to install operating systems each time. Ideally, we only want to create a VM and install an operating system once. Then we can convert it to a template, which can be used to deploy multiple virtual machines quickly.

How to convert an existing VM to a template

If the virtual machine has just been created specifically to be used as a template, we just need to convert it by follow the steps below.

Login to vCenter.

Screen shot of vCenter 6.7 login page

  1. Click Hosts and Clusters.
  2. Click on the VM you want to convert.
  3. Click the red power off button.

Screen shot of vCenter 6.7 Hosts and Clusters

Click Yes to Confirm Guest Shut Down.

Screen shot of vCenter 6.7 Confirm Guest Shut Down

  1. Click ACTIONS.
  2. Click Template.
  3. Click Convert to Template.

Screen shot of vCenter 6.7 Convert VM to Template

Click YES to Confirm Convert.

Screen shot of vCenter 6.7 Confirm Convert

The VM will disappear from the Hosts and Clusters view and can no longer be powered on. You can still see the template by switching to the VMs and Templates view.

Now you can create new VMs from this template using the web client or automation tools like Ansible, which I’ll cover in a future post.

How to clone an existing VM to a template

If you have an existing virtual machine that you want to turn into a template but you still want to keep the original VM running, we can clone it to a template with the following steps.

  1. Click ACTIONS.
  2. Click Template.
  3. Click Clone to Template…

vCenter clone to template step 1

Select a host to clone the template to then click NEXT.

vCenter clone to template step 2

Select the storage location then click NEXT.

vCenter clone to template step 3

Click FINISH to start the clone.

vCenter clone to template step 4

Wait foe the clone task to complete.

vCenter clone to template step 5

You can now see the template by clicking on the VMs and Templates button.

vCenter VMs and Templates view

Final thought

As you can see from the steps in this guide, creating templates in vCenter is very easy to do. In this tutorial, we learned how to convert a VM to a template and how to clone a VM to a template.

You may have noticed the VM was a Ubuntu Server 18.04 machine, in a future post, I’ll demonstrate how to use Ansible to automate the deployment of a web server from this template.