Allow user to specify the first boot script 40/140/1
authordavidplunkett <dp7642@att.com>
Fri, 27 Jul 2018 05:41:50 +0000 (01:41 -0400)
committerdavidplunkett <dp7642@att.com>
Fri, 27 Jul 2018 05:41:50 +0000 (01:41 -0400)
Change-Id: I28ef9af9ce8a0950c74d9177ba1b0aa0fbee1195
Signed-off-by: davidplunkett <dp7642@att.com>
firstboot-genesis.sh.template
install_server_os.sh
serverrc.template

index 8405f2f..e175351 100644 (file)
@@ -27,23 +27,42 @@ echo " "
 
 echo "Updating available packages"
 apt-get update 
-apt-get install -y apt-transport-https
 
-echo "Adding docker source and key"
-curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -  
-echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" >/etc/apt/sources.list.d/kubernetes.list
+echo "Adding IP Tables Rules"
+echo 1 > /proc/sys/net/ipv4/ip_forward 
+iptables -t nat -A POSTROUTING -o bond0.41 -j MASQUERADE 
+iptables -A FORWARD -i bond0.41 -o eno3 -m state --state RELATED,ESTABLISHED -j ACCEPT 
+iptables -A FORWARD -i eno3 -o bond0.41 -j ACCEPT
 
-echo "Updating available packages"
-apt-get update &>/dev/null
+echo "Creating Ceph journal partition and filesystem"
+# create ceph journal partition and filesystem
+
+devices=sdh
+size=320
+
+echo "creating partions for ceph journal:"
+echo $devices
 
-echo "Installing docker"
-apt-get install -y docker.io aufs-tools  2>&1
+for d in $devices
+do
+   parted -s /dev/${d} mklabel msdos
+   parted -s /dev/${d} -- mkpart primary ext4 1 ${size}
+done
+partprobe
+sleep 5 #let udev settle down
 
-echo "Checking that docker is running"
-docker ps
+devnum=1
+for d in $devices
+do
+   mountpoint=/var/lib/openstack-helm/ceph/journal/ceph${devnum}
+   mkfs -t ext4  /dev/${d}${devnum}
+   UUID=$(blkid -o export /dev/${d}${devnum} | sed -ne /^UUID/s/UUID=//p)
+   mkdir -p ${mountpoint}
+   echo "UUID=$UUID ${mountpoint} ext4 defaults,nofail 0 0" >>/etc/fstab
+   devnum=$((devnum+1))
+done
 
-echo "Installing sshpass, python-requests and xorriso"
-apt-get install -y sshpass python-requests xorriso  2>&1
+/bin/mount -a
 
 exit
 
index 4c2d712..348e22c 100755 (executable)
@@ -91,6 +91,7 @@ fi
 IPXE_VLAN=$SRV_VLAN
 IPXE_INTF=$SRV_IPXE_INF
 IPXE_URL=http://$BUILD_WEBIP:$BUILD_WEBPORT/ipxe-$SRV_IPXE_INF-$SRV_VLAN.efi
+SRV_FIRSTBOOT_TEMPLATE=${SRV_FIRSTBOOT_TEMPLATE:-firstboot.sh.template}
 
 if [ -z "$NO_CONFIRM" ]; then
     echo ""
@@ -170,7 +171,7 @@ fi
 
 ## ADD FIRSTBOOT SCRIPT TO WEB ROOT
 echo "Adding firstboot script [$SRV_NAME.firstboot.sh] to web root [$WEB_ROOT]"
-cp -f $TOOLS_ROOT/firstboot.sh.template $WEB_ROOT/$SRV_NAME.firstboot.sh
+cp -f $TOOLS_ROOT/$SRV_FIRSTBOOT_TEMPLATE $WEB_ROOT/$SRV_NAME.firstboot.sh
 
 for VAR in $(set | grep -P "^SRV_|^BUILD_" | cut -f 1 -d'='); do
     sed -i -e "s|@@$VAR@@|${!VAR}|g" $WEB_ROOT/$SRV_NAME.firstboot.sh
@@ -179,7 +180,7 @@ done
 ## CHECK THAT ALL VALUES WERE REPLACED
 MISSING=$(grep -Po "@@.*?@@" $WEB_ROOT/$SRV_NAME.firstboot.sh | sort | uniq)
 if [ -n "$MISSING" ] ; then
-    echo "ERROR:  Required variable(s) in template [firstboot.sh.template] were not located in the resource file [$RCFILE]"
+    echo "ERROR:  Required variable(s) in template [$SRV_FIRSTBOOT_TEMPLATE] were not located in the resource file [$RCFILE]"
     echo ${MISSING//@@/} | xargs -n 1 | sed -e 's/^/        /g'
     exit 1
 fi
index 09114d3..0e54679 100644 (file)
@@ -56,6 +56,10 @@ SRV_BIOS_TEMPLATE=dell_r740_g14_uefi_base.xml.template
 SRV_BOOT_TEMPLATE=dell_r740_g14_uefi_httpboot.xml.template
 SRV_HTTP_BOOT_DEV=NIC.Slot.3-1-1
 
+# tempalte to run to configure OS after first boot
+# current options are: firstboot.sh.template, firstboot-genesis.sh.tempate or firstboot-airship-iab.sh.template
+SRV_FIRSTBOOT_TEMPLATE=firstboot.sh.template
+
 # VLAN to use during build and for final network configuration
 SRV_VLAN=41