make the installation code compatible on centos6 and centos7
Change-Id: I463d2d463d30d50eb915592cbeaec553b23f0bec
This commit is contained in:
@@ -20,21 +20,21 @@ import itertools
|
||||
import json
|
||||
import netaddr
|
||||
import os
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import re
|
||||
import requests
|
||||
from restful import Client
|
||||
import socket
|
||||
import sys
|
||||
import time
|
||||
import yaml
|
||||
|
||||
from compass.apiclient.restful import Client
|
||||
|
||||
|
||||
ROLE_UNASSIGNED = True
|
||||
ROLE_ASSIGNED = False
|
||||
|
||||
import log as logging
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
from oslo_config import cfg
|
||||
CONF = cfg.CONF
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ def byteify(input):
|
||||
else:
|
||||
return input
|
||||
|
||||
|
||||
opts = [
|
||||
cfg.StrOpt(
|
||||
'compass_server',
|
||||
|
||||
@@ -1,22 +1,56 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
if [ -z "$USE_SYSTEMCTL" ]; then
|
||||
which systemctl
|
||||
if [[ "$?" == "0" ]]; then
|
||||
export USE_SYSTEMCTL=1
|
||||
else
|
||||
export USE_SYSTEMCTL=0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
service mysqld restart
|
||||
service mysqld status || exit $?
|
||||
else
|
||||
systemctl restart mysql.service
|
||||
systemctl status mysql.service || exit $?
|
||||
fi
|
||||
|
||||
/opt/compass/bin/manage_db.py createdb
|
||||
/opt/compass/bin/clean_installers.py --noasync
|
||||
/opt/compass/bin/clean_installation_logs.py
|
||||
rm -rf /var/ansible/run/*
|
||||
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
service httpd restart
|
||||
service httpd status || exit $?
|
||||
service rsyslog restart
|
||||
service rsyslog status || exit $?
|
||||
service redis restart
|
||||
service redis status || exit $?
|
||||
else
|
||||
systemctl restart httpd.service
|
||||
systemctl status httpd.service || exit $?
|
||||
systemctl restart rsyslog.service
|
||||
systemctl status rsyslog.service || exit $?
|
||||
systemctl restart redis.service
|
||||
systemctl status redis.service || exit $?
|
||||
fi
|
||||
|
||||
redis-cli flushall
|
||||
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
service cobblerd restart
|
||||
service cobblerd status || exit $?
|
||||
service compass-celeryd restart
|
||||
service compass-celeryd status || exit $?
|
||||
service compass-progress-updated restart
|
||||
service compass-progress-updated status || exit $?
|
||||
else
|
||||
systemctl restart cobblerd.service
|
||||
systemctl status cobblerd.service || exit $?
|
||||
systemctl restart compass-celeryd.service
|
||||
systemctl status compass-celeryd.service || exit $?
|
||||
systemctl restart compass-progress-updated.service
|
||||
systemctl status compass-progress-updated.service || exit $?
|
||||
|
||||
fi
|
||||
|
||||
@@ -28,10 +28,8 @@ CONFIG_DIR = os.environ.get('COMPASS_CONFIG_DIR', '/etc/compass')
|
||||
SQLALCHEMY_DATABASE_URI = 'sqlite://'
|
||||
SQLALCHEMY_DATABASE_POOL_TYPE = 'static'
|
||||
COBBLER_INSTALLATION_LOGDIR = '/var/log/cobbler/anamon'
|
||||
CHEF_INSTALLATION_LOGDIR = '/var/log/chef'
|
||||
INSTALLATION_LOGDIR = {
|
||||
'CobblerInstaller': COBBLER_INSTALLATION_LOGDIR,
|
||||
'ChefInstaller': CHEF_INSTALLATION_LOGDIR
|
||||
}
|
||||
CLUSTERHOST_INATALLATION_LOGDIR_NAME = 'name'
|
||||
HOST_INSTALLATION_LOGDIR_NAME = 'name'
|
||||
|
||||
@@ -548,11 +548,6 @@ PACKAGE_INSTALLER_CONFIGURATIONS = {
|
||||
}
|
||||
}
|
||||
|
||||
ADAPTER_LOG_CONFIGURATIONS = [{
|
||||
'package_installer_name': 'chef_installer',
|
||||
'adapter_pattern': '.*',
|
||||
'item_matcher': PACKAGE_INSTALLER_CONFIGURATIONS['chef_installer']['default'],
|
||||
'logdir': setting.INSTALLATION_LOGDIR['ChefInstaller']
|
||||
}]
|
||||
ADAPTER_LOG_CONFIGURATIONS = []
|
||||
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ DATABASE_NAME = 'compass'
|
||||
SQLALCHEMY_DATABASE_URI = '%s://%s:%s@%s/%s' % (DATABASE_TYPE, DATABASE_USER, DATABASE_PASSWORD, DATABASE_SERVER, DATABASE_NAME)
|
||||
SQLALCHEMY_DATABASE_POOL_TYPE = 'instant'
|
||||
COBBLER_INSTALLATION_LOGDIR = '/var/log/cobbler/anamon'
|
||||
CHEF_INSTALLATION_LOGDIR = '/var/log/chef'
|
||||
DEFAULT_LOGLEVEL = 'info'
|
||||
DEFAULT_LOGDIR = '/var/log/compass'
|
||||
DEFAULT_LOGINTERVAL = 6
|
||||
|
||||
@@ -30,7 +30,11 @@ if [[ "$?" != "0" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo chkconfig cobblerd on
|
||||
else
|
||||
sudo systemctl enable cobblerd.service
|
||||
fi
|
||||
|
||||
# create backup dir
|
||||
sudo mkdir -p /root/backup/cobbler
|
||||
@@ -153,7 +157,11 @@ sudo cp $COMPASSDIR/misc/rsync /etc/xinetd.d/
|
||||
|
||||
sudo rm -rf /var/lib/cobbler/config/systems.d/*
|
||||
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service firewalld stop
|
||||
else
|
||||
sudo systemctl stop firewalld
|
||||
fi
|
||||
|
||||
# echo "disable selinux temporarily"
|
||||
# echo 0 > /selinux/enforce
|
||||
@@ -164,44 +172,77 @@ sudo mkdir -p /var/log/cobbler/tasks
|
||||
sudo mkdir -p /var/log/cobbler/anamon
|
||||
sudo chmod -R 777 /var/log/cobbler
|
||||
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service httpd restart
|
||||
sudo service cobblerd restart
|
||||
sudo service named restart
|
||||
sudo service xinetd restart
|
||||
sudo service dhcpd restart
|
||||
else
|
||||
sudo systemctl restart httpd.service
|
||||
sudo systemctl restart cobblerd.service
|
||||
sudo systemctl restart named.service
|
||||
sudo systemctl restart xinetd.service
|
||||
sudo systemctl restart dhcpd.service
|
||||
fi
|
||||
|
||||
sudo sleep 10
|
||||
|
||||
echo "Checking if httpd is running"
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service httpd status
|
||||
else
|
||||
sudo systemctl status httpd.service
|
||||
fi
|
||||
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "httpd is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking if dhcpd is running"
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service dhcpd status
|
||||
else
|
||||
sudo systemctl status dhcpd.service
|
||||
fi
|
||||
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "dhcpd is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking if named is running"
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service named status
|
||||
else
|
||||
sudo systemctl status named.service
|
||||
fi
|
||||
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "named is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking if xinetd is running"
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service xinetd status
|
||||
else
|
||||
sudo systemctl status xinetd.service
|
||||
fi
|
||||
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "xinetd is not running"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking if cobblerd is running"
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service cobblerd status
|
||||
else
|
||||
sudo systemctl status cobblerd.service
|
||||
fi
|
||||
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "cobblerd is not running"
|
||||
exit 1
|
||||
|
||||
@@ -104,12 +104,24 @@ sudo chown -R redis:root /var/run/redis
|
||||
sudo mkdir -p /var/lib/redis
|
||||
sudo chown -R redis:root /var/lib/redis
|
||||
sudo rm -rf /var/lib/redis/dump.rdb
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo kill -9 redis-server
|
||||
else
|
||||
sudo systemctl kill redis-server
|
||||
fi
|
||||
sudo rm -rf /var/run/redis/redis.pid
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service redis restart
|
||||
else
|
||||
sudo systemctl restart redis.service
|
||||
fi
|
||||
sleep 10
|
||||
echo "Checking if redis is running"
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service redis status
|
||||
else
|
||||
sudo systemctl status redis.service
|
||||
fi
|
||||
if [[ "$?" == "0" ]]; then
|
||||
echo "redis is running"
|
||||
else
|
||||
@@ -118,8 +130,13 @@ else
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo chkconfig compass-progress-updated on
|
||||
sudo chkconfig compass-celeryd on
|
||||
else
|
||||
sudo systemctl enable compass-progress-updated.service
|
||||
sudo systemctl enable compass-celeryd.service
|
||||
fi
|
||||
|
||||
/opt/compass/bin/refresh.sh
|
||||
if [[ "$?" != "0" ]]; then
|
||||
@@ -129,7 +146,12 @@ else
|
||||
echo "compassed service is refreshed"
|
||||
fi
|
||||
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service httpd status
|
||||
else
|
||||
sudo systemctl status httpd.service
|
||||
fi
|
||||
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "httpd is not started"
|
||||
exit 1
|
||||
@@ -137,7 +159,12 @@ else
|
||||
echo "httpd has already started"
|
||||
fi
|
||||
|
||||
sudo systemctl status redis.service |grep running
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service redis status | grep running
|
||||
else
|
||||
sudo systemctl status redis.service | grep running
|
||||
fi
|
||||
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "redis is not started"
|
||||
exit 1
|
||||
@@ -145,13 +172,23 @@ else
|
||||
echo "redis has already started"
|
||||
fi
|
||||
|
||||
sudo systemctl status mysql.service |grep running
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service mysqld status | grep running
|
||||
else
|
||||
sudo systemctl status mysql.service | grep running
|
||||
fi
|
||||
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "mysqld is not started"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo systemctl status compass-celeryd.service |grep running
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service compass-celeryd status | grep running
|
||||
else
|
||||
sudo systemctl status compass-celeryd.service | grep running
|
||||
fi
|
||||
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "compass-celeryd is not started"
|
||||
exit 1
|
||||
@@ -159,7 +196,12 @@ else
|
||||
echo "compass-celeryd has already started"
|
||||
fi
|
||||
|
||||
sudo systemctl status compass-progress-updated.service |grep running
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service compass-progress-updated status | grep running
|
||||
else
|
||||
sudo systemctl status compass-progress-updated.service | grep running
|
||||
fi
|
||||
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "compass-progress-updated is not started"
|
||||
exit 1
|
||||
|
||||
@@ -22,11 +22,19 @@ rm -rf /var/www/compass_web/*
|
||||
sudo mkdir -p /var/www/compass_web/v2.5
|
||||
sudo cp -rf $WEB_HOME/v2.5/target/* /var/www/compass_web/v2.5/
|
||||
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service httpd restart
|
||||
else
|
||||
sudo systemctl restart httpd.service
|
||||
fi
|
||||
sleep 10
|
||||
|
||||
echo "Checking if httpd is running"
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service httpd status
|
||||
else
|
||||
sudo systemctl status httpd.service
|
||||
fi
|
||||
if [[ "$?" == "0" ]]; then
|
||||
echo "httpd is running"
|
||||
else
|
||||
|
||||
@@ -1,17 +1,37 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [ -z "$MYSQL" ]; then
|
||||
sudo rpm -Uvh $MYSQL >& /dev/null
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to install mysql repo"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo 'Installing Required packages for Compass...'
|
||||
sudo yum clean all
|
||||
sudo yum update -y --skip-broken
|
||||
if [ "$tempest" == "true" ]; then
|
||||
sudo yum install -y virt-install libvirt qemu-kvm libxml2-devel libffi-devel libxslt-devel python-devel sshpass openssl-devel
|
||||
sudo yum install -y virt-install libvirt qemu-kvm libxml2-devel libffi-devel libxslt-devel python-devel sshpass openssl-devel bridge-utils
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to install tempest yum dependency"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo yum install -y $MYSQL rsyslog logrotate ntp iproute openssh-clients python python-devel git wget syslinux amqp rabbitmq-server mod_wsgi httpd squid dhcp bind rsync yum-utils xinetd tftp-server gcc net-snmp-utils net-snmp net-snmp-python unzip openssl openssl098e ca-certificates mysql-devel mysql-server mysql MySQL-python python-virtualenv python-setuptools python-pip bc libselinux-python
|
||||
sudo yum install -y rsyslog logrotate ntp iproute openssh-clients python python-devel git wget syslinux amqp rabbitmq-server mod_wsgi httpd squid dhcp bind rsync yum-utils xinetd tftp-server gcc net-snmp-utils net-snmp net-snmp-python unzip openssl openssl098e ca-certificates MySQL-python python-virtualenv python-setuptools python-pip bc libselinux-python
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "faile dot install yum dependency"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo yum list mysql
|
||||
if [[ "$?" == "0" ]]; then
|
||||
sudo yum install -y mysql-devel mysql-server mysql
|
||||
else
|
||||
sudo yum install -y mariadb mariadb-devel mariadb-libs
|
||||
fi
|
||||
|
||||
sudo yum --setopt=tsflags=noscripts -y remove redis
|
||||
sudo yum --enablerepo=remi,remi-test install -y redis
|
||||
|
||||
@@ -40,12 +60,25 @@ if [[ "$?" != "0" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sudo pip install virtualenvwrapper
|
||||
sudo pip install --upgrade virtualenvwrapper
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to install virtualenvwrapper"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo chkconfig httpd on
|
||||
sudo chkconfig squid on
|
||||
sudo chkconfig xinetd on
|
||||
sudo chkconfig dhcpd on
|
||||
sudo chkconfig named on
|
||||
sudo chkconfig sshd on
|
||||
sudo chkconfig rsyslog on
|
||||
sudo chkconfig ntpd on
|
||||
sudo chkconfig redis on
|
||||
sudo chkconfig mysqld on
|
||||
sudo chkconfig rabbitmq-server on
|
||||
else
|
||||
sudo systemctl enable httpd.service
|
||||
sudo systemctl enable squid.service
|
||||
sudo systemctl enable xinetd.service
|
||||
@@ -57,3 +90,4 @@ sudo systemctl enable ntpd.service
|
||||
sudo systemctl enable redis.service
|
||||
sudo systemctl enable mysql.service
|
||||
sudo systemctl enable rabbitmq-server.service
|
||||
fi
|
||||
|
||||
@@ -7,20 +7,34 @@ export OS_INSTALLER=${OS_INSTALLER:-cobbler}
|
||||
# PACKAGE_INSTALLER indicates the tool for Package provisioning, default is 'chef'.
|
||||
export PACKAGE_INSTALLER=${PACKAGE_INSTALLER:-package}
|
||||
|
||||
# set remi release url
|
||||
# export ATOMIC=${ATOMIC:-http://www6.atomicorp.com/channels/atomic/${IMAGE_TYPE,,}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/RPMS/atomic-release-1.0-19.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.art.noarch.rpm}
|
||||
# export REMI=${REMI:-http://rpms.famillecollet.com/enterprise/remi-release-6.rpm}
|
||||
export REMI=${REMI:-http://rpms.famillecollet.com/enterprise/remi-release-7.rpm}
|
||||
export IMAGE_RELEASE=$(cat /etc/system-release | sed 's/[ \t]\+/ /g')
|
||||
if [ -z "$IMAGE_TYPE" ]; then
|
||||
export IMAGE_TYPE=$(echo $IMAGE_RELEASE | cut -d' ' -f1)
|
||||
fi
|
||||
export IMAGE_TYPE_OTHER=${IMAGE_TYPE_OTHER:-"el"}
|
||||
if [ -z "$IMAGE_VERSION_MAJOR" ]; then
|
||||
export IMAGE_VERSION_MAJOR=$(echo $IMAGE_RELEASE | sed 's/.* \([0-9]\+\)\.[0-9]\+.*/\1/g')
|
||||
fi
|
||||
if [ -z "$IMAGE_VERSION_NINOR" ]; then
|
||||
export IMAGE_VERSION_NINOR=$(echo $IMAGE_RELEASE | sed 's/.* [0-9]\+\.\([0-9]\+\).*/\1/g')
|
||||
fi
|
||||
export IMAGE_VERSION=${IMAGE_VERSION:-"${IMAGE_VERSION_MAJOR}.${IMAGE_VERSION_MINOR}"}
|
||||
export IMAGE_NAME=${IMAGE_NAME:-"${IMAGE_TYPE}-${IMAGE_VERSION}"}
|
||||
export IMAGE_ARCH=${IMAGE_ARCH:-"x86_64"}
|
||||
|
||||
export EPEL=${EPEL:-https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm}
|
||||
|
||||
export MYSQL={MYSQL:-http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm}
|
||||
export ATOMIC=${ATOMIC:-http://www6.atomicorp.com/channels/atomic/${IMAGE_TYPE,,}/${IMAGE_VERSION_MAJOR}/${IMAGE_ARCH}/RPMS/atomic-release-1.0-20.${IMAGE_TYPE_OTHER}${IMAGE_VERSION_MAJOR}.art.noarch.rpm}
|
||||
export REMI=${REMI:-http://rpms.famillecollet.com/enterprise/remi-release-${IMAGE_VERSION_MAJOR}.rpm}
|
||||
export EPEL=${EPEL:-https://dl.fedoraproject.org/pub/epel/epel-release-latest-${IMAGE_VERSION_MAJOR}.noarch.rpm}
|
||||
export MYSQL={MYSQL:-http://repo.mysql.com/mysql-community-release-el${IMAGE_VERSION_MAJOR}.rpm}
|
||||
|
||||
# service NIC
|
||||
export NIC=${NIC:-}
|
||||
export IPADDR=${IPADDR:-}
|
||||
export NETMASK=${NETMASK:-}
|
||||
|
||||
# squid config
|
||||
export ADDITIONAL_SQUID_CONFIG=${ADDITIONAL_SQUID_CONFIG:-}
|
||||
|
||||
# DHCP config
|
||||
# DHCP option router address(Default is your management interface IP address )"
|
||||
export OPTION_ROUTER=${OPTION_ROUTER:-}
|
||||
@@ -38,19 +52,20 @@ export NAMESERVER_REVERSE_ZONES=${NAMESERVER_REVERSE_ZONES:-}
|
||||
export CBLR_USER=${CBLR_USER:-}
|
||||
export CBLR_PASSWD=${CBLR_PASSWD:-}
|
||||
|
||||
# set command to restart services
|
||||
if [ -z "$USE_SYSTEMCTL" ]; then
|
||||
which systemctl
|
||||
if [[ "$?" == "0" ]]; then
|
||||
export USE_SYSTEMCTL=1
|
||||
else
|
||||
export USE_SYSTEMCTL=0
|
||||
fi
|
||||
fi
|
||||
# set default local repo flag
|
||||
export LOCAL_REPO=${LOCAL_REPO:-}
|
||||
export SUPPORT_CENTOS_7_2=${SUPPORT_CENTOS_7_2:-}
|
||||
export SUPPORT_UBUNTU_14_04_03=${SUPPORT_UBUNTU_14_04_03:-}
|
||||
|
||||
export IMAGE_TYPE=${IMAGE_TYPE:-"CentOS"}
|
||||
export IMAGE_TYPE_OTHER=${IMAGE_TYPE_OTHER:-"el"}
|
||||
export IMAGE_VERSION_MAJOR=${IMAGE_VERSION_MAJOR:-"6"}
|
||||
export IMAGE_VERSION_NINOR=${IMAGE_VERSION_MINOR:-"5"}
|
||||
export IMAGE_VERSION=${IMAGE_VERSION:-"${IMAGE_VERSION_MAJOR}.${IMAGE_VERSION_MINOR}"}
|
||||
export IMAGE_NAME=${IMAGE_NAME:-"${IMAGE_TYPE}-${IMAGE_VERSION}"}
|
||||
export IMAGE_ARCH=${IMAGE_ARCH:-"x86_64"}
|
||||
|
||||
export CENTOS_7_2_IMAGE_SOURCE=${CENTOS_7_2_IMAGE_SOURCE:-"http://205.177.226.237:9999/CentOS-7-x86_64-Minimal-1511.iso"}
|
||||
export UBUNTU_14_04_03_IMAGE_SOURCE=${UBUNTU_14_04_03_IMAGE_SOURCE:-"http://205.177.226.237:9999/ubuntu-14.04.3-server-amd64.iso"}
|
||||
export CENTOS_7_2_PPA_REPO_SOURCE=${CENTOS_7_2_PPA_REPO_SOURCE:-"http://205.177.226.237:9999/centos7-juno-ppa.tar.gz"}
|
||||
|
||||
@@ -24,9 +24,15 @@ export SUPPORT_CENTOS_7_2=${SUPPORT_CENTOS_7_2:-"y"}
|
||||
export SUPPORT_UBUNTU_14_04_03=${SUPPORT_UBUNTU_14_04_03:-"y"}
|
||||
|
||||
# DHCP config
|
||||
export IPADDR=`ifconfig $NIC | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
|
||||
# export IPADDR=`ip addr show $NIC | grep "inet " | sed 's/^[ \t]*//g' | cut -d' ' -f 2 | cut -d'/' -f 1`
|
||||
export NETMASK=$(ifconfig $NIC |grep Mask | cut -f 4 -d ':')
|
||||
export IPADDR=$(ifconfig $NIC | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
|
||||
if [ -z "$IPADDR" ]; then
|
||||
export IPADDR=$(ifconfig $NIC | grep 'inet ' | sed 's/^[ \t]*//g' | sed 's/[ \t]\+/ /g' | cut -d' ' -f2)
|
||||
fi
|
||||
# export IPADDR=`ip addr show $NIC | grep "inet " | sed 's/^[ \t]*//g' | sed 's/[ \t]\+/ /g' | cut -d' ' -f 2 | cut -d'/' -f 1`
|
||||
export NETMASK=$(ifconfig $NIC | grep Mask | cut -f 4 -d ':')
|
||||
if [ -z "$NETMASK" ]; then
|
||||
export NETMASK=$(ifconfig $NIC | grep netmask | sed 's/^[ \t]*//g' | sed 's/[ \t]\+/ /g' | cut -d' ' -f4)
|
||||
fi
|
||||
# export NETMASK=$(ipcalc `ip addr show $NIC | grep "inet " | sed 's/^[ \t]*//g' | cut -d' ' -f 2` -m | grep NETMASK | cut -d '=' -f 2)
|
||||
# DHCP option router address(Default is your management interface IP address )"
|
||||
# export OPTION_ROUTER=`ifconfig $NIC | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`
|
||||
|
||||
@@ -178,7 +178,9 @@ if [ $? -ne 0 ]; then
|
||||
fi
|
||||
|
||||
export ipaddr=$(ifconfig $NIC | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}')
|
||||
# export ipaddr=$(ifconfig $NIC | grep 'inet ' | cut -d' ' -f10)
|
||||
if [ -z "$ipaddr" ]; then
|
||||
export ipaddr=$(ifconfig $NIC | grep 'inet ' | sed 's/^[ \t]*//g' | sed 's/[ \t]\+/ /g' | cut -d' ' -f2)
|
||||
fi
|
||||
loadvars IPADDR ${ipaddr}
|
||||
ipcalc $IPADDR -c
|
||||
if [ $? -ne 0 ]; then
|
||||
@@ -186,6 +188,9 @@ if [ $? -ne 0 ]; then
|
||||
exit 1
|
||||
fi
|
||||
export netmask=$(ifconfig $NIC | grep Mask | cut -d: -f4)
|
||||
if [ -z "$netmask" ]; then
|
||||
export netmask=$(ifconfig $NIC | grep netmask | sed 's/^[ \t]*//g' | sed 's/[ \t]\+/ /g' | cut -d' ' -f4)
|
||||
fi
|
||||
loadvars NETMASK ${netmask}
|
||||
export netaddr=$(ipcalc $IPADDR $NETMASK -n |cut -f 2 -d '=')
|
||||
export netprefix=$(ipcalc $IPADDR $NETMASK -p |cut -f 2 -d '=')
|
||||
|
||||
@@ -53,11 +53,23 @@ sudo cp -rn /etc/ntp.conf /root/backup/
|
||||
sudo rm -f /etc/ntp.conf
|
||||
sudo cp -rf $COMPASSDIR/misc/ntp/ntp.conf /etc/ntp.conf
|
||||
sudo chmod 644 /etc/ntp.conf
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service ntpd stop
|
||||
else
|
||||
sudo systemctl stop ntpd.service
|
||||
fi
|
||||
sudo ntpdate 0.centos.pool.ntp.org
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service ntpd start
|
||||
else
|
||||
sudo systemctl start ntpd.service
|
||||
fi
|
||||
sudo sleep 10
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service ntpd status
|
||||
else
|
||||
sudo systemctl status ntpd.service
|
||||
fi
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "ntp is not started"
|
||||
exit 1
|
||||
@@ -65,37 +77,51 @@ else
|
||||
echo "ntp conf is updated"
|
||||
fi
|
||||
|
||||
# commenting out squid as we are not using it now
|
||||
#echo "update squid config"
|
||||
#sudo cp -rn /etc/squid/squid.conf /root/backup/
|
||||
#sudo rm -f /etc/squid/squid.conf
|
||||
#sudo cp $COMPASSDIR/misc/squid/squid.conf /etc/squid/
|
||||
#export netaddr=$(ipcalc $IPADDR $NETMASK -n |cut -f 2 -d '=')
|
||||
#export netprefix=$(ipcalc $IPADDR $NETMASK -p |cut -f 2 -d '=')
|
||||
#subnet=${netaddr}/${netprefix}
|
||||
#subnet_escaped=$(echo $subnet | sed -e 's/[\/&]/\\&/g')
|
||||
#sudo sed -i "s/acl localnet src \$subnet/acl localnet src $subnet_escaped/g" /etc/squid/squid.conf
|
||||
#sudo chmod 644 /etc/squid/squid.conf
|
||||
#sudo mkdir -p /var/squid/cache
|
||||
#sudo chown -R squid:squid /var/squid
|
||||
#sudo mkdir -p /var/log/squid
|
||||
#sudo chmod -R 777 /var/log/squid
|
||||
#sudo systemctl restart squid.service
|
||||
#sudo sleep 10
|
||||
#sudo ser
|
||||
#if [[ "$?" != "0" ]]; then
|
||||
# echo "squid is not started"
|
||||
# exit 1
|
||||
#else
|
||||
# echo "squid conf is updated"
|
||||
# echo "update squid config"
|
||||
# sudo cp -rn /etc/squid/squid.conf /root/backup/
|
||||
# sudo rm -f /etc/squid/squid.conf
|
||||
# sudo cp $COMPASSDIR/misc/squid/squid.conf /etc/squid/
|
||||
# export netaddr=$(ipcalc $IPADDR $NETMASK -n |cut -f 2 -d '=')
|
||||
# export netprefix=$(ipcalc $IPADDR $NETMASK -p |cut -f 2 -d '=')
|
||||
# subnet=${netaddr}/${netprefix}
|
||||
# subnet_escaped=$(echo $subnet | sed -e 's/[\/&]/\\&/g')
|
||||
# sudo sed -i "s/acl localnet src \$subnet/acl localnet src $subnet_escaped/g" /etc/squid/squid.conf
|
||||
# sudo sed -i "s/\$additional_squid_config/$ADDITIONAL_SQUID_CONFIG/g" /etc/squid/squid.conf
|
||||
# sudo chmod 644 /etc/squid/squid.conf
|
||||
# sudo mkdir -p /var/squid/cache
|
||||
# sudo chown -R squid:squid /var/squid
|
||||
# sudo mkdir -p /var/log/squid
|
||||
# sudo chmod -R 777 /var/log/squid
|
||||
# if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
# sudo service squid restart
|
||||
# sudo sleep 10
|
||||
# sudo service squid status
|
||||
# else
|
||||
# sudo systemctl restart squid.service
|
||||
# sudo sleep 10
|
||||
# sudo systemctl status squid.service
|
||||
# fi
|
||||
# if [[ "$?" != "0" ]]; then
|
||||
# echo "squid is not started"
|
||||
# exit 1
|
||||
# else
|
||||
# echo "squid conf is updated"
|
||||
# fi
|
||||
|
||||
mkdir -p /var/log/httpd
|
||||
chmod -R 777 /var/log/httpd
|
||||
sudo mkdir -p /var/log/httpd
|
||||
sudo chmod -R 777 /var/log/httpd
|
||||
|
||||
systemctl restart httpd.service
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service httpd restart
|
||||
else
|
||||
sudo systemctl restart httpd.service
|
||||
fi
|
||||
sudo sleep 10
|
||||
systemctl status httpd.service
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service httpd status
|
||||
else
|
||||
sudo systemctl status httpd.service
|
||||
fi
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "httpd is not started"
|
||||
exit 1
|
||||
@@ -105,12 +131,20 @@ fi
|
||||
|
||||
#update mysqld
|
||||
echo "update mysqld"
|
||||
mkdir -p /var/log/mysql
|
||||
chmod -R 777 /var/log/mysql
|
||||
sudo mkdir -p /var/log/mysql
|
||||
sudo chmod -R 777 /var/log/mysql
|
||||
sleep 10
|
||||
systemctl restart mysql.service
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service mysqld restart
|
||||
else
|
||||
sudo systemctl restart mysql.service
|
||||
fi
|
||||
sudo sleep 10
|
||||
systemctl status mysql.service
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service mysqld status
|
||||
else
|
||||
sudo systemctl status mysql.service
|
||||
fi
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "failed to restart mysqld"
|
||||
exit 1
|
||||
@@ -144,15 +178,25 @@ if [[ "$?" != "0" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service mysqld restart
|
||||
sudo service mysqld status
|
||||
else
|
||||
sudo systemctl restart mysql.service
|
||||
sudo systemctl status mysql.service
|
||||
fi
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "mysqld is not started"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ "$USE_SYSTEMCTL" == "0" ]]; then
|
||||
sudo service rabbitmq-server restart
|
||||
sudo service rabbitmq-server status
|
||||
else
|
||||
sudo systemctl restart rabbitmq-server.service
|
||||
sudo systemctl status rabbitmq-server.service
|
||||
fi
|
||||
if [[ "$?" != "0" ]]; then
|
||||
echo "rabbitmq-server is not started"
|
||||
exit 1
|
||||
|
||||
@@ -16,7 +16,3 @@ ifconfig eth1 up
|
||||
killall dnsmasq
|
||||
source compass-core/install/install.conf.template
|
||||
/bin/bash -x compass-core/install/install.sh || exit $?
|
||||
echo "cache_peer 10.145.81.137 parent 3128 3130 default" >> /etc/squid/squid.conf
|
||||
service squid restart
|
||||
service squid status |grep running || exit $?
|
||||
sleep 5
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#
|
||||
# Recommended minimum configuration:
|
||||
#
|
||||
acl manager proto cache_object
|
||||
acl localhost src 127.0.0.1/32 ::1
|
||||
acl to_localhost dst 127.0.0.0/8 0.0.0.0/32 ::1
|
||||
|
||||
@@ -69,3 +68,4 @@ negative_dns_ttl 1 second
|
||||
|
||||
pipeline_prefetch on
|
||||
request_timeout 15 minute
|
||||
$additional_squid_config
|
||||
|
||||
@@ -38,6 +38,14 @@ source ${REGTEST_DIR}/${REGTEST_CONF}
|
||||
source `which virtualenvwrapper.sh`
|
||||
workon compass-core
|
||||
|
||||
virt_install_version=$(virt-install --version 2>&1)
|
||||
echo "virt_install_version $virt_install_version"
|
||||
if [[ "$virt_install_version" > "1.0" ]]; then
|
||||
export VIRT_INSTALL_MEMORY_FLAG_NAME=memory
|
||||
else
|
||||
export VIRT_INSTALL_MEMORY_FLAG_NAME=ram
|
||||
fi
|
||||
|
||||
machines=''
|
||||
|
||||
tear_down_machines
|
||||
@@ -68,7 +76,7 @@ for i in `seq $VIRT_NUM`; do
|
||||
--network=bridge:installation \
|
||||
--network=bridge:installation \
|
||||
--network=bridge:installation \
|
||||
--name pxe${i} --ram=${VIRT_MEM} \
|
||||
--name pxe${i} --${VIRT_INSTALL_MEMORY_FLAG_NAME}=${VIRT_MEM} \
|
||||
--disk /home/pxe${i}.raw,format=raw \
|
||||
--vcpus=${VIRT_CPUS} \
|
||||
--graphics vnc,listen=0.0.0.0 \
|
||||
@@ -129,9 +137,6 @@ fi
|
||||
if [[ ! -L compass_logs ]]; then
|
||||
ln -s /var/log/compass compass_logs
|
||||
fi
|
||||
if [[ ! -L chef_logs ]]; then
|
||||
ln -s /var/log/chef chef_logs
|
||||
fi
|
||||
CLIENT_SCRIPT=/opt/compass/bin/client.py
|
||||
if [[ "$CLEAN_OLD_DATA" == "0" || "$CLEAN_OLD_DATA" == "false" ]]; then
|
||||
echo "keep old deployment data"
|
||||
@@ -142,9 +147,6 @@ else
|
||||
echo "failed to refresh"
|
||||
exit 1
|
||||
fi
|
||||
/opt/compass/bin/clean_nodes.sh
|
||||
/opt/compass/bin/clean_clients.sh
|
||||
/opt/compass/bin/clean_environments.sh
|
||||
/opt/compass/bin/remove_systems.sh
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user