Ansible playbook to create Proxmox Windows VM templates
Ansible playbook to create Windows templates for Proxmox (PVE) based lab environment (somewhat customized for mine, but easy enough to tweak), prepped for further Ansible automation. Tested with Proxmox v6.0.1 & Ansible v2.8.1.
ansible-playbook -i inventory.yml --ask-vault-pass provision-template.yml
Packer would be ideal solution for this, using the Proxmox builder, which works great for an OS that can be supplied a kickstart config over http, but for Windows, to use the Unattend.xml automated setup capability, there are two issues:
Unable to use Packer, next looked to use Proxmox_KVM Ansible module. However found multiple issues with this, including:
Ultimately found solution by using qm command line tool from Ansible command module.
There are a couple of 'Start-Sleep' calls in the AutoUnattend.xml file. The method is a bit kludgy, but has been the only reliable method I've found to allow for 2 Windows Updates passes with reboots, and also ensure that the final phase for Sysprep is not interrupted.