# inventory with different ports, same address

**URL:** <https://forum.ansible.com/t/inventory-with-different-ports-same-address/15038>\
**Category:** Ansible Project\
**Created:** [April 17, 2014, 8:22am UTC](https://forum.ansible.com/t/inventory-with-different-ports-same-address/15038 "2014-04-17T08:22:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jorrit.boekel](https://avatars.discourse-cdn.com/v4/letter/j/e480ec/32.png) [@jorrit.boekel](https://forum.ansible.com/u/jorrit.boekel)\
**Post date:** [April 17, 2014, 8:22am UTC](https://forum.ansible.com/t/inventory-with-different-ports-same-address/15038/1 "2014-04-17T08:22:47Z")

</div>

Hi all,

In my setup with ansible 1.5.4 if I have the following inventory:

[first]  
[example.com:1234](http://example.com:1234)  
[second]  
[example.com:1235](http://example.com:1235)

and a play:  
hosts:

- first
- second  
roles:
- do\_stuff

Ansible will only execute tasks on of those, I believe it was the top one. I have no problems with that after changing inventory to:  
[first]  
firstserver ansible\_ssh\_host=[example.com](http://example.com) ansible\_ssh\_port=1234  
etc,

Don’t know if this is expected behaviour, but wanted to inform just in case.  
cheers.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [April 17, 2014, 11:55am UTC](https://forum.ansible.com/t/inventory-with-different-ports-same-address/15038/2 "2014-04-17T11:55:42Z")

</div>

in Ansible, a host key is a unique thing.

You’d want this

ex1 ansible\_ssh\_host=[example.com](http://example.com) ansible\_ssh\_port=1234  
ex2 ansible\_ssh\_host=[example.com](http://example.com) ansible\_ssh\_port=1235

Which would define two hosts, with two different unique keys.
