mesh-tunnel.cfg.j2 605 B

12345678910111213
  1. {% for host in groups['all'] %}
  2. {% if hostvars[host] is defined %}
  3. {% if hostvars[host]['inventory_hostname'] != inventory_hostname %}
  4. auto mesh-{{hostvars[host]['inventory_hostname_short']}}
  5. iface mesh-{{hostvars[host]['inventory_hostname_short']}} inet manual
  6. pre-up ip link add $IFACE type gretap local {{ansible_default_ipv4.address}} remote {{hostvars[host]['ansible_ssh_host']}} dev {{ansible_default_ipv4.alias}}
  7. pre-up ip link set up dev $IFACE
  8. up batctl if add $IFACE
  9. post-down ip link set down dev $IFACE
  10. post-down ip link del dev $IFACE
  11. {% endif %}
  12. {% endif %}
  13. {% endfor %}