summaryrefslogtreecommitdiffstats
path: root/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
diff options
context:
space:
mode:
authorJonas Bjurel <jonas.bjurel@ericsson.com>2015-03-02 22:46:45 +0100
committerJonas Bjurel <jonas.bjurel@ericsson.com>2015-03-09 23:00:13 +0100
commit6cb518c68eb136ad448e96716ef8b1348440949f (patch)
tree757551a8efdc4e85e19fc1b0f27555825580e5c9 /fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
parent1e106bbaca2780c10bd02b4e5fa3702d36acdf39 (diff)
Starting point for ODL Integration
***CAN BE MERGED*** - ODL build and installation (puppet manifests) including needed dependencies - Modified in accordance with Randy Levensalors comments - Added chmod 4755 /bin/fusermount due to that lately some systems dont install fuseiso withe SUID set for fusermount. Investing ongoing on why and why not consistent. - Rebased with master - ODL disabled in top Make (enable it by uncommenting the odl dirs - Removed white spaces - Hopefully fixed an issue with the docker ubuntu repos, added --no-cache=true to the fuel/docker/Make file. TODO: - Refactor collecting ODL and Java dependencies to one common place - Refactoring top Makefile - Adding CI hooks for build and deploy - Finishing integration plumbing wit Neutron/ML2 and OVS/OVSDB Change-Id: I13dd4d3a72d099316dfaa9f7cd9140781be2397b Signed-off-by: Jonas Bjurel <jonas.bjurel@ericsson.com>
Diffstat (limited to 'fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh')
-rwxr-xr-xfuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh105
1 files changed, 105 insertions, 0 deletions
diff --git a/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
new file mode 100755
index 0000000..348ce3c
--- /dev/null
+++ b/fuel/build/f_isoroot/f_bootstrap/bootstrap_admin_node.sh
@@ -0,0 +1,105 @@
+#!/bin/bash
+
+function countdown() {
+ local i
+ sleep 1
+ for ((i=$1-1; i>=1; i--)); do
+ printf '\b\b%02d' "$i"
+ sleep 1
+ done
+}
+
+function fail() {
+ echo "ERROR: Fuel node deployment FAILED! Check /var/log/puppet/bootstrap_admin_node.log for details" 1>&2
+ exit 1
+}
+# LANG variable is a workaround for puppet-3.4.2 bug. See LP#1312758 for details
+export LANG=en_US.UTF8
+showmenu="no"
+if [ -f /root/.showfuelmenu ]; then
+ . /root/.showfuelmenu
+fi
+
+echo -n "Applying default Fuel settings..."
+fuelmenu --save-only --iface=eth0
+echo "Done!"
+
+### OPNFV addition BEGIN
+shopt -s nullglob
+for script in /opt/opnfv/bootstrap/pre.d/*.sh
+do
+ echo "Pre script: $script" >> /root/pre.log 2>&1
+ $script >> /root/pre.log 2>&1
+done
+shopt -u nullglob
+### OPNFV addition END
+
+if [[ "$showmenu" == "yes" || "$showmenu" == "YES" ]]; then
+ fuelmenu
+ else
+ #Give user 15 seconds to enter fuelmenu or else continue
+ echo
+ echo -n "Press a key to enter Fuel Setup (or press ESC to skip)... 15"
+ countdown 15 & pid=$!
+ if ! read -s -n 1 -t 15 key; then
+ echo -e "\nSkipping Fuel Setup..."
+ else
+ { kill "$pid"; wait $!; } 2>/dev/null
+ case "$key" in
+ $'\e') echo "Skipping Fuel Setup.."
+ echo -n "Applying default Fuel setings..."
+ fuelmenu --save-only --iface=eth0
+ echo "Done!"
+ ;;
+ *) echo -e "\nEntering Fuel Setup..."
+ fuelmenu
+ ;;
+ esac
+ fi
+fi
+#Reread /etc/sysconfig/network to inform puppet of changes
+. /etc/sysconfig/network
+hostname "$HOSTNAME"
+
+### docker stuff
+images_dir="/var/www/nailgun/docker/images"
+
+# extract docker images
+mkdir -p $images_dir $sources_dir
+rm -f $images_dir/*tar
+pushd $images_dir &>/dev/null
+
+echo "Extracting and loading docker images. (This may take a while)"
+lrzip -d -o fuel-images.tar fuel-images.tar.lrz && tar -xf fuel-images.tar && rm -f fuel-images.tar
+popd &>/dev/null
+service docker start
+
+# load docker images
+for image in $images_dir/*tar ; do
+ echo "Loading docker image ${image}..."
+ docker load -i "$image"
+ # clean up extracted image
+ rm -f "$image"
+done
+
+# apply puppet
+puppet apply --detailed-exitcodes -d -v /etc/puppet/modules/nailgun/examples/host-only.pp
+if [ $? -ge 4 ];then
+ fail
+fi
+rmdir /var/log/remote && ln -s /var/log/docker-logs/remote /var/log/remote
+
+dockerctl check || fail
+bash /etc/rc.local
+
+### OPNFV addition BEGIN
+shopt -s nullglob
+for script in /opt/opnfv/bootstrap/post.d/*.sh
+do
+ echo "Post script: $script" >> /root/post.log 2>&1
+ $script >> /root/post.log 2>&1
+done
+shopt -u nullglob
+### OPNFV addition END
+
+echo "Fuel node deployment complete!"