library/roles/smartgears/smartgears_egi_image: Configure the dataminer's wps_config.xml too.

library/roles/smartgears/dataminer_app/templates/wps-config-fixer.j2: Use smartgears_hostname so that we can change it later when configuring the EGI images.
This commit is contained in:
Andrea Dell'Amico 2017-02-07 17:04:08 +01:00
parent 408a10c394
commit e175b90a3e
2 changed files with 23 additions and 3 deletions

View File

@ -4,7 +4,7 @@
WPS_CONFIG_FILE='{{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/config/wps_config.xml'
# Fix the hostname
sed -Ei 's/hostname=\".*\"\ hostport/hostname="{{ ansible_fqdn }}" hostport/' $WPS_CONFIG_FILE
sed -Ei 's/hostname=\".*\"\ hostport/hostname="{{ smartgears_hostname }}" hostport/' $WPS_CONFIG_FILE
# Fix the port
{%if setup_nginx %}

View File

@ -23,6 +23,9 @@ CLOUD_INSTANCE_DIR=/var/lib/cloud/instance
MEM=$( free -m | egrep ^Mem | awk '{ print $2 }' )
JAVA_MAX_HEAP=$( expr $MEM - 2048 )
# WPS configuration data
WPS_CONFIG_FIXER=/usr/local/bin/wps-config-fixer
# Init some variables that should be passed
if [ -z "${SMARTGEARS_SCOPES}" ] ; then
SMARTGEARS_SCOPES=
@ -71,15 +74,19 @@ function find_public_ip() {
function modify_hosts_file() {
echo "-- modify_hosts_file" >> $LOG_FILE
# Set the hosts file with the new data
# Set the hosts file with the new data. Set /etc/hostname too
grep -v $HOST $HOSTS_FILE > $HOSTS_FILE.tmp
if [ "${FQDN_HOST}" == "${HOST}" ] ; then
FQDN_HOST=${HOST}.localhost
fi
echo "${PUBLIC_IP} ${FQDN_HOST} ${PUB_FQDN_HOST} ${HOST}" >> $HOSTS_FILE.tmp
SHORT_HOSTNAME=$( echo ${PUB_FQDN_HOST} | cut -d . -f 1 - )
echo "${PUBLIC_IP} ${FQDN_HOST} ${PUB_FQDN_HOST} ${SHORT_HOSTNAME} ${HOST}" >> $HOSTS_FILE.tmp
mv $HOSTS_FILE.tmp $HOSTS_FILE
chmod 644 $HOSTS_FILE
chown root:root $HOSTS_FILE
if [ ! -z ${SHORT_HOSTNAME} ] ; then
echo "${SHORT_HOSTNAME}" > /etc/hostname
fi
}
function smartgears_config_parameters_check() {
@ -115,6 +122,18 @@ function populate_head_containerxml() {
sed -i -e "s#@SMARTGEARS_LOCATION@#${LOCATION}#g" $SM_CONF_F
}
function fix_wps_configuration() {
echo "-- fix_wps_configuration" >> $LOG_FILE
if [ -f $WPS_CONFIG_FIXER ] ; then
echo "This is a dataminer node" >> $LOG_FILE
sed -i -e "s#@SMARTGEARS_HOSTNAME@#${PUB_FQDN_HOST}#g" $WPS_CONFIG_FIXER
# Run the command to fix the dataminer configuration
$WPS_CONFIG_FIXER
else
echo "This is not a dataminer node, doing nothing here" >> $LOG_FILE
fi
}
{% endraw %}
function set_scopes_list() {
@ -203,6 +222,7 @@ modify_hosts_file
smartgears_config_parameters_check
set_scopes_list
populate_head_containerxml
fix_wps_configuration
fix_get_scopes
get_smartgears_scope_tokens
merge_container_xml