How clayshek/ans-pve-win-templ works
Project type and purpose
• This is an Ansible-based automation/orchestration tool that builds a Windows Server 2019 template for Proxmox VE.
• It stitches together: a base Microsoft ISO, VirtIO drivers, an AutoUnattend.xml template, PowerShell scripts, and Proxmox’s qm CLI via Ansible.
File structure
• Top-level:
• README.md – project summary and usage
• provision-template.yml – main Ansible playbook
• inventory.yml – Proxmox node definitions
• vars.yml – custom variables (ISO path, VM specs, credentials)
• autounattend.xml.tpl – Windows unattended install template
• iso-files/
– drivers/virtio/... – all VirtIO driver INF/SYS/MSI files
– scripts/*.ps1 – PowerShell scripts: AnsiblePrep.ps1, Windows-updates passes
• No separate “frontend”/“backend” folders – this is infrastructure code.
• Key config: Ansible playbook, variables, Jinja2 template for AutoUnattend.xml, driver ISO build context.
README for additional insights
• Uses Proxmox qm command via Ansible’s command module rather than the proxmox_kvm module.
• Installs latest Windows Updates (two passes with reboots).
• Syspreps and marks the VM as a template.
• Requires genisoimage on Proxmox to build the drivers+scripts ISO.
a. Main components
• Ansible Control Host (your local machine or central automation server)
• Proxmox VE Host(s) (target nodes defined in inventory.yml)
• Storage subsystem on Proxmox (holds Windows ISO, driver ISO, VM disk)
• Windows VM (in provisioning lifecycle)
• External source: Microsoft Windows Server ISO
b. Relationships & interactions
1. Ansible Control → SSH → Proxmox VE
• Runs provision-template.yml
2. Proxmox VE → qm CLI → QEMU/KVM Hypervisor
• Creates VM, disks, network
• Attaches two ISOs:
• Official Windows ISO (os_iso_location)
• Custom VirtIO+Scripts ISO (built from iso-files/)
3. Windows VM boots → reads AutoUnattend.xml from first ISO
• Applies VirtIO drivers from second ISO during setup
• Runs embedded PowerShell scripts (AnsiblePrep.ps1, Windows-updates-pass1.ps1, pass2)
4. Windows VM finalizes setup → Sysprep → VM shutdown
5. Proxmox VE → marks VM as template
c. Architectural patterns/design principles
• Infrastructure as Code (Ansible playbook + templates)
• Idempotent provisioning steps
• Separation of concerns:
• Inventory & credentials (inventory.yml, vault)
• Parameterization (vars.yml)
• Build logic (provision-template.yml)
• Platform artifacts (iso-files/)
• Hybrid orchestration: combining Ansible modules & raw CLI (qm)
d. Key technologies/frameworks
• Ansible v2.8+ (playbooks, Jinja2 templates)
• Proxmox VE QM command
• QEMU/KVM virtualization
• Windows unattended setup (AutoUnattend.xml)
• VirtIO drivers for KVM guest performance
• PowerShell scripting inside WinPE/Windows