touch $TARGET/etc/udev/rules.d/75-cd-aliases-generator.rules
touch $TARGET/etc/udev/rules.d/75-persistent-net-generator.rules
+
+###########################################
+fqdn=$(cat $TARGET/etc/hostname)
+echo ${fqdn%%.*} > $TARGET/etc/hostname
+
+###########################################
if [ "$NIC_COUNT" -ge 1 ]; then
cat > $TARGET/etc/network/interfaces << EOF
# /etc/network/interfaces
auto lo
iface lo inet loopback
+EOF
+fi
+
+
+###########################################
+###########################################
+<% if scope.lookupvar('::cluster').to_s == 'ganeti2.debian.org' -%>
+
+###########################################
+if [ "$NIC_COUNT" -ge 1 ]; then
+ cat >> $TARGET/etc/network/interfaces << EOF
auto eth0
iface eth0 inet static
address ${NIC_0_IP}
fi
-if [ "$NIC_COUNT" -ge 2 ]; then
+###########################################
+cat > $TARGET/etc/resolv.conf <<EOF
+# /etc/resolv.conf
+search debprivate-ubc.debian.org debian.org
+nameserver 206.12.19.20
+nameserver 206.12.19.21
+EOF
+
+###########################################
+###########################################
+<% elsif scope.lookupvar('::cluster').to_s == 'ganeti-osuosl.debian.org' -%>
+#
+###########################################
+if [ "$NIC_COUNT" -ge 1 ]; then
cat >> $TARGET/etc/network/interfaces << EOF
-auto eth1
-iface eth1 inet static
+auto eth0
+iface eth0 inet static
address ${NIC_0_IP}
- netmask 255.255.255.0
+ netmask 255.255.255.128
+ gateway 140.211.166.1
+
+ pre-up /sbin/sysctl -w net.ipv6.conf.\$IFACE.accept_ra=0 || true
EOF
fi
+###########################################
+cat > $TARGET/etc/resolv.conf <<EOF
+# /etc/resolv.conf
+search debian.org
+nameserver 140.211.166.130
+nameserver 140.211.166.131
+EOF
+
+<% elsif scope.lookupvar('::cluster').to_s == 'ganeti3.debian.org' -%>
+#
+###########################################
+if [ "$NIC_COUNT" -ge 1 ]; then
+ cat >> $TARGET/etc/network/interfaces << EOF
+auto eth0
+iface eth0 inet static
+ address ${NIC_0_IP}
+ netmask 255.255.255.192
+ gateway 82.195.75.126
+
+ pre-up /sbin/sysctl -w net.ipv6.conf.\$IFACE.accept_ra=0 || true
+EOF
+fi
+
+###########################################
cat > $TARGET/etc/resolv.conf <<EOF
# /etc/resolv.conf
-search debprivate-ubc.debian.org debian.org
-nameserver 206.12.19.20
-nameserver 206.12.19.21
+search debian.org
+nameserver 82.195.75.81
+nameserver 82.195.66.239
+nameserver 217.198.242.225
+EOF
+
+<% else -%>
+
+# No config for cluster <%= scope.lookupvar('::cluster').to_s %>
+cp /etc/resolv.conf $TARGET/etc/resolv.conf
+
+<% end -%>
+
+
+
+
+###########################################
+if [ "$NIC_COUNT" -ge 2 ]; then
+ cat >> $TARGET/etc/network/interfaces << EOF
+
+auto eth1
+iface eth1 inet static
+ address ${NIC_1_IP}
+ netmask 255.255.255.0
+EOF
+
+fi
+
+###########################################
+# clean up etc/hosts
+cat > $TARGET/etc/hosts << EOF
+127.0.0.1 localhost
+${NIC_0_IP} ${fqdn} ${fqdn%%.*}
+
+# The following lines are desirable for IPv6 capable hosts
+::1 ip6-localhost ip6-loopback
+fe00::0 ip6-localnet
+ff00::0 ip6-mcastprefix
+ff02::1 ip6-allnodes
+ff02::2 ip6-allrouters
EOF
exit 0