Switch to inventory_hostname for known_hosts

It is possible that we don't have ansible_hostname in hostvars, but all
hosts in the inventory will have inventory_hostname.

Change-Id: Id15c321dd86ce6cc47e90569327bea0f98b7ef43
Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2019-03-15 21:28:09 -04:00
parent 67d1711dbd
commit 395a0a3c87
1 changed files with 1 additions and 1 deletions

View File

@ -4,7 +4,7 @@
{% for host in groups['all']|sort %}
{% if hostvars[host].ansible_host is defined %}
{% if hostvars[host].ansible_ssh_host_key_ed25519_public is defined %}
{{ hostvars[host].ansible_hostname }},{{ hostvars[host].ansible_host }} ssh-ed25519 {{ hostvars[host].ansible_ssh_host_key_ed25519_public }}
{{ hostvars[host].inventory_hostname }},{{ hostvars[host].ansible_host }} ssh-ed25519 {{ hostvars[host].ansible_ssh_host_key_ed25519_public }}
{% endif %}
{% endif %}
{% endfor %}