Files
training-labs/labs/osbash/scripts/etc_hosts.sh
Pranav Salunke 1f3b5005ed Adds Liberty support
Adding Liberty support to training-labs. This port has a few major
changes primarily due to changes in install guides.

  * Uses newer network configuration.
  * Updates architecture from three nodes to two nodes.
  * Changes OVS to linuxbridge

Co-Authored-By: Bernd <berndbausch@gmail.com>
Co-Authored-By: Roger Luethi <rl@patchworkscience.org>

Change-Id: I5a71383459412ce56cff62ba86db8c58d3d4b84e
2016-01-31 19:47:27 +00:00

29 lines
854 B
Bash
Executable File

#!/usr/bin/env bash
set -o errexit -o nounset
TOP_DIR=$(cd "$(dirname "$0")/.." && pwd)
source "$TOP_DIR/config/paths"
source "$LIB_DIR/functions.guest.sh"
indicate_current_auto
exec_logfile
# The install-guide wants to use the hostname as the name of the interface
# in the mgmt network. We cannot allow 127.0.0.1 to share the name.
HOST_NAME=$(hostname)-lo
HOST_FILE=/etc/hosts
if ! grep -q "^[^#].*$HOST_NAME" $HOST_FILE; then
# No active entry for our hostname
HOST_IP=127.0.1.1
if grep -q "^$HOST_IP" $HOST_FILE; then
# Fix the entry for the IP address we want to use
sudo sed -i "s/^$HOST_IP.*/$HOST_IP $HOST_NAME/" $HOST_FILE
else
echo "$HOST_IP $HOST_NAME" | sudo tee -a $HOST_FILE
fi
fi
# Add entries for the OpenStack training-labs cluster
cat "$CONFIG_DIR/hosts.multi" | sudo tee -a /etc/hosts