ansible-ffibk/roles/network-batman/templates/batman.j2
Tobias Hachmer 94cb21daad Add a bunch of new roles
- Update Readme
- Update ansible.cfg
- Add playbook to set up gateways
- Add group variables
2017-09-11 23:21:44 +02:00

18 lines
876 B
Django/Jinja

{% set ip4hex = item.value.ipv4_network | ipaddr('net') | ipaddr(magic) | ipaddr('address') | ip4_hex() -%}
{% set mac = '0201' + ip4hex -%}
#
# {{ ansible_managed }}
#
auto {{ item.key }}BAT
iface {{ item.key }}BAT inet manual
pre-up /sbin/ip link add name $IFACE type batadv
pre-up /sbin/ip link set address {{ mac | hwaddr('linux') }} dev $IFACE
pre-up /sbin/ip link set dev {{ item.key }}0 master $IFACE
pre-up /sbin/ip link set up dev $IFACE
post-up /sbin/ip addr flush dev $IFACE
post-up /usr/sbin/batctl -m $IFACE it {{ item.value.batman.it }}
post-up /usr/sbin/batctl -m $IFACE gw {{ item.value.batman.gw }}
post-up /usr/sbin/batctl -m $IFACE mm {{ item.value.batman.mm }}
post-up /usr/sbin/batctl -m $IFACE dat {{ item.value.batman.dat }}
post-down /sbin/ip link set dev {{ item.key }}0 nomaster
post-down /sbin/ip link delete $IFACE 2>&1 || true