Orange-Cyberdefense/GOAD

Ansible WinRM HTTPS and Persistent "Unreachable" Error

オープン

#98 opened on 2023/05/04

 (5 件のコメント) (5 件のリアクション) (0 人の担当者)PowerShell (1,069 件のフォーク)batch import
good first issue

Repository metrics

Stars
 (7,808 個のスター)
PR merge metrics
 (30d に merged PR はありません)

説明

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.

コントリビューターガイド