Adds the non-deprecated ansible_host var (#34452)

OpenStack dynamic inventory is still using the deprecated
ansible_ssh_host. This patch adds ansible_host until such
time as ansible_ssh_host is removed

This is a backport from [1].

[1]: https://github.com/ansible/ansible/pull/23153
This commit is contained in:
Jean-Philippe Evrard 2018-05-22 14:40:44 -07:00 committed by Adam Miller
parent fde8c9b4ef
commit b20520f500

View file

@ -121,6 +121,7 @@ def get_host_groups(inventory, refresh=False):
def append_hostvars(hostvars, groups, key, server, namegroup=False): def append_hostvars(hostvars, groups, key, server, namegroup=False):
hostvars[key] = dict( hostvars[key] = dict(
ansible_ssh_host=server['interface_ip'], ansible_ssh_host=server['interface_ip'],
ansible_host=server['interface_ip'],
openstack=server) openstack=server)
for group in get_groups_from_server(server, namegroup=namegroup): for group in get_groups_from_server(server, namegroup=namegroup):
groups[group].append(key) groups[group].append(key)