Browse Source

The gre tunnel configs are now generated for all hosts in the inventory

Till Klocke 9 years ago
parent
commit
fb9c1f6c04

+ 6 - 9
roles/internal/ffdo.mesh-interfaces/templates/gre-tunnel.j2

@@ -1,14 +1,11 @@
-{% if supernode_mesh_backbones is defined %}
-{% for backbone in supernode_mesh_backbones %}
-{% if backbone.comment is defined %}
-# {{backbone.comment}}
-{% endif %}
-auto {{backbone.name}}
-iface {{backbone.name}} inet manual
-    pre-up ip link add $IFACE type gretap local {{backbone.local_ip}} remote {{backbone.remote_ip}} dev {{backbone.interface|default(supernode_public_interface)}}
+{% for host in hostvars %}
+{% if host['ansible_fqdn'] != ansible_fqdn %}
+auto {{host['ansible_fqdn']}}
+iface {{host['ansible_fqdn']}} inet manual
+    pre-up ip link add $IFACE type gretap local {{ansible_default_ipv4.address}} remote {{host['ansible_default_ipv4']['address']}} dev {{ansible_default_ipv4.alias}}
     pre-up ip link set up dev $IFACE
     up batctl if add $IFACE
     post-down ip link set down dev $IFACE
     post-down ip link del dev $IFACE
+{% endif %}
 {% endfor %}
-{% endif %}

+ 12 - 12
roles/internal/ffdo.mesh-interfaces/templates/mesh_interfaces.j2

@@ -4,7 +4,7 @@
 auto meshdummy0
 iface meshdummy0 inet manual
     pre-up ip link add $IFACE type dummy
-    pre-up ip link set address {{supernode_mesh_mac}} dev $IFACE
+    pre-up ip link set address {{mesh_mac}} dev $IFACE
     pre-up ip link set up dev $IFACE
     post-down ip link set down dev $IFACE
     post-down ip link del dev $IFACE
@@ -13,17 +13,17 @@ iface meshdummy0 inet manual
 # batman-adv Mesh Interface, wird von meshdummy0 per Hotplug aktiviert
 allow-hotplug bat0
 iface bat0 inet static
-    address {{supernode_mesh_ipv4|ipaddr('address')}}
-    netmask {{supernode_mesh_ipv4|ipaddr('netmask')}}
-    hwaddress {{supernode_bat_macaddress}}
-    pre-up ip rule add from {{supernode_mesh_ipv4}} table 42
-    pre-up ip rule add to {{supernode_mesh_ipv4}} table 42
+    address {{mesh_ipv4|ipaddr('address')}}
+    netmask {{mesh_ipv4|ipaddr('netmask')}}
+    hwaddress {{bat_mac}}
+    pre-up ip rule add from {{mesh_ipv4}} table 42
+    pre-up ip rule add to {{mesh_ipv4}} table 42
     pre-up batctl it 5000
     pre-up batctl bl 0
     pre-up batctl gw server 48mbit/48mbit
     pre-up echo 120 > /sys/class/net/$IFACE/mesh/hop_penalty
-    post-down ip rule del from {{supernode_mesh_ipv4}} table 42
-    post-down ip rule del to {{supernode_mesh_ipv4}} table 42
+    post-down ip rule del from {{mesh_ipv4}} table 42
+    post-down ip rule del to {{mesh_ipv4}} table 42
     # Paralleles Macvlan-Interface mit fixer MTU fuer Alfred
     up ip link add link $IFACE alfred0 type macvlan
     up ip link set dev alfred0 mtu 1280
@@ -33,8 +33,8 @@ iface bat0 inet static
 
 iface bat0 inet6 static
     address {{supernode_mesh_ipv6}}
-    pre-up ip -6 rule add from {{supernode_mesh_ipv6|ipaddr('cidr')}} table 42
-    pre-up ip -6 rule add to {{supernode_mesh_ipv6|ipaddr('cidr')}} table 42
-    post-down ip -6 rule del from {{supernode_mesh_ipv6|ipaddr('cidr')}} table 42
-    post-down ip -6 rule del to {{supernode_mesh_ipv6|ipaddr('cidr')}} table 42
+    pre-up ip -6 rule add from {{mesh_ipv6|ipaddr('cidr')}} table 42
+    pre-up ip -6 rule add to {{mesh_ipv6|ipaddr('cidr')}} table 42
+    post-down ip -6 rule del from {{mesh_ipv6|ipaddr('cidr')}} table 42
+    post-down ip -6 rule del to {{mesh_ipv6|ipaddr('cidr')}} table 42
     #pre-up ebtables -A FORWARD -p IPv6 -i $IFACE --ip6-proto ipv6-icmp --ip6-icmp-type router-advertisement -j DROP