Ansible winrm Read timed out when running win_update - intermittent

Hello,

I have this intermittent issue where, when Windows Server servers are patching or rebooting I would get WinRM -Read Timed out. This is occruing intermittently so I cannot freely replicate it.

Normally this wouldn’t be an issue with normal servers, however the applications that we are running on the servers are quite critical. eg. When this happens the db is left in recovery state, what then breaks the resiliency.

The output that I am getting when the job fails

TASK [Installing Windows Updates on Primary DB Server && reboot] ***************
20:14:07

1040
task path: /tmp/awx_66642_qb953vkg/project/ITLIB_dbserver_patch.yml:421

1041
win_updates: running win_updates module

1042
Using module file /usr/lib/python3.6/site-packages/ansible/modules/windows/win_updates.ps1

1043
Pipelining is enabled.

1044
<172.22.65.202> ESTABLISH WINRM CONNECTION FOR USER: support on PORT 5986 TO 172.22.65.202

1045
EXEC (via pipeline wrapper)

1046
fatal: [172.22.65.202]: UNREACHABLE! => {

1047
“changed”: false,

1048
“msg”: “winrm connection error: HTTPSConnectionPool(host=‘172.22.65.202’, port=5986): Read timed out. (read timeout=3600)”,

1049
“unreachable”: true

1050
}

1051

1052

The task that is being run:

#----------- Running Windows updates on Primary Server and reboot. ----#

  • name: Installing Windows Updates on Primary DB Server && reboot
    win_updates:
    category_names:
  • SecurityUpdates
  • CritialUpdates
  • UpdateRollups
  • Updates
  • Drivers
  • DefinitionUpdates
  • WindowsDefender

blacklist:

  • KB3061064
    reboot: yes
    reboot_timeout: 3600
    when:
  • inventory_hostname in primary.db
  • updates1.found_update_count > 0
    register: wu3
    ignore_errors: yes

Hosts file connection vars:

ansible_port: 5986
ansible_connection: winrm
ansible_winrm_scheme: HTTPS
ansible_winrm_server_cert_validation: ignore
ansible_winrm_read_timeout_sec: 3600

please help as I am pulling my hair out trying to resolve it.