# PRINT THE STRING 'kb' from windows updates

**URL:** <https://forum.ansible.com/t/print-the-string-kb-from-windows-updates/30458>\
**Category:** Ansible Project\
**Tags:** windows\
**Created:** [May 31, 2019, 10:28am UTC](https://forum.ansible.com/t/print-the-string-kb-from-windows-updates/30458 "2019-05-31T10:28:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![The\_Vandyy\_Vines](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@The\_Vandyy\_Vines](https://forum.ansible.com/u/The_Vandyy_Vines)\
**Post date:** [May 31, 2019, 10:28am UTC](https://forum.ansible.com/t/print-the-string-kb-from-windows-updates/30458/1 "2019-05-31T10:28:44Z")

</div>

I am doing windows patching with selected kb article.

I am trying to see that the kb article as extra variable should be in the searched updates.

Now i want to 1) print the kb article ID from below o/p

ok: [vuhplabgtdev108] =\> {  
“update\_count”: {  
“changed”: false,  
“failed”: false,  
“filtered\_updates”: {},  
“found\_update\_count”: 2,  
“installed\_update\_count”: 0,  
“reboot\_required”: false,  
“updates”: {  
“0158cb9b-19d2-4c94-99e1-36ebbd244fc9”: {  
“id”: “0158cb9b-19d2-4c94-99e1-36ebbd244fc9”,  
“installed”: false,  
“kb”: [  
“3184943”  
],  
“title”: “Security Update for Windows Server 2012 (KB3184943)”  
},  
“42bc1d78-909a-4a02-9e1e-18ff4cae463c”: {  
“id”: “42bc1d78-909a-4a02-9e1e-18ff4cae463c”,  
“installed”: false,  
“kb”: [  
“3004375”  
],  
“title”: “Security Update for Windows Server 2012 (KB3004375)”  
}  
}  
}  
}

1. compare the kbarticle id (from extra variable with the list of kb article id as output from windows\_update --searched)

 ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/d/d4682b6540d518fa19a90648f0d47899f2c92622.png)

 ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/8/8f0285aefeef7099bf2dcb43225fe82ebe491838.png)

---

<div class="post-metadata">

**Author:** ![The\_Vandyy\_Vines](https://avatars.discourse-cdn.com/v4/letter/t/7993a0/32.png) [@The\_Vandyy\_Vines](https://forum.ansible.com/u/The_Vandyy_Vines)\
**Post date:** [May 31, 2019, 11:05am UTC](https://forum.ansible.com/t/print-the-string-kb-from-windows-updates/30458/2 "2019-05-31T11:05:23Z")

</div>

This is not working

- debug: msg=“{{ item.0[‘kb’] }}”  
with\_items: “{{ update\_count.updates }}”

ERROR:

SK [win\_patch\_role : debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
task path: /var/lib/awx/projects/win\_patch\_role/roles/win\_patch\_role/tasks/selected\_category\_kb.yml:62  
fatal: [vuhplabgtdev108]: FAILED! =\> {  
“msg”: “The task includes an option with an undefined variable. The error was: ‘unicode object’ has no attribute ‘kb’\n\nThe error appears to have been in ‘/var/lib/awx/projects/win\_patch\_role/roles/win\_patch\_role/tasks/selected\_category\_kb.yml’: line 62, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n #- debug: var="[update\_count.updates.id](http://update_count.updates.id)"\n - debug: msg="{{ item.0.kb }}"\n ^ here\nWe could be wrong, but this one looks like it might be an issue with\nmissing quotes. Always quote template expression brackets when they\nstart a value. For instance:\n\n with\_items:\n - {{ foo }}\n\nShould be written as:\n\n with\_items:\n - "{{ foo }}"\n”  
}  
to retry, use: --limit @/var/lib/awx/projects/win\_patch\_role/win\_patch.retry

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

> **(attachments)**
>
> ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/8/8f0285aefeef7099bf2dcb43225fe82ebe491838.png)  
> ![image.png](https://us1.discourse-cdn.com/ansible/original/2X/d/d4682b6540d518fa19a90648f0d47899f2c92622.png)
