home-cloud/k3s_cluster/files/setup-floating-ip.sh
2020-05-04 00:43:29 +02:00

20 lines
384 B
Bash

#!/bin/bash
%{ if use_netdata }
cat >> /etc/netplan/60-floating.cfg <<- EOM
network:
version: 2
ethernets:
eth0:
addresses:
- ${floating_ip}/32
EOM
netplan apply
%{ else }
cat >> /etc/network/interfaces.d/99-floating.cfg <<- EOM
auto eth0:1
iface eth0:1 inet static
address ${floating_ip}
netmask 255.255.255.255
EOM
ifdown eth0:1 ; ifup eth0:1
%{ endif }