Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Before You Begin

VMware vSphere Requirements:

    • VM Tools: VMware Tools must be installed on the VM Template or customization will fail. Refer VM Template Preparation (Installing Cloud-Init)

Microsoft Hyper-V Requirements
Hyper-V Templates must be placed in a Cluster Shared Volume in the form of VHDX files. Refer VM Template Preparation (Installing Cloud-init) below
Open Virtualization (Ovirt) KVM Requirements

Important Note: For older Linux distributions remove the /etc./udev/rules.d/70-persistent-net.rules file before shutting down the VM
Important Note: Remove the NIC on the VM prior to converting the VM to Template. Refer VM Template Preparation (Installing Cloud-Init)
VMware vCloud Director: Not Supported
VM Template Preparation (Installing Cloud-init):

  • Linux VM Templates (CentOS/Ubuntu): Update the following values in the
      1. CentOS*
    1. ----------*
      sudo yum update -y
      sudo yum install -y cloud-init

      # Update /etc./cloud/cloud.cfg
      # to allow root and password authentication run the following command
      sudo sed -i 's/ssh_pwauth: false/ssh_pwauth: true/g' /etc./cloud/cloud.cfg
      sudo sed -i 's/disable_root: true/disable_root: false/g' /etc./cloud/cloud.cfg

  1. vim:syntax=yaml
    datasource_list: ["NoCloud", "ConfigDrive"]

    1. CentOS 6.x and below*
    2. ---------------------------*
  2. remove udev rules for network adapters
    rm /etc./udev/rules.d/70-persistent-net.rules

    #Ubuntu

                      • sudo apt-get update
                        sudo apt-get upgrade -y
                        sudo apt-get install cloud-init -y

  3. Edit 90_dpkg.cfg to remove items in datasource_list except the following
    datasource_list: [ NoCloud, ConfigDrive, None ]|
  • Windows VM Templates (Window 2016): Windows VM require cloudbase-init for Guest Customization. Run the following command to install Cloudbase-init

Important Note: Before installing cloudbase-init in the VM Template, take a snapshot of the VM

C:\>powershell.exe -ExecutionPolicy Bypass -Command "Invoke-WebRequest

https://www.cloudbase.it/downloads/CloudbaseInitSetup_x64.msi

-ContentType "application/octet-stream" -OutFile CloudbaseInitSetup_x64.msi"

#Install Cloudbase-Init for Windows (Do not complete the Installation until files cloudbase-init.conf, cloudbase-init-unatend.conf and unattend.xml are updated)
Msiexec /I CloudbaseInitSetup_x64.msi


Update the following 3 files as shown below before running sysprep via CloudBase-Init Installer

C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf

[DEFAULT]
username=Admin
groups=Administrators
first_logon_behaviour=no
inject_user_password=false
config_drive_raw_hhd=true
config_drive_cdrom=true
config_drive_vfat=true
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\
verbose=true
debug=true
logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
logfile=cloudbase-init.log
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
logging_serial_port_settings=
mtu_use_dhcp_config=true
ntp_use_dhcp_config=true
metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService
plugins=cloudbaseinit.plugins.common.networkconfig.NetworkConfigPlugin,
        cloudbaseinit.plugins.common.mtu.MTUPlugin,
        cloudbaseinit.plugins.common.sethostname.SetHostNamePlugin,
        cloudbaseinit.plugins.windows.extendvolumes.ExtendVolumesPlugin,
        cloudbaseinit.plugins.common.userdata.UserDataPlugin,
        cloudbaseinit.plugins.common.localscripts.LocalScriptsPlugin
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts|


C:\Program Files\Cloudbase Solutions\Cloudbase-Init\confcloudbase-init-unattend.conf

[DEFAULT]
username=Admin
groups=Administrators
first_logon_behaviour=no
inject_user_password=false
config_drive_raw_hhd=true
config_drive_cdrom=true
config_drive_vfat=true
bsdtar_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\bsdtar.exe
mtools_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\bin\
verbose=true
debug=true
logdir=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\log\
logfile=cloudbase-init-unattend.log
default_log_levels=comtypes=INFO,suds=INFO,iso8601=WARN,requests=WARN
logging_serial_port_settings=
mtu_use_dhcp_config=true
ntp_use_dhcp_config=true
local_scripts_path=C:\Program Files\Cloudbase Solutions\Cloudbase-Init\LocalScripts\
metadata_services=
plugins=
allow_reboot=false
stop_service_on_exit=false
check_latest_version=false

Important Note: Ensure the Administrator default password is configured. In this example – HyperGrid123

C:\Program Files\Cloudbase Solutions\Cloudbase-Init\confunattend.xml

<?xml version="1.0" encoding="utf-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
  <settings pass="generalize">
    <component name="Microsoft-Windows-PnpSysprep" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <PersistAllDeviceInstalls>true</PersistAllDeviceInstalls>
    </component>
  </settings>
  <settings pass="oobeSystem">
    <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
      <OOBE>
        <HideEULAPage>true</HideEULAPage>
        <NetworkLocation>Work</NetworkLocation>
        <ProtectYourPC>3</ProtectYourPC>
        <SkipMachineOOBE>true</SkipMachineOOBE>
        <SkipUserOOBE>true</SkipUserOOBE>
      </OOBE>
      <UserAccounts>
        <AdministratorPassword>
            <Value>SAB5AHAAZQByAEcAcgBpAGQAMQAyADMAQQBkAG0AaQBuAGkAcwB0AHIAYQB0AG8AcgBQAGEAcwBzAHcAbwByAGQA</Value>
<PlainText>false</PlainText>
            </AdministratorPassword>
       </UserAccounts>
    </component>
  </settings>
  <settings pass="specialize">
    <component name="Microsoft-Windows-Deployment" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      <RunSynchronous>
        <RunSynchronousCommand wcm:action="add">
          <Order>1</Order>
          <Path>cmd.exe /c ""C:\Program Files\Cloudbase Solutions\Cloudbase-Init\Python\Scripts\cloudbase-init.exe" --config-file "C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init-unattend.conf" && exit 1

exit 2"</Path>
          <Description>Run Cloudbase-Init to set the hostname</Description>
          <WillReboot>OnRequest</WillReboot>
        </RunSynchronousCommand>
      </RunSynchronous>
    </component>
  </settings>
</unattend>


  • Once all 3 files are edited, return to the Cloudbase-Init installer and select Sysprep and click Finish. This will generalize the system and shutdown the VM. Mark the VM as a template based on the Hypervisor of your choice.


  • No labels