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



-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/a1c15ca8-f686-4e96-a333-e3f3d81a29e1%40googlegroups.com.

Reply via email to