Windows VM deployment
Step 01: Install Cloud-base Init on Windows Server
- Setup Windows Server on KVM host
virt-install \
--name win11 \
--ram 8192 \
--vcpus 4 \
--cpu host-passthrough \
--machine q35 \
--os-variant win11 \
--disk path=/var/lib/libvirt/images/windows11.qcow2,bus=virtio,cache=writeback \
--cdrom /path/to/windows11.iso \
--disk path=/path/to/virtio-win.iso,device=cdrom \
--network bridge=virbr0,model=virtio \
--graphics vnc \
--boot uefi \
--tpm backend.type=emulator,backend.version=2.0,model=tpm-crb \
--features smm.state=on,hyperv_vapic=on,hyperv_relaxed=on,hyperv_spinlocks=on,kvm_hidden=on
- Go through installation and Install cloud base init on windows
Modify cloudbase init conf to use configdrive
Open C:\Program Files\Cloudbase Solutions\Cloudbase-Init\conf\cloudbase-init.conf
Add the below line
metadata_services=cloudbaseinit.metadata.services.configdrive.ConfigDriveService
config_drive_label=cidata
:::info
If want to add multiple options
Add the line
metadata_services=cloudbaseinit.metadata.services.httpservice.HttpService,cloudbaseinit.metadata.services.configdrive.ConfigDriveService
config_drive_label=cidata
Step 2: Prepare Template from the cloud base init vm
- Run the command to check attached disks
- Copy the Cloud base init vm disk to template disk
- Prepare template
Step 03: Create Cloud init config files
#ps1
net user User1 P@ssw0rd /add
net user User2 S3cur3P@ss /add
Rename-Computer -NewName "MyCustomHost"
Write-Output "Hello from Cloudbase-Init"
genisoimage -output /var/lib/libvirt/images/configdrive.iso -volid cidata -joliet -rock /tmp/configdrive
genisoimage -output /var/lib/libvirt/images/configdrive.iso -volid config-2 -joliet -rock /tmp/configdrive