23 lines
1.1 KiB
Text
23 lines
1.1 KiB
Text
|
{% set ip4hex = item.value.ipv4_network | ipaddr('net') | ipaddr(magic) | ipaddr('address') | ip4_hex() -%}
|
||
|
{% set mac = '0210' + ip4hex -%}
|
||
|
#
|
||
|
# {{ ansible_managed }}
|
||
|
#
|
||
|
auto {{ item.key }}BR
|
||
|
iface {{ item.key }}BR inet manual
|
||
|
address {{ item.value.ipv4_network | ipaddr('net') | ipaddr(magic) | ipaddr('address') }}
|
||
|
network {{ item.value.ipv4_network | ipaddr('net') | ipaddr(magic) | ipaddr('network') }}
|
||
|
netmask {{ item.value.ipv4_network | ipaddr('net') | ipaddr(magic) | ipaddr('netmask') }}
|
||
|
broadcast {{ item.value.ipv4_network | ipaddr('net') | ipaddr(magic) | ipaddr('broadcast') }}
|
||
|
pre-up /sbin/ip link add name $IFACE type bridge
|
||
|
pre-up /sbin/ip link set address {{ mac | hwaddr('linux') }} dev $IFACE
|
||
|
pre-up /sbin/ip link set dev {{ item.key }}BAT master $IFACE
|
||
|
pre-up /sbin/ip link set up dev $IFACE
|
||
|
{% for ip_type, ip_list in item.value.ipv6.iteritems() %}
|
||
|
{% for ip in ip_list %}
|
||
|
up /sbin/ip address add {{ ip | ipaddr('net') | ipsubnet(64, 0) | ipaddr(magic) }} dev $IFACE
|
||
|
{% endfor %}
|
||
|
{% endfor %}
|
||
|
post-down /sbin/ip link set dev {{ item.key }}BAT nomaster
|
||
|
post-down /sbin/ip link delete $IFACE 2>&1 || true
|