+netplan_yaml() {
+ # network configuration using ubuntu's netplan.io
+ local IFNAME="$1"
+ local METHOD="$2"
+ echo "Generating netplan configuration for $IFNAME ($METHOD)" >&2
+ echo "# generated by FAI"
+ echo "network:"
+ echo " version: 2"
+ echo " renderer: $RENDERER"
+ case "$RENDERER" in
+ networkd)
+ echo " ethernets:"
+ echo " $IFNAME:"
+ case "$METHOD" in
+ dhcp)
+ echo " dhcp4: true"
+ ;;
+ static)
+ echo " addresses: [$CIDR]"
+ echo " gateway4: $GATEWAYS_1"
+ echo " nameservers:"
+ echo " search: [$DOMAIN]"
+ echo " addresses: [${DNSSRVS// /, }]"
+ ;;
+ esac
+ esac
+}
+
+iface_stanza() {
+ # classic network configuration using /etc/network/interfaces
+ local IFNAME="$1"
+ local METHOD="$2"
+ echo "Generating interface configuration for $IFNAME ($METHOD)" >&2
+ echo "# generated by FAI"
+ echo "auto $IFNAME"
+ echo "iface $IFNAME inet $METHOD"
+ case "$METHOD" in
+ static)
+ echo " address $IPADDR"
+ echo " netmask $NETMASK"
+ echo " broadcast $BROADCAST"
+ echo " gateway $GATEWAYS"
+ ;;
+ esac
+}
+