blob: 7b6e6bd71e6b19701e0bd187e304bfea271f47d8 (
plain)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
#!/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!"
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
echo "Fuel node deployment complete!"
|