AnsiblePilot — Master Ansible Automation
AnsiblePilot is the leading resource for learning Ansible automation, DevOps, and infrastructure as code. Browse over 1,100 tutorials covering Ansible modules, playbooks, roles, collections, and real-world examples. Whether you are a beginner or an experienced engineer, our step-by-step guides help you automate Linux, Windows, cloud, containers, and network infrastructure.
Popular Topics
About Luca Berton
Luca Berton is an Ansible automation expert, author of "Ansible for VMware by Examples" and "Ansible for Kubernetes by Example" published by Apress, and creator of the Ansible Pilot YouTube channel. He shares practical automation knowledge through tutorials, books, and video courses to help IT professionals and DevOps engineers master infrastructure automation.
Ansible Windows Update: Rolling Updates with win_updates Module (Guide) — Video Tutorial
How to manage Windows Updates with Ansible win_updates module. Rolling updates, selective patching, reboot handling, and WSUS integration with playbook examples.
What You'll Learn
- How to perform Rolling Update with Ansible on Windows-like systems?
- Ansible Rolling Update Windows-like systems
- Parameters
- Links
- code
- execution
- idempotency
- before execution
- after execution
- Conclusion
Full Tutorial Content
How to perform Rolling Update with Ansible on Windows-like systems?
Every System Administrator knows how important is to maintain an up-to-date fleet in a consistent state.
I'm going to show you a live Playbook with some simple Ansible code.
I'm Luca Berton and welcome to today's episode of Ansible Pilot
Ansible Rolling Update Windows-like systems
- `ansible.windows.win_updates`
- Download and install Windows updates
Today we're talking about the Ansible module `win_updates`.
The full name is `ansible.windows.win_updates `, which means that is part of the collection of modules specialized to interact with Windows target host.
It's a module pretty stable and out for years.
It works in Windows and Windows Server operating systems.
It downloads and installs Windows updates.
For Linux target use the `yum` module for RedHat-like systems, `apt` for Debian-like, and `zypper` for Suse-like.
Parameters
- category_names _string_ - **CriticalUpdates**, DefinitionUpdates, DeveloperKits, FeaturePacks, **SecurityUpdates**, ServicePacks, **UpdateRollups**
- state _string_ - searched / downloaded / **installed**
- reboot _boolean_ /reboot_timeout - no / yes
- log_path _path_ - append log file
- accept_list / reject_list _list_ - titles or KB to whitelist or blacklist
The parameter list is pretty wide but today we are focused only on the relevant for our use case.
The most important is "category_names". The options are a lot here. The default is to enable only "CriticalUpdates", "SecurityUpdates" and "UpdateRollups" but could add or remove different categories.
The "state" parameter specifies if the update is going to be only "searched", "downloaded" or "installed". If you prefer to only download the code and perform the actual update a second time you need to select the "downloaded" option.
With the "reboot" option Ansible will automatically reboot the remote host if it is required and continue to install updates after the reboot.
There is a default timeout of 1200 seconds to wait until the host is back online from a reboot. You could increase using the "reboot_timeout" option.
Some System Administrators prefer to keep a log about the update operation using the "log_path" option to save to the target disk a log file of the performed operations.
You could specify a list of update titles or KB numbers that specify which updates are to be searched or installed using the "accept_list" parameter as well as a list of exclusion in the "reject_list" parameter.
Links
- [ansible.windows.win_updates](https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_updates_module.html)
- [Using Ansible and Windows](https://docs.ansible.com/ansible/latest/user_guide/windows_usage.html)
## Playbook
How to install Rolling Update on Windows-like systems, save the log in "C:\ansible.txt" and reboot if necessary with Ansible Playbook.
code
```yaml
---
- name: windows rolling update
hosts: all
tasks:
- name: Install all critical and security updates
About This Tutorial
- Author: Luca Berton
- Difficulty: Beginner
- Read time: 5 min
- Category: installation
Read the full written article: Ansible Windows Update: Rolling Updates with win_updates Module (Guide)
Related Video Tutorials
- Add Windows Registry on Windows-like systems - Ansible module win_regedit — Learn how to use Ansible win_regedit module to add, change, or remove Windows registry key-values efficiently and accurately with simple Ansible code examples.
- Check .NET Framework Version on Windows with Ansible — Learn how to check the .NET Framework version on Windows systems with Ansible using the win_reg_stat module. Includes a practical Playbook example and execution results.
- Ansible win_file Module: Create Directory on Windows Hosts (Guide) — How to create directories on Windows with Ansible win_file module (ansible.windows.win_file). Set paths, manage folders, handle permissions. Practical YAML playbook examples for Windows automation.
- Ansible win_file Module: Create & Manage Files on Windows (Guide) — How to create and manage files on Windows with Ansible win_file module (ansible.windows.win_file). Create files, directories, symlinks on Windows. Practical YAML playbook examples.
- Ansible win_regedit: Manage Windows Registry Keys & Values (Examples) — How to manage Windows Registry with Ansible win_regedit module. Create, modify, and remove registry keys and values with practical automation examples.
- Ansible for Windows: Complete Guide to Windows Automation (2026) — Learn how to automate Windows systems using Ansible. Explore modules, tasks, and best practices to enhance your automation workflows and reduce errors.