Orange-Cyberdefense/GOAD

Ansible WinRM HTTPS and Persistent "Unreachable" Error

Aberta

#98 aberto em 4 de mai. de 2023

 (5 comentários) (5 reações) (0 responsável)PowerShell (1.069 forks)batch import
good first issue

Métricas do repositório

Stars
 (7.808 estrelas)
Métricas de merge de PR
 (Métricas PR pendentes)

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.

Guia do colaborador