Ansible winrm connectivity issue.

Hi ,

Need your help in fixing this issue.

I have a sample playbook that I have created to get ipconfig from windows machine using ansible playbook. I am trying to run the playbook from centos machine that is where I am getting below error. Your help is highly appreciated.

Hosts file:

[windows-instance]

172.28.48.57

[windows-instance:vars]

ansible_ssh_user=Administrator

ansible_ssh_pass=Gj=aWHl@Vqc9vJO4K(-Dd3C3xTC)aA-F

ansible_ssh_port=5986

ansible_connection=winrm

ansible_winrm_cert_validation=ignore

ansible_winrm_scheme=http

Playbook:

  • name: test raw module

hosts: windows-instance

tasks:

  • name: run ipconfig

raw: ipconfig

register: ipconfig

  • debug: var=ipconfig

Error:-

ansible-playbook -i /etc/ansible/hosts windows_playbook.yaml -vvv

No config file found; using defaults

PLAYBOOK: windows_playbook.yaml **********************************************************************************************************************************************************************************************************************************************

1 plays in windows_playbook.yaml

PLAY [test raw module] *******************************************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *******************************************************************************************************************************************************************************************************************************************************

Using module file /usr/local/lib/python2.7/site-packages/ansible/modules/windows/setup.ps1

<172.28.48.57> ESTABLISH WINRM CONNECTION FOR USER: Administrator on PORT 5985 TO 172.28.48.57

fatal: [172.28.48.57]: UNREACHABLE! => {

“changed”: false,

“msg”: “plaintext: HTTPConnectionPool(host=‘172.28.48.57’, port=5985): Max retries exceeded with url: /wsman (Caused by ConnectTimeoutError(<requests.packages.urllib3.connection.HTTPConnection object at 0x7f2a2a2c8350>, ‘Connection to 172.28.48.57 timed out. (connect timeout=30)’))”,

“unreachable”: true

}

to retry, use: --limit @/home/rama.gopisetti/ansible/windows_playbook.retry

PLAY RECAP *******************************************************************************************************************************************************************************************************************************************************************

172.28.48.57 : ok=0 changed=0 unreachable=1 failed=0

it is using default port 5985, but you have mentioned 5986 in vars…check that

I changed it to 5985. still getting the same error. Your help is highly appreciated.

You shouldn’t have to use “ansible_winrm_scheme”. Could you comment out that and try again?