From 79672140077aea0369aeaa294f7b910111b1fa23 Mon Sep 17 00:00:00 2001 From: Frederic Morin Date: Tue, 5 Jan 2021 00:24:15 -0500 Subject: [PATCH] Make 03-sysinfo.j2 idempotent through sorting Ansible interfaces are randomly ordered which prevent generated template 03-sysinfo.j2 from being idempotent. --- templates/03-sysinfo.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/03-sysinfo.j2 b/templates/03-sysinfo.j2 index 850df41..cca3fc6 100644 --- a/templates/03-sysinfo.j2 +++ b/templates/03-sysinfo.j2 @@ -24,7 +24,7 @@ echo "Total: $TOTALMEM / Free: $MEMFREEREAL / Swap: $SWAPUSAGE" echo {% if ansible_interfaces is defined %} echo "Interfaces:" - {% for int in ansible_interfaces %} + {% for int in ansible_interfaces | sort %} {% if "veth" not in int %} {% if "br" not in int %} echo " Interface: {{ int }}" @@ -51,4 +51,4 @@ echo echo "$DF" echo echo "Users:" -echo "$USERS" \ No newline at end of file +echo "$USERS"