# Unable to Connect to Remote Host but Connecting to Local Server

**URL:** <https://forum.ansible.com/t/unable-to-connect-to-remote-host-but-connecting-to-local-server/37711>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [March 1, 2023, 5:22pm UTC](https://forum.ansible.com/t/unable-to-connect-to-remote-host-but-connecting-to-local-server/37711 "2023-03-01T17:22:19Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Poseidon\_Olympian](https://avatars.discourse-cdn.com/v4/letter/p/e274bd/32.png) [@Poseidon\_Olympian](https://forum.ansible.com/u/Poseidon_Olympian)\
**Post date:** [March 1, 2023, 5:22pm UTC](https://forum.ansible.com/t/unable-to-connect-to-remote-host-but-connecting-to-local-server/37711/1 "2023-03-01T17:22:19Z")

</div>

Hello…

Looking for help and support on my issue in connecting to remote host.  
Basically, I can able to ssh to remote host but when trying to run an ansible ad-hoc to test my connection, it couldn’t connect to the remote host but instead the result is the local server.

_here’s the snapshot…_  
_Local Server: awssandbox001.test.com.aws_

_inventory host_  
_[test-server]_  
_awstarget001.test.com.aws_

_awstarget002.test.co.aws_

_/home\> ansible test-server -m shell -a ‘hostname’_  
_awstarget001.test.com.aws | CHANGED | rc=0 \>\>_  
_awssandbox001.test.com.aws_  
_awstarget002.test.com.aws | CHANGED | rc=0 \>\>_  
_awssandbox001.test.com.aws_

Thank you and appreciated…

Jacob
