inventory with different ports, same address

Hi all,

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

[first]
example.com:1234
[second]
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 ansible_ssh_port=1234
etc,

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

in Ansible, a host key is a unique thing.

You’d want this

ex1 ansible_ssh_host=example.com ansible_ssh_port=1234
ex2 ansible_ssh_host=example.com ansible_ssh_port=1235

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