From 395a0a3c87f0d16da4afcd12b295ca3e41f571e9 Mon Sep 17 00:00:00 2001 From: Paul Belanger Date: Fri, 15 Mar 2019 21:28:09 -0400 Subject: [PATCH] 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 --- playbooks/bootstrap/templates/bastion/root/.ssh/known_hosts.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/playbooks/bootstrap/templates/bastion/root/.ssh/known_hosts.j2 b/playbooks/bootstrap/templates/bastion/root/.ssh/known_hosts.j2 index daea73a..b1c1376 100644 --- a/playbooks/bootstrap/templates/bastion/root/.ssh/known_hosts.j2 +++ b/playbooks/bootstrap/templates/bastion/root/.ssh/known_hosts.j2 @@ -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 %}