- Install Windows Server 2016
- Download and run ConfigureRemotingForAnsible.ps1
- Configure any extra disks/volumes to be used
- Create directory specified by GitRepoPath var and add /scripts/modules/*.psm1 and /bin directory
Run playbook "prepare-host". This will do a couple of things
- Install Hyper-v
- Install DHCP
- Configure Virtual Interface/Switch with IP 192.168.0.1
- Configure NAT so hosts on 192.168.0.0/24 is reachable
- Install GIT & Clone Repository
- Trust all winrm clients on here
After it has completed, build server is now ready.
Windows iso is defined in vars file 'windows_iso.yml' and selected depending on set {{os_version}} variable.
iso will be downloaded and stored at {{ISOPath}} if {{http_fileserver}} is set to http url, set to 'skip' to ignore downloading.
Secondary iso is required for unattended installation of Windows on UEFI since floppy drive is not supported. Iso will be created by role: prepare-build. It will update the git repo and create a new secondary iso each time the build is started. iso output will be in git-path\build\OS\secondary.iso
Templated from jinja2 template in prepare-build role vars set in autounattend_setup.yml
Copied from scripts/setup. This will configure winrm and rdp at startup.
Templated from jinja2 template in prepare-build role vars set in cloudbase_vars.yml
- Template autounattend.xml
- Template cloudbase-int.conf
- Add startup script
- Create secondary iso
- Create dynamic disk in path: {{OutputPath}}{{os_selection}}
- Create new G2 VM, select NATSwitch and VHDX created in step 1
- Add Windows ISO & Secondary ISO
- Boot VM
- Wait for Boot
- Type Boot Command
- Wait for OS install completion
- Get VM adapter IP
- Wait for System to be ready - bootstrap.ps1
- Run Windows Update
- Download & Install latest Cloudbase-init. Find and copy config from Secondary.iso
- Clean up image with dism
- Finalize & Sysprep with cloudbase-init unattend.
- Remove VM. Clean up & Compact disk
- Create temporary clone of image
- add virtio drivers & Convert disk qemu-img
- Clean up temporary image
- Upload disk for QA
- ?
Since we are working with double hop, modules for certain tasks can help enable remote functionality/automation of guests on build hosts.
- "Invoke-CloudbaseInit" = Install and configure Cloudbase-init agent
- "Invoke-Finalize" = Clean up remnants of Autounattend, clear logs and sysprep image
This module will run a series of complex powershell jobs on the build host to update target Guest with latest Windows Updates. It will retry/Reboot untill a "true" response is given. When true, all updates found is installed.*
- "Invoke-WindowsUpdate"