Chapter 7. Templates
Note
7.1. Sealing Virtual Machines in Preparation for Deployment as Templates
7.1.1. Sealing a Linux Virtual Machine for Deployment as a Template
sys-unconfig command. Sealing a Linux virtual machine manually requires you to create a file on the virtual machine that acts as a flag for initiating various configuration tasks the next time you start that virtual machine. The sys-unconfig command allows you to automate this process. However, both of these methods also require you to manually delete files on the virtual machine that are specific to that virtual machine or might cause conflicts amongst virtual machines created based on the template you will create based on that virtual machine. As such, both are valid methods for sealing a Linux virtual machine and will achieve the same result.
7.1.1.1. Sealing a Linux Virtual Machine Manually for Deployment as a Template
Procedure 7.1. Sealing a Linux Virtual Machine
- Log in to the virtual machine.
- Flag the system for re-configuration:
# touch /.unconfigured
- Remove ssh host keys:
# rm -rf /etc/ssh/ssh_host_*
- Set
HOSTNAME=localhost.localdomainin/etc/sysconfig/networkfor Red Hat Enterprise Linux 6 or/etc/hostnamefor Red Hat Enterprise Linux 7. - Remove
/etc/udev/rules.d/70-*:# rm -rf /etc/udev/rules.d/70-*
- Remove the
HWADDRline andUUIDline from/etc/sysconfig/network-scripts/ifcfg-eth*. - Optionally, delete all the logs from
/var/logand build logs from/root. - Shut down the virtual machine:
# poweroff
7.1.1.2. Sealing a Linux Virtual Machine for Deployment as a Template using sys-unconfig
Procedure 7.2. Sealing a Linux Virtual Machine using sys-unconfig
- Log in to the virtual machine.
- Remove ssh host keys:
# rm -rf /etc/ssh/ssh_host_*
- Set
HOSTNAME=localhost.localdomainin/etc/sysconfig/networkfor Red Hat Enterprise Linux 6 or/etc/hostnamefor Red Hat Enterprise Linux 7. - Remove the
HWADDRline andUUIDline from/etc/sysconfig/network-scripts/ifcfg-eth*. - Optionally, delete all the logs from
/var/logand build logs from/root. - Run the following command:
# sys-unconfig
7.1.2. Sealing a Windows Virtual Machine for Deployment as a Template
/usr/share/ovirt-engine/conf/sysprep/ directory. These files act as templates for Sysprep. The fields in these files can be copied, pasted, and altered as required. This definition will override any values entered into the Initial Run fields of the Edit Virtual Machine window.
/usr/share/ovirt-engine/conf/sysprep/ directory. For example, "<Domain><![CDATA[$JoinDomain$]]></Domain>" can be used to indicate the domain to join.
7.1.2.1. Prerequisites for Sealing a Windows Virtual Machine
Important
- The Windows virtual machine parameters have been correctly defined.
- If not, click Edit the Virtual Machines tab and enter the required information in the Operating System and Cluster fields.
- The correct product key has been defined in an override file on the Manager.The override file must be created under
/etc/ovirt-engine/osinfo.conf.d/, have a filename that puts it after/etc/ovirt-engine/osinfo.conf.d/00-defaults.properties, and ends in.properties. For example,/etc/ovirt-engine/osinfo.conf.d/10-productkeys.properties. The last file will have precedence and override any other previous file.If not, copy the default values for your Windows operating system from/etc/ovirt-engine/osinfo.conf.d/00-defaults.propertiesinto the override file, and input your values in theproductKey.valueandsysprepPath.valuefields.Example 7.1. Windows 7 Default Configuration Values
# Windows7(11, OsType.Windows, false),false os.windows_7.id.value = 11 os.windows_7.name.value = Windows 7 os.windows_7.derivedFrom.value = windows_xp os.windows_7.sysprepPath.value = ${ENGINE_USR}/conf/sysprep/sysprep.w7 os.windows_7.productKey.value = os.windows_7.devices.audio.value = ich6 os.windows_7.devices.diskInterfaces.value.3.3 = IDE, VirtIO_SCSI, VirtIO os.windows_7.devices.diskInterfaces.value.3.4 = IDE, VirtIO_SCSI, VirtIO os.windows_7.devices.diskInterfaces.value.3.5 = IDE, VirtIO_SCSI, VirtIO os.windows_7.isTimezoneTypeInteger.value = false
7.1.2.2. Sealing a Windows 7, Windows 2008, or Windows 2012 Template
Procedure 7.3. Sealing a Windows 7, Windows 2008, or Windows 2012 Template
- Launch Sysprep from
C:\Windows\System32\sysprep\sysprep.exe. - Enter the following information into Sysprep:
- Under System Cleanup Action, select Enter System Out-of-Box-Experience (OOBE).
- Select the Generalize check box if you need to change the computer's system identification number (SID).
- Under Shutdown Options, select Shutdown.
- Click to complete the sealing process; the virtual machine shuts down automatically upon completion.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.