ansible-ffibk/roles/network-batman/templates/dummy.j2

13 lines
477 B
Text
Raw Normal View History

{% set ip4hex = item.value.ipv4_network | ipaddr('net') | ipaddr(magic) | ipaddr('address') | ip4_hex() -%}
{% set mac = '0200' + ip4hex -%}
#
# {{ ansible_managed }}
#
auto {{ item.key }}0
iface {{ item.key }}0 inet manual
pre-up /sbin/ip link add $IFACE type dummy
pre-up /sbin/ip link set address {{ mac | hwaddr('linux') }} dev $IFACE
pre-up /sbin/ip link set up dev $IFACE
post-up /sbin/ip addr flush dev $IFACE
post-down /sbin/ip link delete $IFACE 2>&1 || true