I would be happy to have the option of user-defined aliases. However,
for the sake of addressing the current issue they could lead to
unexpected internal behaviour - Right now the use of hostnames to
create the list of hosts has the (possibly unintended) side effect of
de-duplicating host entries. Using an external alias internally would
mean that more code would need to be added to handle de-duplication of
identical hosts. The proposed internal use of a host+port string as
the key for the hosts maps is in effect the equivalent of an alias,
and it is the minimum amount of data that is always available in the
Ansible code (port 22 is made implicit, but it could be made explicit
instead). The result would be that less special casing is necessary,
since aliases are not always available.
Another issue may be that from a user perspective host aliases would
seem to provide little benefit - Users can already define per-host
groups and include groups in other groups. The only additional
functionality I can think of is that aliases would affect output.
Perhaps a middle ground would be to implement aliases, and to default
them to host:port if an alias is not defined for a host. This would
allow the alias to be also used for forcing duplication of tasks per
host (which may be of limited use in regular scenarios but could be
useful in certain situations).
In the meantime, I will continue using DNS entries (come to think of
it, this simply externalizes the aliases). Once I have a little more
time I'll look into writing a proof of concept alias feature.
Regards....
PS: In the case I was testing I did use tunnels specifically, but the
issue would occur with any type of proxy host, such as virtualization
hosts where the VMs are NATed.