X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=modules%2Fganeti2%2Ftemplates%2Finstance-debootstrap%2Fhooks%2F00-dsa-configure-networking.erb;h=8449f914595c88e240f29cdd6ea1feccb2c1eeed;hb=0d6c99a290c4a6da0acc953759ed20e046a41a3c;hp=fe2a281880f6a5979023b179d7b33a52edd58a90;hpb=68c6d6dea85c499a6b2788a4d96215adb7df9f32;p=dsa-puppet.git diff --git a/modules/ganeti2/templates/instance-debootstrap/hooks/00-dsa-configure-networking.erb b/modules/ganeti2/templates/instance-debootstrap/hooks/00-dsa-configure-networking.erb index fe2a2818..8449f914 100755 --- a/modules/ganeti2/templates/instance-debootstrap/hooks/00-dsa-configure-networking.erb +++ b/modules/ganeti2/templates/instance-debootstrap/hooks/00-dsa-configure-networking.erb @@ -22,6 +22,12 @@ rm -f $TARGET/etc/udev/rules.d/70-persistent-net.rules 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 @@ -29,6 +35,16 @@ if [ "$NIC_COUNT" -ge 1 ]; then auto lo iface lo inet loopback +EOF + + +########################################### +########################################### +<% 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} @@ -44,6 +60,50 @@ EOF fi +########################################### +cat > $TARGET/etc/resolv.conf < +# +########################################### +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.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 < + +cp /etc/resolv.conf $TARGET/etc/resolv.conf + +<% end -%> + + + + +########################################### if [ "$NIC_COUNT" -ge 2 ]; then cat >> $TARGET/etc/network/interfaces << EOF @@ -55,19 +115,11 @@ EOF fi -fqdn=$(cat $TARGET/etc/hostname) -echo ${fqdn%%.*} > $TARGET/etc/hostname - -cat > $TARGET/etc/resolv.conf < $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