summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2020-04-28 10:22:03 +0200
committerChristian Pointner <equinox@spreadspace.org>2020-04-28 10:22:03 +0200
commit5d746ff6d16f081f39fd0d2b1fc6f5cb0d746ab9 (patch)
tree42485bc720b500e62356dced3fd22827090019e8
parentno more meta (diff)
vm/host: sort offset list before using it
-rw-r--r--roles/vm/host/tasks/network.yml4
1 files changed, 2 insertions, 2 deletions
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 }}