Merge branch 'master' of gitorious.research-infrastructures.eu:infrastructure-management/ansible-playbooks
This commit is contained in:
commit
4036c62ec1
|
@ -4,10 +4,13 @@ SM_DIR={{ smartgears_install_path }}
|
||||||
SM_LIB_DIR=${SM_DIR}/lib
|
SM_LIB_DIR=${SM_DIR}/lib
|
||||||
# The dataminer wants the gcube keys in a different directory too
|
# The dataminer wants the gcube keys in a different directory too
|
||||||
SM_DATAMINER_PARALLEL_PROC={{ smartgears_user_home }}/tomcat/webapps/wps/ecocfg/PARALLEL_PROCESSING
|
SM_DATAMINER_PARALLEL_PROC={{ smartgears_user_home }}/tomcat/webapps/wps/ecocfg/PARALLEL_PROCESSING
|
||||||
LOG_FILE=/var/log/smartgears-gcubekeys-setup.log
|
LOG_DIR=/var/log/smartgears-gcubekeys-setup
|
||||||
|
LOG_FILE=${LOG_DIR}/gcubekeys-setup.log
|
||||||
|
|
||||||
INFRA_NAME=$1
|
INFRA_NAME=$1
|
||||||
> $LOG_FILE
|
rm -f $LOG_DIR/*
|
||||||
|
rmdir $LOG_DIR
|
||||||
|
mkdir -p $LOG_DIR
|
||||||
|
|
||||||
if [ ! -d $SM_LIB_DIR ] ; then
|
if [ ! -d $SM_LIB_DIR ] ; then
|
||||||
echo "$0: The lib directory: $SM_LIB_DIR does not exist, aborting" >> $LOG_FILE
|
echo "$0: The lib directory: $SM_LIB_DIR does not exist, aborting" >> $LOG_FILE
|
||||||
|
@ -17,13 +20,15 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$INFRA_NAME" == "gcube" ] ; then
|
if [ "$INFRA_NAME" == "gcube" ] ; then
|
||||||
wget {{ gcube_dkey_1 }} --no-check-certificate -o /dev/null -O gcube.gcubekey
|
echo "Downloading the keys for the $INFRA_NAME infra" >> $LOG_FILE
|
||||||
wget {{ gcube_dkey_2 }} --no-check-certificate -o /dev/null -O devsec.gcubekey
|
wget {{ gcube_dkey_1 }} --no-check-certificate -o $LOG_FILE.gcube -O gcube.gcubekey
|
||||||
wget {{ gcube_dkey_3 }} --no-check-certificate -o /dev/null -O devNext.gcubekey
|
wget {{ gcube_dkey_2 }} --no-check-certificate -o $LOG_FILE.devsec -O devsec.gcubekey
|
||||||
|
wget {{ gcube_dkey_3 }} --no-check-certificate -o $LOG_FILE.devNext -O devNext.gcubekey
|
||||||
elif [ "$INFRA_NAME" == "d4science.research-infrastructures.eu" ] ; then
|
elif [ "$INFRA_NAME" == "d4science.research-infrastructures.eu" ] ; then
|
||||||
wget {{ gcube_pkey_1 }} --no-check-certificate -o /dev/null -O d4science.research-infrastructures.eu.gcubekey
|
echo "Downloading the keys for the $INFRA_NAME infra" >> $LOG_FILE
|
||||||
wget {{ gcube_pkey_2 }} --no-check-certificate -o /dev/null -O FARM.gcubekey
|
wget {{ gcube_pkey_1 }} --no-check-certificate -o $LOG_FILE.d4science -O d4science.research-infrastructures.eu.gcubekey
|
||||||
wget {{ gcube_pkey_3 }} --no-check-certificate -o /dev/null -O gCubeApps.gcubekey
|
wget {{ gcube_pkey_2 }} --no-check-certificate -o $LOG_FILE.FARM -O FARM.gcubekey
|
||||||
|
wget {{ gcube_pkey_3 }} --no-check-certificate -o $LOG_FILE.gCubeApps -O gCubeApps.gcubekey
|
||||||
chmod 400 $SM_LIB_DIR/*.gcubekey
|
chmod 400 $SM_LIB_DIR/*.gcubekey
|
||||||
else
|
else
|
||||||
echo "The Infra name is unknown, no keys downloaded" >> $LOG_FILE
|
echo "The Infra name is unknown, no keys downloaded" >> $LOG_FILE
|
||||||
|
|
|
@ -18,6 +18,7 @@ PUB_FQDN_HOST=
|
||||||
PUBLIC_IP=
|
PUBLIC_IP=
|
||||||
MAIN_IP=
|
MAIN_IP=
|
||||||
RETVAL=0
|
RETVAL=0
|
||||||
|
CLOUD_INSTANCE_DIR=/var/lib/cloud/instance
|
||||||
MEM=$( free -m | egrep ^Mem | awk '{ print $2 }' )
|
MEM=$( free -m | egrep ^Mem | awk '{ print $2 }' )
|
||||||
JAVA_MAX_HEAP=$( expr $MEM - 2048 )
|
JAVA_MAX_HEAP=$( expr $MEM - 2048 )
|
||||||
|
|
||||||
|
@ -86,10 +87,6 @@ function smartgears_config_parameters_check() {
|
||||||
echo "The infrastructure name is void" >> $LOG_FILE
|
echo "The infrastructure name is void" >> $LOG_FILE
|
||||||
RETVAL=1
|
RETVAL=1
|
||||||
fi
|
fi
|
||||||
if [ -z "${SCOPE}" ] ; then
|
|
||||||
echo "The scope is void" >> $LOG_FILE
|
|
||||||
RETVAL=1
|
|
||||||
fi
|
|
||||||
if [ -z "${COUNTRY}" ] ; then
|
if [ -z "${COUNTRY}" ] ; then
|
||||||
echo "The country code is void, setting a default" >> $LOG_FILE
|
echo "The country code is void, setting a default" >> $LOG_FILE
|
||||||
export COUNTRY="IT"
|
export COUNTRY="IT"
|
||||||
|
@ -167,10 +164,18 @@ function set_java_heap() {
|
||||||
JAVA_MAX_HEAP=1024
|
JAVA_MAX_HEAP=1024
|
||||||
fi
|
fi
|
||||||
grep -v ^JAVA_HEAP $TOMCAT_DEFAULT > $TOMCAT_DEFAULT.tmp
|
grep -v ^JAVA_HEAP $TOMCAT_DEFAULT > $TOMCAT_DEFAULT.tmp
|
||||||
echo 'JAVA_HEAP="-Xms${JAVA_MAX_HEAP}m -Xmx${JAVA_MAX_HEAP}m"' >> $TOMCAT_DEFAULT.tmp
|
echo "JAVA_HEAP='-Xms${JAVA_MAX_HEAP}m -Xmx${JAVA_MAX_HEAP}m'" > $TOMCAT_DEFAULT.heap
|
||||||
mv $TOMCAT_DEFAULT.tmp $TOMCAT_DEFAULT
|
cat $TOMCAT_DEFAULT.heap $TOMCAT_DEFAULT.tmp > $TOMCAT_DEFAULT
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function cleanup_cloud_user_data() {
|
||||||
|
# Remove the token from the use provided data file
|
||||||
|
echo "-- cleanup_cloud_user_data" >> $LOG_FILE
|
||||||
|
grep -v SMARTGEARS_TOKEN $CLOUD_INSTANCE_DIR/user-data.txt > $CLOUD_INSTANCE_DIR/user-data.txt.tmp
|
||||||
|
mv $CLOUD_INSTANCE_DIR/user-data.txt.tmp $CLOUD_INSTANCE_DIR/user-data.txt
|
||||||
|
grep -v SMARTGEARS_TOKEN $CLOUD_INSTANCE_DIR/user-data.txt.i > $CLOUD_INSTANCE_DIR/user-data.txt.i.tmp
|
||||||
|
mv $CLOUD_INSTANCE_DIR/user-data.txt.i.tmp $CLOUD_INSTANCE_DIR/user-data.txt.i
|
||||||
|
}
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
#
|
#
|
||||||
|
@ -191,6 +196,7 @@ get_smartgears_scope_tokens
|
||||||
merge_container_xml
|
merge_container_xml
|
||||||
get_gcube_keys
|
get_gcube_keys
|
||||||
set_java_heap
|
set_java_heap
|
||||||
|
cleanup_cloud_user_data
|
||||||
|
|
||||||
/usr/sbin/update-rc.d ${SVC} enable >> $LOG_FILE 2>&1
|
/usr/sbin/update-rc.d ${SVC} enable >> $LOG_FILE 2>&1
|
||||||
/etc/init.d/${SVC} start >> $LOG_FILE 2>&1
|
/etc/init.d/${SVC} start >> $LOG_FILE 2>&1
|
||||||
|
|
Loading…
Reference in New Issue