In vSphere, Virtual Machine Templates are:
- Virtual Machines that cannot be powered on
- Virtual Machines that cannot be modified
Templates are like gold images, you create a template and deploy multiple VMs from them. Templates configuration files use an extension VMTX (virtual machines configuration files have an extension VMX). There are two easy ways to create a template:
- Clone an existing virtual machine (VM) to a template.
– Creates a copy of an existing VM and registers it as a template.
- Convert an existing VM to a template.
– Unregisters existing VM and registers it as a template.
Workflow for modifying a template:
- First convert the template to VM
- Optionally, make changes to the VM hardware (increase RAM, disk size etc.)
- Power-on the VM and install any new applications or updates
- After installing the application and updates, shutdown the VM
- Now convert the VM back to a template
Deploying Virtual Machines from Templates and Guest Customization:
When virtual machines are deployed from the template, they will identical to the template, things such as Windows-SID and hostnames would same. If using static IPs, those would also be same. This can create software and network conflicts.
To avoid such network or software conflicts, its recommended to customize the VM Guest during the deployment process. For Guest OS customization of virtual machines deployed from templates, vCenter requires the following:
- If the guest OS is Windows, you need VMware Tools and Sysprep utils to be installed within the templates:
- You will need to copy Sysprep tools to vCenter for Windows 2000, XP & 2003. Starting with Windows Vista onward, Sysprep tools are part of the base OS install. Where to copy Sysprep utils, read the following KB#1005593 article
- For Linux VMs/Templates, along with VMware toools, you will also need Perl to be installed within your templates.
Best Practice: Always create templates for powered off virtual machines. Do not clone templates from a powered on virtual machines.