forked from ISTI-ansible-roles/ansible-roles
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:
parent
408a10c394
commit
e175b90a3e
|
@ -4,7 +4,7 @@
|
||||||
WPS_CONFIG_FILE='{{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/config/wps_config.xml'
|
WPS_CONFIG_FILE='{{ smartgears_instance_path }}/webapps/{{ dataminer_52north_webapp_name }}/config/wps_config.xml'
|
||||||
|
|
||||||
# Fix the hostname
|
# 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
|
# Fix the port
|
||||||
{%if setup_nginx %}
|
{%if setup_nginx %}
|
||||||
|
|
|
@ -23,6 +23,9 @@ 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 )
|
||||||
|
|
||||||
|
# WPS configuration data
|
||||||
|
WPS_CONFIG_FIXER=/usr/local/bin/wps-config-fixer
|
||||||
|
|
||||||
# Init some variables that should be passed
|
# Init some variables that should be passed
|
||||||
if [ -z "${SMARTGEARS_SCOPES}" ] ; then
|
if [ -z "${SMARTGEARS_SCOPES}" ] ; then
|
||||||
SMARTGEARS_SCOPES=
|
SMARTGEARS_SCOPES=
|
||||||
|
@ -71,15 +74,19 @@ function find_public_ip() {
|
||||||
|
|
||||||
function modify_hosts_file() {
|
function modify_hosts_file() {
|
||||||
echo "-- modify_hosts_file" >> $LOG_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
|
grep -v $HOST $HOSTS_FILE > $HOSTS_FILE.tmp
|
||||||
if [ "${FQDN_HOST}" == "${HOST}" ] ; then
|
if [ "${FQDN_HOST}" == "${HOST}" ] ; then
|
||||||
FQDN_HOST=${HOST}.localhost
|
FQDN_HOST=${HOST}.localhost
|
||||||
fi
|
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
|
mv $HOSTS_FILE.tmp $HOSTS_FILE
|
||||||
chmod 644 $HOSTS_FILE
|
chmod 644 $HOSTS_FILE
|
||||||
chown root:root $HOSTS_FILE
|
chown root:root $HOSTS_FILE
|
||||||
|
if [ ! -z ${SHORT_HOSTNAME} ] ; then
|
||||||
|
echo "${SHORT_HOSTNAME}" > /etc/hostname
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
function smartgears_config_parameters_check() {
|
function smartgears_config_parameters_check() {
|
||||||
|
@ -115,6 +122,18 @@ function populate_head_containerxml() {
|
||||||
sed -i -e "s#@SMARTGEARS_LOCATION@#${LOCATION}#g" $SM_CONF_F
|
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 %}
|
{% endraw %}
|
||||||
|
|
||||||
function set_scopes_list() {
|
function set_scopes_list() {
|
||||||
|
@ -203,6 +222,7 @@ modify_hosts_file
|
||||||
smartgears_config_parameters_check
|
smartgears_config_parameters_check
|
||||||
set_scopes_list
|
set_scopes_list
|
||||||
populate_head_containerxml
|
populate_head_containerxml
|
||||||
|
fix_wps_configuration
|
||||||
fix_get_scopes
|
fix_get_scopes
|
||||||
get_smartgears_scope_tokens
|
get_smartgears_scope_tokens
|
||||||
merge_container_xml
|
merge_container_xml
|
||||||
|
|
Loading…
Reference in New Issue