# Hosts with the same host name but different SSH ports?

**URL:** <https://forum.ansible.com/t/hosts-with-the-same-host-name-but-different-ssh-ports/11886>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [September 12, 2012, 9:53pm UTC](https://forum.ansible.com/t/hosts-with-the-same-host-name-but-different-ssh-ports/11886 "2012-09-12T21:53:28Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 12, 2012, 9:53pm UTC](https://forum.ansible.com/t/hosts-with-the-same-host-name-but-different-ssh-ports/11886/1 "2012-09-12T21:53:28Z")

</div>

Yes. You can give them named aliases in resolv.conf and name them in  
the inventory file like this:

[somegroup]  
foo ansible\_ssh\_port=1234  
bar ansible\_ssh\_port=1235

---

<div class="post-metadata">

**Author:** ![Alex\_Bolgarov](https://avatars.discourse-cdn.com/v4/letter/a/71e660/32.png) [@Alex\_Bolgarov](https://forum.ansible.com/u/Alex_Bolgarov)\
**Post date:** [September 14, 2012, 2:54pm UTC](https://forum.ansible.com/t/hosts-with-the-same-host-name-but-different-ssh-ports/11886/2 "2012-09-14T14:54:23Z")

</div>

I was hoping that there is a way to do this without editing system config (like resolve.conf)

May be in some future version we may have something like this:

[somegroup]  
foo ansible\_ssh\_port=1234  
bar ansible\_ssh\_port=1235 real\_host\_name=foo

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan](https://avatars.discourse-cdn.com/v4/letter/m/c4cdca/32.png) [@Michael\_DeHaan](https://forum.ansible.com/u/Michael_DeHaan)\
**Post date:** [September 14, 2012, 4:02pm UTC](https://forum.ansible.com/t/hosts-with-the-same-host-name-but-different-ssh-ports/11886/3 "2012-09-14T16:02:55Z")

</div>

well sure.

There are two things that should be supported actually

ansible\_ssh\_user -- overrides an user at the connection plugin level

ansible\_ssh\_host -- overrides the host name at the connect plugin level

This needs to be done for both paramiko and SSH connection types and  
I'll take a patch.
