]> git.donarmstrong.com Git - dsa-puppet.git/commitdiff
Add a couple of ganeti files
authorPeter Palfrader <peter@palfrader.org>
Tue, 19 Jun 2012 19:26:33 +0000 (21:26 +0200)
committerPeter Palfrader <peter@palfrader.org>
Tue, 19 Jun 2012 19:26:33 +0000 (21:26 +0200)
modules/ganeti2/manifests/init.pp
modules/ganeti2/templates/instance-debootstrap/hooks/00-dsa-configure-networking.erb [new file with mode: 0755]
modules/ganeti2/templates/instance-debootstrap/hooks/10-dsa-install-extra-packages.erb [new file with mode: 0755]
modules/ganeti2/templates/instance-debootstrap/hooks/20-dsa-install-bootloader.erb [new file with mode: 0755]
modules/ganeti2/templates/instance-debootstrap/hooks/30-dsa-install-ssh-keys.erb [new file with mode: 0755]
modules/ganeti2/templates/instance-debootstrap/variants.list.erb [new file with mode: 0644]
modules/ganeti2/templates/instance-debootstrap/variants/dsa.conf.erb [new file with mode: 0644]

index 7d44ee1da596a57c59b961f966069a38193e80dd..3e017b3937c03b34cf0d19b7a5cd8073717ddd07 100644 (file)
@@ -51,4 +51,26 @@ class ganeti2 {
                rule        => 'proto tcp dport ssh @subchain \'ganeti-ssh\' { saddr ( $HOST_GANETI_V4 $HOST_GANETI_BACKEND_V4) ACCEPT; }',
                notarule    => true,
        }
+
+       file {
+               '/etc/ganeti/instance-debootstrap/variants.list':
+                       content => template('ganeti2/instance-debootstrap/variants.list.erb'),
+                       ;
+               '/etc/ganeti/instance-debootstrap/variants/dsa.conf':
+                       content => template('ganeti2/instance-debootstrap/variants/dsa.conf.erb'),
+                       ;
+               '/etc/ganeti/instance-debootstrap/hooks/00-dsa-configure-networking':
+                       content => template('ganeti2/instance-debootstrap/hooks/00-dsa-configure-networking.erb'),
+                       ;
+               '/etc/ganeti/instance-debootstrap/hooks/10-dsa-install-extra-packages':
+                       content => template('ganeti2/instance-debootstrap/hooks/10-dsa-install-extra-packages.erb'),
+                       ;
+               '/etc/ganeti/instance-debootstrap/hooks/20-dsa-install-bootloader':
+                       content => template('ganeti2/instance-debootstrap/hooks/20-dsa-install-bootloader.erb'),
+                       ;
+               '/etc/ganeti/instance-debootstrap/hooks/30-dsa-install-ssh-keys':
+                       content => template('ganeti2/instance-debootstrap/hooks/30-dsa-install-ssh-keys.erb'),
+                       ;
+       }
+
 }
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
new file mode 100755 (executable)
index 0000000..6878e13
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/bash
+
+set -e
+
+if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
+  echo "Missing target directory"
+  exit 1
+fi
+
+if [ ! -d "$TARGET/etc/network" ]; then
+  echo "Missing target network directory"
+  exit 1
+fi
+
+if [ -z "$NIC_COUNT" ]; then
+  echo "Missing NIC COUNT"
+  exit 1
+fi
+
+rm -f $TARGET/etc/udev/rules.d/70-persistent-net.rules
+
+if [ "$NIC_COUNT" -gt 0 ]; then
+
+  cat > $TARGET/etc/network/interfaces <<EOF
+# /etc/network/interfaces
+
+auto lo
+iface lo inet loopback
+
+auto eth0
+iface eth0 inet static
+  address ${NIC_0_IP}
+  netmask 255.255.255.0
+  gateway 206.12.19.254
+
+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
+EOF
+
+exit 0
diff --git a/modules/ganeti2/templates/instance-debootstrap/hooks/10-dsa-install-extra-packages.erb b/modules/ganeti2/templates/instance-debootstrap/hooks/10-dsa-install-extra-packages.erb
new file mode 100755 (executable)
index 0000000..165099e
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/bash
+
+set -e
+
+if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
+  echo "Missing target directory"
+  exit 1
+fi
+
+chroot "$TARGET" apt-get -qq update
+chroot "$TARGET" apt-get -qq install vim ssh extlinux
+
+if [ "$ARCH" = "amd64" ]; then
+    chroot "$TARGET" apt-get -qq install linux-image-amd64
+fi
+
+exit 0
diff --git a/modules/ganeti2/templates/instance-debootstrap/hooks/20-dsa-install-bootloader.erb b/modules/ganeti2/templates/instance-debootstrap/hooks/20-dsa-install-bootloader.erb
new file mode 100755 (executable)
index 0000000..2bbba5e
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+set -e
+
+. common.sh
+
+CLEANUP=( )
+set -x
+trap cleanup EXIT
+
+if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
+  echo "Missing target directory"
+  exit 1
+fi
+
+# allow extlinux to find device
+mount --bind /dev $TARGET/dev
+CLEANUP+=("umount $TARGET/dev")
+mount --bind /proc $TARGET/proc
+CLEANUP+=("umount $TARGET/proc")
+
+# generate configuration
+echo 'EXTLINUX_PARAMETERS="ro console=ttyS0,38400n8"' > $TARGET/etc/default/extlinux
+chroot "$TARGET" extlinux-update
+
+# install extlinux
+chroot "$TARGET" extlinux -i /boot/extlinux
+
+# install boot record
+dd if="$TARGET/usr/lib/extlinux/mbr.bin" of=$BLOCKDEV
+
+cleanup
+trap - EXIT
+
+exit 0
diff --git a/modules/ganeti2/templates/instance-debootstrap/hooks/30-dsa-install-ssh-keys.erb b/modules/ganeti2/templates/instance-debootstrap/hooks/30-dsa-install-ssh-keys.erb
new file mode 100755 (executable)
index 0000000..895d9d6
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+set -e
+
+. common.sh
+
+if [ -z "$TARGET" -o ! -d "$TARGET" ]; then
+  echo "Missing target directory"
+  exit 1
+fi
+
+mkdir $TARGET/etc/ssh/userkeys
+cat /etc/ssh/userkeys/root > $TARGET/etc/ssh/userkeys/root
+grep '^AuthorizedKeysFile /etc/ssh/userkeys' $TARGET/etc/ssh/sshd_config || echo 'AuthorizedKeysFile /etc/ssh/userkeys/%u' >> $TARGET/etc/ssh/sshd_config
+
+exit 0
diff --git a/modules/ganeti2/templates/instance-debootstrap/variants.list.erb b/modules/ganeti2/templates/instance-debootstrap/variants.list.erb
new file mode 100644 (file)
index 0000000..58de0a2
--- /dev/null
@@ -0,0 +1,2 @@
+default
+dsa
diff --git a/modules/ganeti2/templates/instance-debootstrap/variants/dsa.conf.erb b/modules/ganeti2/templates/instance-debootstrap/variants/dsa.conf.erb
new file mode 100644 (file)
index 0000000..c93a1a6
--- /dev/null
@@ -0,0 +1,3 @@
+MIRROR="http://http.debian.net/debian"
+ARCH="amd64"
+SUITE="squeeze"