blob: 348ce3cb4c3c052172d13358c609f8d78115cf37 (
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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!"
|