Setup Script - Add master logic

This commit is contained in:
Mike Reeves
2018-03-19 15:13:35 -04:00
parent 6d0a6006f7
commit be3226372c

View File

@@ -65,6 +65,7 @@ configure_sensor () {
echo "sensors:" > /tmp/$HOSTNAME.sls
echo " interface: bond0" >> /tmp/$HOSTNAME.sls
echo " lbprocs: $LBPROCS" >> /tmp/$HOSTNAME.sls
# Need to add pins loop
}
copy_ssh_key () {
@@ -172,6 +173,34 @@ saltify_centos () {
saltify () {
# Install updates and Salt
if [ $OS == 'centos' ]; then
ADDUSER=adduser
yum -y install https://repo.saltstack.com/yum/redhat/salt-repo-latest-2.el7.noarch.rpm
yum clean expire-cache
yum -y install salt-minion yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
else
ADDUSER=useradd
apt-get -y upgrade
# Add the pre-requisites for installing docker-ce
apt-get -y install ca-certificates curl software-properties-common apt-transport-https
# grab the version from the os-release file
UVER=$(grep VERSION_ID /etc/os-release | awk -F '[ "]' '{print $2}')
# Install the repo for salt
wget -O - https://repo.saltstack.com/apt/ubuntu/$UVER/amd64/latest/SALTSTACK-GPG-KEY.pub | apt-key add -
echo "deb http://repo.saltstack.com/apt/ubuntu/$UVER/amd64/latest xenial main" > /etc/apt/sources.list.d/saltstack.list
# Lets get the docker repo added
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# Initialize the new repos
apt-get update
apt-get -y install salt-minion
fi
}
salt_directories () {
@@ -327,41 +356,10 @@ if (whiptail --title "Security Onion Setup" --yesno "Are you sure you want to in
fi
# Install Updates and the Salt Package
if [ $OS == 'centos' ]; then
ADDUSER=adduser
yum -y install https://repo.saltstack.com/yum/redhat/salt-repo-latest-2.el7.noarch.rpm
yum clean expire-cache
yum -y install salt-minion yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
saltify
if [ $INSTALLTYPE != 'SENSORONLY' ] || [ $INSTALLTYPE != 'STORAGENODE' ]; then
if [ $INSTALLTYPE != 'SENSORONLY' ] || [ $INSTALLTYPE != 'STORAGENODE' ]; then
install_master
fi
else
ADDUSER=useradd
apt-get -y upgrade
# Add the pre-requisites for installing docker-ce
apt-get -y install ca-certificates curl software-properties-common apt-transport-https
# grab the version from the os-release file
UVER=$(grep VERSION_ID /etc/os-release | awk -F '[ "]' '{print $2}')
# Install the repo for salt
wget -O - https://repo.saltstack.com/apt/ubuntu/$UVER/amd64/latest/SALTSTACK-GPG-KEY.pub | apt-key add -
echo "deb http://repo.saltstack.com/apt/ubuntu/$UVER/amd64/latest xenial main" > /etc/apt/sources.list.d/saltstack.list
# Lets get the docker repo added
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
# Initialize the new repos
apt-get update
apt-get -y install salt-minion
if [ $INSTALLTYPE != 'SENSORONLY' ] || [ $INSTALLTYPE != 'STORAGENODE' ]; then
apt-get -y install salt-master
fi
fi
# Create so-core user
@@ -397,7 +395,7 @@ if (whiptail --title "Security Onion Setup" --yesno "Are you sure you want to in
fi
# Do that same thing on all the others but drop em into the right place
if [ $INSTALLTYPE != 'SENSORONLY' ]; then
if [ $INSTALLTYPE != 'SENSORONLY' ] || [ $INSTALLTYPE != 'STORAGENODE' ]; then
# Create the grains file for the Master
touch /etc/salt/grains