From 5bc498ac381637eec536c4ead9290342b47fb2f3 Mon Sep 17 00:00:00 2001 From: Andy Witter Date: Thu, 4 Apr 2019 15:45:16 -0400 Subject: [PATCH] Fix hard-coded etherenet interfaces on LVS servers. --- templates/lvs/haresources | 2 +- templates/lvs/interfaces | 16 ++++++++-------- templates/setup-drone.sh | 2 ++ templates/setup-functions | 3 ++- templates/setup-head.sh | 2 ++ templates/setup.sh | 6 ++++++ 6 files changed, 21 insertions(+), 10 deletions(-) diff --git a/templates/lvs/haresources b/templates/lvs/haresources index 20ee583..b3b8154 100755 --- a/templates/lvs/haresources +++ b/templates/lvs/haresources @@ -1 +1 @@ -FIRST_LVS IPaddr::ClusterPublic_IP/ClusterPublic_CIDR/eth1/ClusterPublic_Bcast IPaddr::Lvs01Private_Shared_IP/24/eth0/lvs01Private_Net.255 +FIRST_LVS IPaddr::ClusterPublic_IP/ClusterPublic_CIDR/Primary_Interface/ClusterPublic_Bcast IPaddr::Lvs01Private_Shared_IP/24/Private_Interface/lvs01Private_Net.255 diff --git a/templates/lvs/interfaces b/templates/lvs/interfaces index 07a721e..ab95555 100755 --- a/templates/lvs/interfaces +++ b/templates/lvs/interfaces @@ -6,8 +6,8 @@ auto lo iface lo inet loopback # The primary network interface -auto eth1 -iface eth1 inet static +auto Primary_Interface +iface Primary_Interface inet static name Public Address address Pub_IP netmask Pub_NETMASK @@ -16,22 +16,22 @@ iface eth1 inet static dns-nameservers 127.0.0.1 LVS01_Private_IP LVS02_Private_IP dns-search CLUSTER_DOMAINNAME -auto eth1:0 -iface eth1:0 inet static +auto Primary_Interface:0 +iface Primary_Interface:0 inet static name LVS Public Shared Address address Cluster_Public_IP netmask Pub_NETMASK -auto eth0 -iface eth0 inet static +auto Private_Interface +iface Private_Interface inet static name Private Address address Priv_Physical_Address netmask 255.255.255.0 -auto eth0:0 -iface eth0:0 inet static +auto Private_Interface:0 +iface Private_Interface:0 inet static name LVS Private Shared Address address Priv_NET.1 netmask 255.255.255.0 diff --git a/templates/setup-drone.sh b/templates/setup-drone.sh index 26e0c53..86708dd 100755 --- a/templates/setup-drone.sh +++ b/templates/setup-drone.sh @@ -1,5 +1,7 @@ #!/bin/bash +exec > >(tee -i genasys_install.log) + #TODO: export GenaSYS version to install logs. export WD=$(dirname $(readlink -f $0)) diff --git a/templates/setup-functions b/templates/setup-functions index 0b5d060..ff66067 100755 --- a/templates/setup-functions +++ b/templates/setup-functions @@ -11,7 +11,7 @@ GetNics () { ### get the primary and secondary interface of this host. INTERFACES="$(networkctl | grep -wv 'links' | grep -wv IDX | awk '{ print $2 }')" PRIMARY_INTERFACE="$(ip route | grep default | awk '{ print $5 }')" FIRST_PHYSICAL_INTERFACE="$(networkctl | grep -wv 'links' | grep -w '2' | awk '{ print $2 }')" -SECOND_PHYSICAL_INTERFACE="$(networkctl | grep -wv 'links' | grep -w '3' | awk '{ print $3 }')" +SECOND_PHYSICAL_INTERFACE="$(networkctl | grep -wv 'links' | grep -w '3' | awk '{ print $2 }')" echo;echo echo "Interfaces found: "${INTERFACES} echo "Primary interface is: ${PRIMARY_INTERFACE}" @@ -159,6 +159,7 @@ if [ ! -z "$PRIMARY_INTERFACE" ]; then #TODO update variable - done else echo "ERROR: Unable to set primary interface. You must edit /etc/network/interfaces manually." fi +#TODO expand this function to handle all interfaces anywhere. aw-4/4/2019 } ### Setup monitoring. diff --git a/templates/setup-head.sh b/templates/setup-head.sh index e1b8683..98ef157 100755 --- a/templates/setup-head.sh +++ b/templates/setup-head.sh @@ -1,5 +1,7 @@ #!/bin/bash +exec > >(tee -i genasys_install.log) + export WD=$(dirname $(readlink -f $0)) TARCHIVE="head_file.tar.gz" . "$WD/setup-vars" diff --git a/templates/setup.sh b/templates/setup.sh index efcd7e1..26d9ba6 100755 --- a/templates/setup.sh +++ b/templates/setup.sh @@ -2,6 +2,8 @@ ###TODO: export GenaSYS version to install logs. +exec > >(tee -i genasys_install.log) + export WD=$(dirname $(readlink -f $0)) TARCHIVE="tar_file.tar.gz" . "$WD/setup-vars" @@ -699,6 +701,10 @@ then a2ensite default-ssl.conf fi GetNics + sed -i "s/Primary_Interface/${PRIMARY_INTERFACE}/g" /etc/network/interfaces + sed -i "s/Private_Interface/${SECOND_PHYSICAL_INTERFACE}/g" /etc/network/interfaces + sed -i "s/Primary_Interface/${PRIMARY_INTERFACE}/g" /etc/ha.d/haresources + sed -i "s/Private_Interface/${SECOND_PHYSICAL_INTERFACE}/g" /etc/ha.d/haresources # configure firewall for lvs servers sed -i "s/XTRNL_IF/$PRIMARY_INTERFACE/g" "/etc/network/iptables-rules.fw" #TODO update variable and switch from hard coded interface name - done # find secondary interface -- 2.11.0