# Ansible Playbook for Windows Patching

**URL:** <https://forum.ansible.com/t/ansible-playbook-for-windows-patching/35985>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [November 10, 2021, 3:38pm UTC](https://forum.ansible.com/t/ansible-playbook-for-windows-patching/35985 "2021-11-10T15:38:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jitendra\_Ingale](https://avatars.discourse-cdn.com/v4/letter/j/5fc32e/32.png) [@Jitendra\_Ingale](https://forum.ansible.com/u/Jitendra_Ingale)\
**Post date:** [November 10, 2021, 3:38pm UTC](https://forum.ansible.com/t/ansible-playbook-for-windows-patching/35985/1 "2021-11-10T15:38:28Z")

</div>

Folks,

I am using below pasted playbook for windows server patching which has variable file defined along with.  
It is supposed to take KB number mentioned in variable file and install it on server, followed by server reboot.

Problem is that, the said playbook is getting executed without any issue and also rebooting the server **however its not installing mentioned KB patches on server** as expected.

Please suggest.

**Playbook**

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [November 10, 2021, 5:28pm UTC](https://forum.ansible.com/t/ansible-playbook-for-windows-patching/35985/2 "2021-11-10T17:28:22Z")

</div>

That kb\_list var has unquoted items?

---

<div class="post-metadata">

**Author:** ![Jitendra\_Ingale](https://avatars.discourse-cdn.com/v4/letter/j/5fc32e/32.png) [@Jitendra\_Ingale](https://forum.ansible.com/u/Jitendra_Ingale)\
**Post date:** [November 10, 2021, 6:58pm UTC](https://forum.ansible.com/t/ansible-playbook-for-windows-patching/35985/3 "2021-11-10T18:58:02Z")

</div>

I just updated my kb\_list var with using single and even double quotes but its simply ignoring variable file and just rebooting windows server.

**kb\_list: [‘KB5006065’, ‘KB890830’]**

**kb\_list: [“KB5006065”, “KB890830”]**

These are the changes you were suggesting or anything different?

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [November 10, 2021, 7:40pm UTC](https://forum.ansible.com/t/ansible-playbook-for-windows-patching/35985/4 "2021-11-10T19:40:29Z")

</div>

This is what I meant yes.  
I don’t have other clues, I’m not familiar with that os’ modules.

---

<div class="post-metadata">

**Author:** ![jborean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jborean/32/1525_2.png) [@jborean](https://forum.ansible.com/u/jborean)\
**Post date:** [November 10, 2021, 8:55pm UTC](https://forum.ansible.com/t/ansible-playbook-for-windows-patching/35985/5 "2021-11-10T20:55:24Z")

</div>

Have a look at the output of win\_updates, it will tell you what updates were selected and the ones that were not. The ones that are “filtered” (not selected) will have a reason which states why they were filtered out. If the update doesn’t appear in the output at all then Windows couldn’t find it and thus cannot be installed.

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [November 11, 2021, 2:19am UTC](https://forum.ansible.com/t/ansible-playbook-for-windows-patching/35985/6 "2021-11-11T02:19:38Z")

</div>

V’s are your friends; use a couple at least. -vv  
Also, run with state: searched to see what updates are actually available.

---

<div class="post-metadata">

**Author:** ![dulhaver](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dulhaver/32/1061_2.png) [@dulhaver](https://forum.ansible.com/u/dulhaver)\
**Post date:** [November 12, 2021, 6:35am UTC](https://forum.ansible.com/t/ansible-playbook-for-windows-patching/35985/7 "2021-11-12T06:35:15Z")

</div>

without much Ansible experience:

1. the blank line (22) looks suspicious
2. would you need to add spaces between " {{ }} " for calling the variable in line 23?
