Appendix-B_ VM Template Preparation (cloud-init)
Before You Begin
Ensure VM (Template) has network connectivity to https://repo.skygrid.cloud
Ensure VM has internet access to Linux repositories
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
Ovirt Guest Agent & tools must be installed as described in https://www.ovirt.org/documentation/internal/guest-agent/understanding-guest-agents-and-other-tools/
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
----------*
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
vim:syntax=yaml
datasource_list: ["NoCloud", "ConfigDrive"]CentOS 6.x and below*
---------------------------*
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
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" |
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] |
C:\Program Files\Cloudbase Solutions\Cloudbase-Init\confcloudbase-init-unattend.conf |
[DEFAULT] |
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"?> | exit 2"</Path> |
---|
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.
© 2020 CloudSphere