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)”
}
}
}
}
- compare the kbarticle id (from extra variable with the list of kb article id as output from windows_update --searched)
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"\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)