ansible-collections/ansible.windows

Failed to search for updates

agobezy opened this issue · 2 comments

SUMMARY

Using Ansible and Rundeck to schedule Windows Updates on various servers
Has been working for months until an update to Ansible (from 2.12 to 2.13)

ISSUE TYPE
  • Bug Report
COMPONENT NAME
ANSIBLE VERSION
ansible [core 2.13.11]
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/USER/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/USER/.local/lib/python3.8/site-packages/ansible
ansible collection location = /home/USER/.ansible/collections:/usr/share/ansible/collections
executable location = /home/USER/.local/bin/ansible
python version = 3.8.10 (default, May 26 2023, 14:05:08) [GCC 9.4.0]
jinja version = 3.1.2
libyaml = True
COLLECTION VERSION
/home/USER/.ansible/collections/ansible_collections
ansible.windows 2.0.0

/home/USER/.local/lib/python3.8/site-packages/ansible_collections
ansible.windows 1.12.0

/usr/lib/python3/dist-packages/ansible_collections
ansible.windows 1.10.0
CONFIGURATION
HOST_KEY_CHECKING(/etc/ansible/ansible.cfg) = False
OS / ENVIRONMENT

Ansible + Rundeck Server

  • Ubuntu Server 20.04.6
  • Rundeck version 4.14.1
    Various Windows Servers
  • Windows 10/11
  • Windows Server 2019
STEPS TO REPRODUCE

Login to Rundeck
Select job
Run job on the required servers
Wait a few minutes and wait for the error to appear

EXPECTED RESULTS
PLAY [onpremwindows] ***********************************************************************
TASK [Gathering Facts] *********************************************************
ok: [SERVER.DOMAIN.COM]]
TASK [Install Windows updates] *************************************************
PLAY RECAP *********************************************************************
SERVER.DOMAIN.COM] : ok=3    changed=1    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0   
ACTUAL RESULTS
PLAY [onpremwindows] ***********************************************************
TASK [Gathering Facts] *********************************************************
ok: [SERVER.DOMAIN.COM]
TASK [Install Windows updates] *************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: at <ScriptBlock>, <No file>: line 757
fatal: [SERVER.DOMAIN.COM]: FAILED! => {"changed": true, "failed_update_count": 0, "filtered_updates": {}, "found_update_count": 0, "installed_update_count": 0, "msg": "Failed to search for updates (SuceededWithErrors 3)", "reboot_required": false, "updates": {}}
PLAY RECAP *********************************************************************
SERVER.DOMAIN.COM   : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0   
Failed: AnsibleNonZero: ERROR: Ansible execution returned with non zero code.

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: at <ScriptBlock>, <No file>: line 757
fatal: [SERVER.DOMAIN.COM]: FAILED! => {"changed": true, "failed_update_count": 0, "filtered_updates": {}, "found_update_count": 0, "installed_update_count": 0, "msg": "Failed to search for updates (SuceededWithErrors 3)", "reboot_required": false, "updates": {}}

Apologies for the formatting not being correct in the initial post, Forgot to add the playbook that I''m using. ---

- hosts: "*"
  tasks:
  - name: Install Windows updates
    win_updates: #https://docs.ansible.com/ansible/latest/collections/ansible/windows/win_updates_module.html
      category_names: '*'
      state: installed
      reboot: true
      log_path": C:\Windows\Install-Windows-Updates.txt

This looks to be a duplicate of #366. This issue has been fixed to treat SuceededWithErrors as successful but log the errors. As your code has failed it looks like it is still running with the older ansible.windows version and not the 2.0.0 one in your collection path.

Running with -vvv will show you the full path of the module that was used which will help indicate if it's using /usr/lib/python3/dist-packages/ansible_collections/ansible/windows or the other collection paths.