#!/bin/sh # {{ ansible_managed }} OS=`uname` {% if tinc_vpn_ipv4_net is defined %} IPv4_HOSTPREFIX={{ tinc_vpn_ipv4_net | ipv4(_hostnumber) }} {% endif %} {% if tinc_vpn_ipv6_net is defined %} IPv6_HOSTPREFIX={{ tinc_vpn_ipv6_net | ipv6(_hostnumber) }} {% endif %} case $OS in FreeBSD) [ -z "$IPv4_HOSTPREFIX" ] || ifconfig $INTERFACE $IPv4_HOSTPREFIX [ -z "$IPv6_HOSTPREFIX" ] || ifconfig $INTERFACE inet6 $IPv6_HOSTPREFIX ;; Linux) ip link set $INTERFACE up [ -z "$IPv4_HOSTPREFIX" ] || ip addr add $IPv4_HOSTPREFIX dev $INTERFACE [ -z "$IPv6_HOSTPREFIX" ] || ip -6 addr add $IPv6_HOSTPREFIX dev $INTERFACE ;; esac