2018-02-02 04:14:37 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-02-09 03:04:36 +00:00
|
|
|
ISUCS="$(hostname |grep ucs -c)"
|
|
|
|
|
|
|
|
if [ $ISUCS -ne 0 ]; then
|
|
|
|
echo "Do not run this on ucs host. Exiting..."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-04-21 16:14:47 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#Common to all systems
|
|
|
|
########################################
|
|
|
|
|
|
|
|
|
|
|
|
#Fix timezone
|
|
|
|
|
|
|
|
unlink /etc/localtime
|
|
|
|
ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
|
|
|
|
|
2019-02-25 03:07:14 +00:00
|
|
|
MGMT_INT=$(netstat -rn|grep 0.0.0.0|head -n1|awk '{print $NF}')
|
|
|
|
PFV_MGMT_IP=$(ifconfig $MGMT_INT|grep inet|grep 10.251 -c)
|
|
|
|
OVH_MGMT_IP=$(ifconfig $MGMT_INT|grep inet|grep 10.253 -c)
|
|
|
|
|
|
|
|
if [ $PFV_MGMT_IP -eq 1 ]; then
|
|
|
|
tsysSysLocation=pfv
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $OVH_MGMT_IP -eq 1 ]; then
|
|
|
|
tsysSysLocation=ovh
|
|
|
|
fi
|
|
|
|
|
2019-04-21 17:39:40 +00:00
|
|
|
|
2019-04-21 17:09:51 +00:00
|
|
|
|
|
|
|
#Step 1: Update the cache and apply all vendor patches
|
|
|
|
echo "Running apt-get update"
|
|
|
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes update
|
|
|
|
|
|
|
|
echo "Running apt-get dist-upgrade"
|
|
|
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes dist-upgrade
|
|
|
|
|
|
|
|
echo "Running apt-get upgrade"
|
|
|
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes upgrade
|
|
|
|
|
|
|
|
|
|
|
|
echo "Running apt-get purge"
|
|
|
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --purge autoremove --yes
|
|
|
|
|
|
|
|
|
|
|
|
#Step 2: Cleanup default cruft
|
|
|
|
echo "removing evil from the world, one nano install at a time"
|
2019-04-21 18:11:18 +00:00
|
|
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes --purge remove nano resolvconf
|
2019-04-21 17:09:51 +00:00
|
|
|
|
|
|
|
if [ $UBUNTU_SERVER -eq 0 ]; then
|
|
|
|
sed -i "s/dns=dnsmasq/#dns=dnsmasq/" /etc/NetworkManager/NetworkManager.conf
|
|
|
|
fi
|
|
|
|
|
|
|
|
unlink /etc/resolv.conf
|
|
|
|
ln -s /etc/tplab-resolv.conf /etc/resolv.conf
|
|
|
|
|
2019-04-21 18:37:06 +00:00
|
|
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes -o Dpkg::Options::="--force-confold" install git etckeeper
|
|
|
|
|
|
|
|
git config --global user.email "techops@turnsys.com"
|
|
|
|
git config --global user.name "Techops"
|
|
|
|
|
|
|
|
|
2019-04-21 17:09:51 +00:00
|
|
|
#Step 3: The usual suspects
|
2019-04-21 18:11:18 +00:00
|
|
|
export DEBIAN_FRONTEND="noninteractive" && apt-get -qq --yes -o Dpkg::Options::="--force-confold" install snmpd ncdu iftop nethogs screen acct tshark tcpdump glances dstat htop sysdig sysstat rsync clamav logwatch zsh sl postfix molly-guard git mailutils ladvd etckeeper auditd rkhunter rsyslog ngrep ntp nut-client lm-sensors zlib1g-dev uuid-dev libmnl-dev gcc make autoconf autoconf-archive autogen automake pkg-config curl
|
2019-04-21 17:09:51 +00:00
|
|
|
|
|
|
|
#Turn on process accounting
|
|
|
|
echo "Turning on process accounting..."
|
|
|
|
accton on
|
|
|
|
|
2019-04-21 17:48:38 +00:00
|
|
|
newaliases
|
|
|
|
|
2019-02-25 03:07:14 +00:00
|
|
|
slack tsys-$tsysSysLocation
|