From 9e75d2d84781428e95e2d8f14ddb526109fd097d Mon Sep 17 00:00:00 2001 From: davidplunkett Date: Wed, 26 Sep 2018 18:23:18 +0000 Subject: [PATCH] additional OS configuration for genesis host Change-Id: I8b7b09d16ddd8aa0e0a27ad1e0e573e96a4ad163 Signed-off-by: davidplunkett --- firstboot-genesis.sh.template | 115 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 112 insertions(+), 3 deletions(-) diff --git a/firstboot-genesis.sh.template b/firstboot-genesis.sh.template index e175351..2fa0545 100644 --- a/firstboot-genesis.sh.template +++ b/firstboot-genesis.sh.template @@ -27,6 +27,15 @@ echo " " echo "Updating available packages" apt-get update +apt-get install -y --install-recommends linux-generic-hwe-16.04 xserver-xorg-hwe-16.04 +apt-get install -y ipmitool + +# Adding 3 node cluster related changes +swapoff --all +ln -s /etc/apparmor.d/usr.sbin.ntpd /etc/apparmor.d/disable/ +ln -s /etc/apparmor.d/usr.sbin.tcpdump /etc/apparmor.d/disable/ +apparmor_parser -R /etc/apparmor.d/usr.sbin.ntpd +apparmor_parser -R /etc/apparmor.d/usr.sbin.tcpdump echo "Adding IP Tables Rules" echo 1 > /proc/sys/net/ipv4/ip_forward @@ -38,7 +47,7 @@ echo "Creating Ceph journal partition and filesystem" # create ceph journal partition and filesystem devices=sdh -size=320 +#size=320 echo "creating partions for ceph journal:" echo $devices @@ -46,7 +55,7 @@ echo $devices for d in $devices do parted -s /dev/${d} mklabel msdos - parted -s /dev/${d} -- mkpart primary ext4 1 ${size} + parted -s -a optimal /dev/${d} -- mkpart primary ext4 1 -1s done partprobe sleep 5 #let udev settle down @@ -54,7 +63,7 @@ sleep 5 #let udev settle down devnum=1 for d in $devices do - mountpoint=/var/lib/openstack-helm/ceph/journal/ceph${devnum} + mountpoint=/var/lib/ceph/journal mkfs -t ext4 /dev/${d}${devnum} UUID=$(blkid -o export /dev/${d}${devnum} | sed -ne /^UUID/s/UUID=//p) mkdir -p ${mountpoint} @@ -63,6 +72,106 @@ do done /bin/mount -a +devnum=1 +for d in $devices +do + df -lh /dev/${d}${devnum} + if [ $? -eq 0 ] + then + echo " ${d}${devnim} Filesystem Created successfully" + else + echo " ${d}${devnim} Filesystem not Found" + fi +done + +# Creating Network interfaces for Calico, Neutron and Storage +echo " Creating Additional Network interfaces" +bond=@@SRV_BOND@@"." +storage=${bond}@@SRV_STORAGE_VLAN@@ +calico=${bond}@@SRV_CALICO_VLAN@@ +neutron=${bond}@@SRV_NEUTRON_VLAN@@ + +cp -p /etc/network/interfaces /etc/network/interfaces.orig + +#Creating Storage interface +if [ -n "@@SRV_STORAGE_VLAN@@" ]; then + echo "Configuring Storage interface in the server" + tee -a /etc/network/interfaces << END + #STORAGE + auto $storage + iface $storage inet static + address @@SRV_STORAGE_IP@@ + netmask 255.255.255.0 + vlan-raw-device @@SRV_BOND@@ + mtu @@SRV_MTU@@ +END + ifup $storage + if [ $? -eq 0 ]; then + echo " Storage interface Created" + else + echo " Failed to create Storage Interface" + fi +fi + +#Creating Calico Interface +if [ -n "@@SRV_CALICO_VLAN@@" ]; then + echo "Configuring Calico Interface in the server" + tee -a /etc/network/interfaces << END + #CALICO + auto $calico + iface $calico inet static + address @@SRV_CALICO_IP@@ + netmask 255.255.255.0 + vlan-raw-device @@SRV_BOND@@ + mtu @@SRV_MTU@@ +END + ifup $calico + if [ $? -eq 0 ]; then + echo " Calico interface Created" + else + echo " Failed to create Calico Interface" + fi +fi + +# Creating Overlay/Neutron interface + +if [ -n "@@SRV_NEUTRON_VLAN@@" ]; then + echo "Configuring Neutron Interface in the server" + tee -a /etc/network/interfaces << END + #OVERLAY/NEUTRON + auto $neutron + iface $neutron inet static + address @@SRV_NEUTRON_IP@@ + netmask 255.255.255.0 + vlan-raw-device @@SRV_BOND@@ + mtu @@SRV_MTU@@ +END + ifup $neutron + if [ $? -eq 0 ]; then + echo " Neutron interface Created" + else + echo " Failed to create Neutron Interface" + fi +fi +# Creating PXE interface + +if [ -n "@@SRV_PXE_INF@@" ]; then + echo "Configuring PXE Interface in the server" + tee -a /etc/network/interfaces << END + #OVERLAY/NEUTRON + auto @@SRV_PXE_INF@@ + iface @@SRV_PXE_INF@@ inet static + address @@SRV_PXE_IP@@ + netmask 255.255.255.0 + mtu @@SRV_MTU@@ +END + ifup @@SRV_PXE_INF@@ + if [ $? -eq 0 ]; then + echo " PXE interface Created" + else + echo " Failed to create PXE Interface" + fi +fi exit -- 2.16.6