1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
#!/bin/sh
set -e
set -x
if ! [ -r /etc/oci-poc/oci-poc.conf ] ; then
echo "Cannot read /etc/oci-poc/oci-poc.conf"
fi
. /etc/oci-poc/oci-poc.conf
MYDIR=$(pwd)
cd /var/lib/openstack-cluster-installer-poc/templates
if [ -r /root/.ssh/authorized_keys ] ; then
ROOT_SSH_KEY_PARAM="--root-ssh-key /root/.ssh/authorized_keys"
else
echo "Could not read /root/.ssh/authorized_keys, please make one."
exit 1
fi
# Build a full Debian OS with our ssh key in it
build-openstack-debian-image \
--release ${debian_release} \
--output pxe-server-node \
--boot-manager grub \
--debootstrap-url ${DEBIAN_MIRROR} \
--sources.list-mirror ${DEBIAN_MIRROR} \
--image-size 10 \
--password ${OCI_VM_ROOT_PASS} \
--no-cloud-init \
${ROOT_SSH_KEY_PARAM} \
--no-remove-host-keys \
--permit-ssh-as-root \
--hostname ${OCI_VM_FQDN} \
--static-iface type=normal,iface0=eth0,addr=${OCI_VM_IP}/24:${HOST_BRIDGE_GW} \
--security-mirror ${DEBIAN_SECURITY_MIRROR} \
--hook-script /usr/bin/oci-poc-setup-bodi-hook \
--no-cloud-kernel
# Create an empty 10GB HDD
qemu-img create slave-image.raw 20G
qemu-img convert -c -f raw slave-image.raw -o compat=0.10 -O qcow2 slave-image.qcow2
rm slave-image.raw
update-rc.d oci-poc-vms defaults
cd ${MYDIR}
|