Orange-Cyberdefense/GOAD
Ansible WinRM HTTPS and Persistent "Unreachable" Error
Aperta
#98 aperta il 4 mag 2023
good first issue
Metriche repository
- Star
- (7808 stelle)
- Metriche merge PR
- (Nessuna PR mergiata in 30 g)
Descrizione
I was consistently getting "Unreachable" error for srv02 and srv03 on my Ansible runs.
fatal: [srv03]: UNREACHABLE! => {"changed": false, "msg": "ssl: HTTPSConnectionPool(host='192.168.56.23', port=5986): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x111e4c040>, 'Connection to 192.168.56.23 timed out. (connect timeout=500)'))", "unreachable": true}
fatal: [srv02]: UNREACHABLE! => {"changed": false, "msg": "ssl: HTTPSConnectionPool(host='192.168.56.22', port=5986): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(<urllib3.connection.HTTPSConnection object at 0x111e4c040>, 'Connection to 192.168.56.22 timed out. (connect timeout=500)'))", "unreachable": true}
Light troubleshooting led me to discover that on those hosts, WinRM was only enabled in HTTP mode. Thus, only port 5985 was open. I fixed the issue by adding the following lines to the ad/sevenkingdoms.local/inventory file.
; winrm connection (windows)
[...snip...]
ansible_winrm_transport=basic
ansible_port=5985
Please consider either adding those lines to the inventory files or ensuring that WinRM HTTPS is enabled on all the hosts during build.