Orange-Cyberdefense/GOAD

Ansible WinRM HTTPS and Persistent "Unreachable" Error

Ouverte

#98 ouverte le 4 mai 2023

 (5 commentaires) (5 réactions) (0 personne assignée)PowerShell (1 069 forks)batch import
good first issue

Métriques du dépôt

Stars
 (7 808 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

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.

Guide contributeur