Window patch module not working on 2.9 Ansible

65 views
Skip to first unread message

Amit Kumar

unread,
May 11, 2020, 9:49:55 AM5/11/20
to Ansible Project
Hi ,

I tried to installed the window patch with below yml but it's not installing the found patch.
It just search the patch and skipped that patch, kindly please suggest
Where i am doing wrong.  

I have mention the Yml file and output of playbook.


Window patch installation win_patch.yml file
************************************************************
---
# update-windows-test.yaml
- hosts: win
  vars:
    win_updates_categories:
      - SecurityUpdates
      - CriticalUpdates
      - UpdateRollups
      - DefinitionUpdates
      - Updates
      - Application
      - Connectors
      - DeveloperKits
      - FeaturePacks
      - Guidance
      - ServicePacks
      - Tools
      - UpdateRollups

  tasks:
    # Check for missing updates
    - name: check for missing updates
      win_updates:
        state: searched
        catagory_names: "{{ win_updates_categories }}"
      register: update_count
      ignore_errors: yes

    - name: reboot if required
      win_reboot:
      when: update_count.reboot_required
      ignore_errors: yes
     #Install updates
    - name: install updates
      debugger: on_skipped
      win_updates:
        catagory_names: "{{ win_updates_categories }}"
        reboot: yes
        register: update_result

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
Output
------------------------------------------------------------------------------------------------------------------------------------------------------------------------
ansible@ansible:~/rx_testing$ ansible-playbook win_patch_file3.yml -vvv
ansible-playbook 2.9.7
  config file = /home/ansible/rx_testing/ansible.cfg
  configured module search path = [u'/home/ansible/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.17 (default, Apr 15 2020, 17:20:14) [GCC 7.5.0]
Using /home/ansible/rx_testing/ansible.cfg as config file
host_list declined parsing /home/ansible/rx_testing/inventory as it did not pass its verify_file() method
script declined parsing /home/ansible/rx_testing/inventory as it did not pass its verify_file() method
auto declined parsing /home/ansible/rx_testing/inventory as it did not pass its verify_file() method
Parsed /home/ansible/rx_testing/inventory inventory source with ini plugin

PLAYBOOK: win_patch_file3.yml *******************************************************************************************************************************
1 plays in win_patch_file3.yml

PLAY [win] **************************************************************************************************************************************************

TASK [Gathering Facts] **************************************************************************************************************************************
task path: /home/ansible/rx_testing/win_patch_file3.yml:3
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/setup.ps1
Pipelining is enabled.
<10.100.100.206> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 10.100.100.206
EXEC (via pipeline wrapper)
ok: [10.100.100.206]
META: ran handlers

TASK [check for missing updates] ****************************************************************************************************************************
task path: /home/ansible/rx_testing/win_patch_file3.yml:22
win_updates: running win_updates module
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_updates.ps1
Pipelining is enabled.
<10.100.100.206> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 10.100.100.206
EXEC (via pipeline wrapper)
ok: [10.100.100.206] => {
    "changed": false,
    "filtered_updates": {
        "05775fa0-d13e-49eb-89dc-74fba83fcdbf": {
            "categories": [
                "Definition Updates",
                "Windows Defender"
            ],
            "filtered_reason": "category_names",
            "id": "05775fa0-d13e-49eb-89dc-74fba83fcdbf",
            "installed": false,
            "kb": [
                "2267602"
            ],
            "title": "Security Intelligence Update for Windows Defender Antivirus - KB2267602 (Version 1.315.427.0)"
        }
    },
    "found_update_count": 0,
    "installed_update_count": 0,
    "reboot_required": false,
    "updates": {}
}

TASK [reboot if required] ***********************************************************************************************************************************
task path: /home/ansible/rx_testing/win_patch_file3.yml:29
skipping: [10.100.100.206] => {
    "changed": false,
    "skip_reason": "Conditional result was False"
}

TASK [install updates] **************************************************************************************************************************************
task path: /home/ansible/rx_testing/win_patch_file3.yml:34
win_updates: running win_updates module
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/windows/win_updates.ps1
Pipelining is enabled.
<10.100.100.206> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5986 TO 10.100.100.206
EXEC (via pipeline wrapper)
ok: [10.100.100.206] => {
    "changed": false,
    "filtered_updates": {
        "05775fa0-d13e-49eb-89dc-74fba83fcdbf": {
            "categories": [
                "Definition Updates",
                "Windows Defender"
            ],
            "filtered_reason": "category_names",
            "id": "05775fa0-d13e-49eb-89dc-74fba83fcdbf",
            "installed": false,
            "kb": [
                "2267602"
            ],
            "title": "Security Intelligence Update for Windows Defender Antivirus - KB2267602 (Version 1.315.427.0)"
        }
    },
    "found_update_count": 0,
    "installed_update_count": 0,
    "reboot_required": false,
    "updates": {}
}
META: ran handlers
META: ran handlers

PLAY RECAP **************************************************************************************************************************************************
10.100.100.206              : ok=3    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0



Amit Kumar

unread,
May 12, 2020, 1:36:00 AM5/12/20
to Ansible Project
Any help will be really appreciable, As i am stuck here and waste day but didn't find any solution

Jean-Yves LENHOF

unread,
May 12, 2020, 3:06:46 AM5/12/20
to ansible...@googlegroups.com

Hi,

First thing I see is that attribute "catagory_names" should be "category_names".

I think there's another problem also, but don't see it yet...


Regards,

JYL

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0efa82f6-2f7a-4e40-bf09-ab8d2e7f5f52%40googlegroups.com.

Jordan Borean

unread,
May 12, 2020, 5:03:52 AM5/12/20
to Ansible Project
It’s telling you that the update has been filtered and the reason is because the categories for that update aren’t in the categories you listed. To fix this add one of the 2 categories it states it has and run again.
Reply all
Reply to author
Forward
0 new messages