Unreachable : Failed to connect to the host via ssh

54 views
Skip to first unread message

Newbie

unread,
Jun 24, 2020, 9:18:24 AM6/24/20
to Ansible Project
Dear All,

I have created my RHEL 8, AWS EC2 instances and Windows 2019 AWS EC2 instance 

And, have installed Ansible and followed the prerequisites on control node.

Equally I have created user and ran the script <https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1> from windows machine.

Also installed Pywinrm on control node and updated inventory file carefully as below:

[winhost:vars]
ansible_user=mahesh
ansible_password=password
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore

Now when I start ping my windows machine it is returning me an error: - 

UNREACHABLE! => {
    "changed": false,
    "msg": "Failed to connect to the host via ssh: ssh: connect to host XX.XX.XX.XX port 22: Connection timed out",
    "unreachable": true
}


Though I mentioned the host vars section is: ansible_winrm_server_cert_validation=ignore, it is still checking ssh and kept on faily.

I request can someone suggest in this regards

Thank you very much in advance for your suggestions!

Dick Visser

unread,
Jun 24, 2020, 9:48:48 AM6/24/20
to ansible...@googlegroups.com
- Is this your entire inventory file? If not please post that
- What is the actual command you used to "ping" the windows machine?

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/143b71a0-ca40-4bc6-8a5b-eae0f3a8d982o%40googlegroups.com.


--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

Mahesh b

unread,
Jun 24, 2020, 9:57:52 AM6/24/20
to ansible...@googlegroups.com, dick....@geant.org
Thanks for your response!

## Entire Inventory file -

[windows]
XX.XX.XX.XX


[winhost:vars]
ansible_user=mahesh
ansible_password=India@1234
ansible_connection=winrm
ansible_winrm_server_cert_validation=ignore


## Command used to ping windows servers - 

ansible windows -m win_ping






--
Thanks & Regards,
Mahesh Babu Bitra 
VCP5,VCA-DCV and ITIL2011

Jordan Borean

unread,
Jun 24, 2020, 8:04:16 PM6/24/20
to Ansible Project
You have defined the vars for the group 'winhost' but have defined the host in the group 'windows'. That's why the connection and other vars are not being applied to the host when running.

Mahesh b

unread,
Jun 24, 2020, 9:27:06 PM6/24/20
to ansible...@googlegroups.com
Thanks a ton, it's a great clue.

I confirm now my windows server is started responding from Ansible.

Ping = Success.

Thanks again!



On Thu, Jun 25, 2020 at 5:34 AM Jordan Borean <jbor...@gmail.com> wrote:
You have defined the vars for the group 'winhost' but have defined the host in the group 'windows'. That's why the connection and other vars are not being applied to the host when running.

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages