Install Windows Updates With Ansible

Based on feedback we have received this week we will cover Ansible and today I will show you how to install Windows Updates using Ansible for Windows.

Last month we covered Ansible for Windows in-depth using the four-part series on how to manage Windows Machine with Ansible.

Windows Updates

This post will show you a playbook that installs Windows updates on a managed Windows machines without needing to use WSUS. The playbook installs Security, Definition, critical and rollup updates and restarts the machine if needed.

Below you can see the code.

---
- name: "Windows Updates"
  hosts: windows
  tasks:
    - name: Install Windows updates
      win_updates:
        category_names:
         - SecurityUpdates
         - CriticalUpdates
         - UpdateRollups
         - DefinitionUpdates 
        reboot: yes

Note: To install all the update types use the following list.

 - SecurityUpdates
         - CriticalUpdates
         - UpdateRollups
         - DefinitionUpdates
         - updates
         - FeaturePacks
         - Servicepacks
         - Tools
         - Application

Processing…
Success! You're on the list.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.