Creating a virtual machine template in vCenter Server

Learn how to create a virtual machine template, update the template and deploy a VM from a template in vCenter Server.

In VMware vCenter Server, virtual machine templates offer a more secure way of creating new, standardized virtual

machines than using a clone. These templates can help VARs, MSPs and their customers reliably and rapidly scale up a production environment.

This section of Chapter 7 from VCP5 VMware Certified Professional on vSphere 5 Study Guide: Exam VCP-510 from John Wiley and Sons Inc. walks vSphere 5 admins through creating a virtual machine (VM) template, updating an existing template, and deploying virtual machines from a template. 

Creating a Template from an Existing Virtual Machine

In the previous exercise, you cloned a master virtual machine in order to deploy a new virtual machine from it. This process works and is acceptable, but what if another administrator were to power on the master image and make changes to it? One solution to the problem of keeping master images from being modified is to convert these virtual machines to templates. Once a virtual machine is converted to a template, it cannot be powered on in vCenter Server. When a virtual machine is converted to a template, the .vmx file extension changes to .vmtx. The .vmtx file extension designates a template VM. This is shown in Figure 7.1.

vCenter Server datastore browser following VM template useTemplate VM in Datastore Browser 

Templates are also not visible in the Hosts and Clusters view in the vSphere Client. Converting virtual machines to templates is a simple process in vCenter Server. In Exercise 7.2, you will create a template from an existing virtual machine. For the purpose of the exercise, assume that the same Windows Server 2008 R2 virtual machine from Exercise 7.1 will be used as your master image.

EXERCISE 7. 2: Creating a Template from an Existing VM

1. Connect to a vCenter Server with the vSphere Client.

2. Select Hosts And Clusters.

3. Locate the powered-off virtual machine in the left pane. Take note of which ESXi host it is located on. Right-click the virtual machine and select Template > Convert To Template.

4. A Mark Virtual Machine As Template task will begin. When this task completes, the virtual machine will disappear from the Hosts and Clusters view.

5. Select the ESXi host that the virtual machine was located on. Click the Virtual Machines tab. Locate the template in the list. It will now have a template icon, which should make it easier to identify.

VM template icon

6. In the navigation bar at the top of the screen, click the Home icon and then click the VMs And Templates icon located in the Inventory list.

7. Locate the template.

The template is now ready to use. In the next section, you will learn how to deploy a virtual machine from the template you just created.

Deploying a Virtual Machine from a Template

The process of deploying a virtual machine from a template is very similar to the process of cloning a virtual machine. In Exercise 7.3, you will deploy a virtual machine from the template created in Exercise 7.2.

EXERCISE 7.3: Deploying a VM from a Template

1. Connect to a vCenter Server with the vSphere Client.

2. Locate the template created in Exercise 7.2, using the Virtual Machines tab for a selected ESXi host or the VMs And Templates option from the inventory.

3. Right-click the template and review the options that appear in the context menu.

VM template options

 

Note that the available operations for templates include cloning, adding permissions, renaming, removing from the inventory, and deleting.

4. Choose the Deploy Virtual Machine From This Template option. The Deploy Template Wizard will launch.

5. Provide the new virtual machine with a unique name and choose an inventory location. Click Next to continue.

6. Choose the host or cluster that will be used to host the virtual machine. Review any issues reported in the Compatibility window before proceeding. Click Next to continue.

7. If your environment has resource pools, pick a resource pool. Click Next to continue.

8. Using the drop-down menu, select a virtual disk format for the virtual machine. By default, the selection is Same Format As Source. Choose a datastore to store the virtual machine on. Click Next.

9. On the Guest Customization screen, leave the Power On This Virtual Machine After Creation option unchecked. This will give you the chance to review and modify the virtual hardware settings after the virtual machine is deployed.

10. Select the Customize Using An Existing Customization Specification option. A Customization Specification Manager window will appear on the bottom of the screen.

11. Select the customization specification created in Exercise 7.1 by clicking it. Note there is also an option presented to allow the customization specification to be adjusted, but leave this option unchecked for now.

Deploy a VM template

 

12. Click Next and then review the information presented on the Ready To Complete screen.

13. Click Finish to begin deploying the new virtual machine from a template.

14. A Clone Virtual Machine task will begin. When it completes, locate the new virtual machine in the inventory.

I just covered deploying a virtual machine from a template. In the next section, I will cover how to update templates.

Updating Existing Virtual Machine Templates

After a virtual machine is converted to a template, it is not able to be powered on. Although this provides a degree of protection for the master virtual machine image, over time this template will certainly become stale. Build guides may change, vendor-supplied updates will likely need to be applied, and any number of changes will need to happen to get the master virtual machine image compliant with the current standards.

To address these issues, a template can simply be converted back to a virtual machine. Once the template is converted to a virtual machine, it is able to be powered on and updated as necessary. Exercise 7.4 will cover the steps required to convert a template to a virtual machine so that it can be updated.

EXERCISE 7.4: Updating Virtual Machine Templates

1. Connect to a vCenter Server with the vSphere Client.

2. Locate the template created in Exercise 7.2, using the Virtual Machines tab for a selected ESXi host or the VMs And Templates option from the inventory.

3. Right-click the template and choose the Convert To Virtual Machine option that appears in the context menu.

4. The Convert Template to Virtual Machine Wizard will begin.

5. Choose the host or cluster that will be used to host the virtual machine. Review any issues reported in the Compatibility window before proceeding. Click Next to continue.

6. If your environment has resource pools, pick a resource pool. Click Next to continue.

7. Review the information presented on the Ready To Complete screen and click Finish to convert the template to a virtual machine.

8. A Mark As Virtual Machine task will begin. When this task completes, locate the virtual machine in the inventory.

At this point, the template is no more. Browsing the datastore would reveal that the .vmtx file has been replaced with a .vmx file. The virtual machine is now visible again in the Hosts and Clusters view. Because you are now working with a virtual machine, its configuration can be edited. The virtual machine can also be powered on, and updates can be applied to the guest OS. When all of these changes have been made, the virtual machine can be powered off and again converted to a template.

You have now learned how to update templates.

About the author
Brian Atkinson is a senior systems engineer with 15 years of experience in the IT field. For the past six years, he has been focused on virtualization and storage solutions. Brian has been awarded the VMware vExpert designation from VMware for 2009, 2010 and 2011. He is a VMware Technology Network (VMTN) moderator and guru.

Printed with permission from Sybex Inc. Copyright May 2012. VCP5 VMware Certified Professional on vSphere 5 Study Guide: Exam VCP-510 by Brian Atkinson. For more information about this title and other similar books, please visit http://www.sybex.com/WileyCDA/.

This was first published in August 2012

Dig deeper on Virtualization Technology and Services

Pro+

Features

Enjoy the benefits of Pro+ membership, learn more and join.

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

MicroscopeUK

SearchCloudProvider

SearchSecurity

SearchStorage

SearchNetworking

SearchCloudComputing

SearchConsumerization

SearchDataManagement

SearchBusinessAnalytics

Close