From 5d746ff6d16f081f39fd0d2b1fc6f5cb0d746ab9 Mon Sep 17 00:00:00 2001 From: Christian Pointner Date: Tue, 28 Apr 2020 10:22:03 +0200 Subject: vm/host: sort offset list before using it --- roles/vm/host/tasks/network.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'roles') diff --git a/roles/vm/host/tasks/network.yml b/roles/vm/host/tasks/network.yml index 3f2cdf5c..bc207805 100644 --- a/roles/vm/host/tasks/network.yml +++ b/roles/vm/host/tasks/network.yml @@ -41,8 +41,8 @@ up /sbin/iptables -t nat -A POSTROUTING -o {{ ansible_default_ipv4.interface }} -s {{ item.value.prefix | ipaddr('network/prefix') }} -j SNAT --to {{ ansible_default_ipv4.address }} {% endif %} {% if 'overlay' in item.value %} - {% for dest in item.value.overlay.offsets %} - up /bin/ip route add {{ (item.value.overlay.prefix | ipaddr(item.value.overlay.offsets[dest])).split('/')[0] }}/32 via {{ (item.value.prefix | ipaddr(item.value.offsets[dest])).split('/')[0] }} # {{ dest }} + {% for dest, offset in (item.value.overlay.offsets | dictsort(by='value')) %} + up /bin/ip route add {{ (item.value.overlay.prefix | ipaddr(offset)).split('/')[0] }}/32 via {{ (item.value.prefix | ipaddr(item.value.offsets[dest])).split('/')[0] }} # {{ dest }} {% endfor %} up /bin/ip route add unreachable {{ item.value.overlay.prefix }} down /sbin/ip route del {{ item.value.overlay.prefix }} -- cgit v1.2.3