refacotring to some extend now that we switched to dhcpcd and turned off networkd entirely.

This commit is contained in:
root 2018-08-02 21:35:37 +00:00
parent 5280d685c6
commit 248bdb7f80
5 changed files with 15 additions and 25 deletions

View File

@ -6,7 +6,6 @@ files/rc.local etc
files/10-frr.conf etc/sysctl.d
files/11-mgmt1.conf etc/sysctl.d
files/wit-gc usr/bin
files/resolv.conf etc
files/bashrc-witaddon etc
files/qemu-ifdown etc/libvirt/hooks
files/qemu-ifup-public etc/libvirt/hooks

View File

@ -28,24 +28,19 @@ case "$1" in
[ -z $NODE_ID ] && export NODE_ID=$(ip -4 -br addr | grep 10.0. | awk '{ print $3 }' | awk 'BEGIN{FS="[./]"} { print $4 }')
export MGMT_ID=$(ip -4 -br addr | grep 10.0. | awk '{ print $3 }' | awk 'BEGIN{FS="[./]"} { print $3 }')
export DOMAINNAME=${HOSTNAME#*.}
export MGMT_MAC=$(ip -br link show dev $(ip -4 -br addr | grep 10.0. | awk '{ print $1 }') | awk '{ print $3 }')
[ "$MGMT_ID" -ge 0 -a "$MGMT_ID" -lt 16 ] && export DOMAINNAME=.usw1.wit.com
[ "$MGMT_ID" -ge 16 -a "$MGMT_ID" -lt 32 ] && export DOMAINNAME=.usw2.wit.com
[ ${HOSTNAME:0:1} = h ] && export HOSTTYPE=hypervisor
[ ${HOSTNAME:0:1} = d ] && export HOSTTYPE=datanode
[ $HOSTTYPE = hypervisor -a $DOMAINNAME = usw1.wit.com ] && export TIER_ID=2
[ $HOSTTYPE = datanode -a $DOMAINNAME = usw1.wit.com ] && export TIER_ID=4
[ $HOSTTYPE = hypervisor -a $DOMAINNAME = usw2.wit.com ] && export TIER_ID=18
[ $HOSTTYPE = datanode -a $DOMAINNAME = usw2.wit.com ] && export TIER_ID=20
[ $HOSTTYPE = hypervisor -a $DOMAINNAME = .usw1.wit.com ] && export TIER_ID=2
[ $HOSTTYPE = datanode -a $DOMAINNAME = .usw1.wit.com ] && export TIER_ID=4
[ $HOSTTYPE = hypervisor -a $DOMAINNAME = .usw2.wit.com ] && export TIER_ID=18
[ $HOSTTYPE = datanode -a $DOMAINNAME = .usw2.wit.com ] && export TIER_ID=20
[ $HOSTTYPE != hypervisor -a $HOSTTYPE != datanode ] && sed -i -e '/TIER_ID/d' -e "$ s/$/\nTIER_ID=$TIER_ID/" /etc/environment
[ $HOSTTYPE != hypervisor -a $HOSTTYPE != datanode ] && sed -ie "s/^TIER_ID.*/TIER_ID=$TIER_ID/; t; $ s/$/\nTIER_ID=$TIER_ID/" /etc/environment
if [ -z "$TIER_ID" ]; then
echo "Unable to autodetect TIER_ID, looks like we deal with a special node, please set in environment"
@ -82,8 +77,8 @@ case "$1" in
chown frr.frr /etc/frr/frr.conf.wit /etc/frr/daemons.wit
sed -i -e "s/HOSTNAME\.DOMAINNAME/${HOSTNAME}${DOMAINNAME}/" /etc/ipsec.conf.wit
echo ": RSA ${HOSTNAME}${DOMAINNAME}.key" >/etc/ipsec.secrets
sed -i -e "s/HOSTNAME\.DOMAINNAME/${HOSTNAME}/" /etc/ipsec.conf.wit
echo ": RSA ${HOSTNAME}.key" >/etc/ipsec.secrets
chmod 600 /etc/ipsec.secrets
@ -100,8 +95,9 @@ case "$1" in
sed -i "/$MGMT_MAC.*feth./d" /etc/udev/rules.d/70-persistent-net.rules
sed -i -e "/.*debcore1/d" -e "/.*${HOSTNAME}/d" /etc/hosts
echo -e "${LOOPBACKv4}\t${HOSTNAME}${DOMAINNAME}\t${HOSTNAME}" >>/etc/hosts
sed -i -e "/debcore1/d" -e "/${HOSTNAME%%.*}/d" -e "/${LOOPBACKv4}/d" /etc/hosts
echo -e "${LOOPBACKv4}\t${HOSTNAME}\t${HOSTNAME%%.*}" >>/etc/hosts
sed -i -e '/GRUB_CMDLINE_LINUX_DEFAULT=/d' -e '/GRUB_CMDLINE_LINUX=/d' -e '/GRUB_SERIAL_COMMAND=/d' -e '/GRUB_TERMINAL=/d' /etc/default/grub
echo -e 'GRUB_CMDLINE_LINUX_DEFAULT=""\nGRUB_CMDLINE_LINUX="console=tty0 console=ttyS1,115200n8"\nGRUB_TERMINAL=serial\nGRUB_SERIAL_COMMAND="serial --speed=115200 --unit=1 --word=8 --parity=no --stop=1"' >>/etc/default/grub

View File

@ -1,3 +1,3 @@
/etc/systemd/timesyncd.conf.wit sed -e 's/#NTP=.*/NTP=ipv6.ntp.ubuntu.com/g'
/etc/bash.bashrc.wit sed -e '/.*bashrc-witaddon.*/d' -e '$ s/$/\nsource \/etc\/bashrc-witaddon/'
/etc/frr/daemons.wit sed -e 's/bgpd=no/bgpd=yes/' -e 's/zebra=no/zebra=yes/'
/etc/bash.bashrc.wit sed -e 's/.*witaddon/source \/etc\/bashrc-witaddon/; t; $ s/$/\nsource \/etc\/bashrc-witaddon/'

View File

@ -1,8 +1,5 @@
if [ ! -z $new_host_name ]; then
hostname $new_host_name
echo $new_host_name >/etc/hostname
fi
if [ ! -z $new_domain_name ]; then
host_name=$(hostname)
sed -i "s/\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*$host_name.*/\1 $host_name.${new_domain_name:-local} $host_name/" /etc/hosts
hostname $new_host_name.${new_domain_name:-local}
hostname >/etc/hostname
sed -i "s/\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*$old_host_name\.$old_domain_name.*/\1 $new_host_name.${new_domain_name:-local} $new_host_name/" /etc/hosts
fi

View File

@ -1,2 +0,0 @@
nameserver 2001:4860:4860::8888
nameserver 2001:4860:4860::8844