Ansible Windows Auto-Provisioning (AWAP) is a declarative Windows provisioning framework built on Ansible, designed primarily for enterprise environments, to streamline software installation, system configuration, and feature enablement for Windows systems. AWAP abstracts complex Windows deployment tasks into a simple YAML-based configuration that handles software installations, system configurations, registry management, and more.
Table of Contents:
AWAP is a template-driven Ansible role that transforms high-level YAML declarations into executable Windows provisioning tasks. Instead of writing individual Ansible tasks for each operation, you define what you want in a structured YAML format, and AWAP generates the appropriate tasks at runtime.
Philosophy:
- No Chocolatey dependency: uses native installers (MSI, EXE, ZIP)
- Centralized configuration: all parameters defined in playbook variables
- Explicit over implicit: every setting is visible and configurable
- Template-driven: Jinja2 templates generate tasks dynamically
| Feature | Description |
|---|---|
| Multi-format Installation | MSI, EXE, ZIP archives, and installation bundles |
| Registry Management | CRUD operations, .reg file merging, key/value manipulation |
| Environment Variables | Set, append, remove system-level environment variables |
| File Operations | Transfer, create, remove, move, template rendering, append/prepend |
| Desktop Shortcuts | Create shortcuts with custom icons in desktop or Start Menu |
| PowerShell Execution | Run inline scripts or uploaded .ps1 files |
| Pre-flight Checks | Network flow, HTTP status, service status, port availability |
| Idempotent Operations | Checks existing state before making changes |
- Rocky Linux 8.x / RHEL 8.x / AlmaLinux 8.x (or equivalent)
- Python 3.6+ with
pywinrm>=0.4.3 ansible-core2.15+ (tested with 2.18.1)- Ansible collections:
ansible.windows:==2.2.0,community.windows:==2.1.0andansible.posix:==1.5.4
- Windows Server 2016, 2019, or 2022
- PowerShell 5.1+
- WinRM enabled (HTTP:5985 or HTTPS:5986)
.
βββ πinventories/πenvironments/ # Target host definitions
βββ πplaybooks/
β βββ basic_win.yml # Basic software bundle setup (L2)
β βββ core_win.yml # Core software bundle setup (L1)
β βββ πroles/πans-win-auto-prov/ # The core role
β βββ πtasks/
β β βββ main.yml # Orchestrator
β β βββ 01_pre-setup.yml # Pre-setup phase
β β βββ 02_setup.yml # Main setup phase
β β βββ 03_post-setup.yml # Post-setup phase
β β βββ templates/operations.yml.j2 # Task generator
β βββ πtemp/ # Generated task files
βββ πresources/ # Files to deploy
β βββ init-system/ # System initialization (PS modules, starter)
β βββ core_win/ # Core bundle resources
β βββ basic_win/ # Basic bundle resources
βββ πtemplates/ # Jinja2 templates of files to deploy
βββ πvaults/πenvironments/ # Encrypted credentials
βββ πtools/ # Utility scripts (not called by playbooks)
β
βββ ποΈdocs/ # Documentation
βββ ποΈscripts/ # Scripts for setting up the environment
Playbook Variables βββΊ Phase Files βββΊ operations.yml.j2 βββΊ Generated Tasks βββΊ WinRM βββΊ Windows
(pre_setup) (01_*.yml) (Jinja2 template) (temp/*.yml) (target)
(setup) (02_*.yml)
(post_setup) (03_*.yml)
- You define operations in playbook variables (
pre_setup,setup,post_setup) - Phase files include
operations.yml.j2with your operation list - The Jinja2 template generates native Ansible tasks
- Generated tasks execute on Windows targets
Check
./scripts/directory
On a Rocky Linux 8.9 x64 VM:
sudo dnf install -y python3.11 python3.11-pip
pip3 install ansible-core==2.16.1
pip3 install pywinrm==0.4.3
ansible-galaxy collection install ansible.windows:==2.2.0 community.windows:==2.1.0 ansible.posix:==1.5.4On a Windows Server 2019 Standard VM, run scripts/setup_target-WinSvr2019.ps1
Then, to test from the Ansible Controller:
-
Ansible ping test:
ansible -v win2019-http -i inventories/environments/dev.yml -m win_ping ansible -v win2019-https -i inventories/environments/dev.yml -m win_ping
You can setup a simulated KMS (vlmcsd) and Artifacts Repository (NGINX + Filebrowser) if you want to test MS Office installation and activation, as well as downloading installer files from a private server (e.g. company's JFrog Artifactory).
For that, you can run scripts/setup_kms_artifactory_simul_svr.sh on a dedicated third VM.
