gretap.j2 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. # This file is managed by ansible, don't make changes here - they will be overwritten.
  2. {% set indexer = [0] %}
  3. {% set hosts = [] %}
  4. {% for domaene in domaenenliste|dictsort %}
  5. {% for dummy in hosts %}
  6. {% if hosts.pop() %}
  7. {% endif %}
  8. {% endfor %}
  9. {% if hosts|length and hosts.pop() %}
  10. {% endif %}
  11. {% for host in groups['mapserver'] %}
  12. {% if hosts.append(host) %}
  13. {% endif %}
  14. {% endfor %}
  15. {% for host in groups['supernodes'] %}
  16. {% if ansible_ssh_host != hostvars[host].ansible_ssh_host and hostvars[host].domaenenliste is defined and domaene[0] in hostvars[host].domaenenliste and hosts.append(host) %}
  17. {% endif %}
  18. {% endfor %}
  19. {% for host in hosts %}
  20. {% if hostvars[host] is defined %}
  21. {% if indexer.append(indexer.pop() + 1) %}{% endif %}{# increment indexer by 1 #}
  22. # GRETAP Tunnel for domaene-{{domaene[0]}} to {{host}} ({{hostvars[host].ansible_ssh_host}})
  23. auto t{{domaene[0]}}-{{host}}
  24. iface t{{domaene[0]}}-{{host}} inet manual
  25. {% if build_tunnels_over_ipv6_if_available is defined and build_tunnels_over_ipv6_if_available == "yes" and ansible_default_ipv6.address is defined %}
  26. pre-up ip link add $IFACE type ip6gretap local {{ansible_default_ipv6.address}} remote {{hostvars[host]['ansible_default_ipv6']['address']}} dev {{ansible_default_ipv6.interface}} key {{domaene[0]|int}}
  27. {% else %}
  28. pre-up ip link add $IFACE type gretap local {{ansible_default_ipv4.address}} remote {{hostvars[host].ansible_ssh_host}} dev {{ primary_vnic }} key {{domaene[0]|int}}
  29. {% endif %}
  30. pre-up ip link set dev $IFACE address de:ad:be:ef:{{indexer[0]}}:{{vm_id}}
  31. pre-up ip link set $IFACE up
  32. post-up batctl -m bat{{domaene[0]}} if add $IFACE ||:
  33. pre-down batctl -m bat{{domaene[0]}} if del $IFACE ||:
  34. post-down ip link del $IFACE
  35. {% endif %}
  36. {% endfor %}
  37. {% endfor %}