From 70461403cb75ab1efdfee90d123fdb3e804f251e Mon Sep 17 00:00:00 2001 From: Alexander Weidinger Date: Thu, 23 Feb 2017 03:59:37 +0100 Subject: [PATCH] known_hosts: sort IP addresses in order to prevent unnecessary changes due to random ordering of dig results. --- openssh/files/ssh_known_hosts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openssh/files/ssh_known_hosts b/openssh/files/ssh_known_hosts index a5040c5..a8496dd 100644 --- a/openssh/files/ssh_known_hosts +++ b/openssh/files/ssh_known_hosts @@ -22,7 +22,7 @@ {%- set ip4 = salt['dig.A'](host) -%} {%- set ip6 = salt['dig.AAAA'](host) -%} {%- set names = [host_names.get(host, host)] -%} - {%- for ip in ip4 + ip6 -%} + {%- for ip in (ip4 + ip6)|sort -%} {%- do names.append(ip) -%} {%- for alias in aliases_ips.get(ip, []) -%} {%- if alias not in names -%}