From e2bf06f1e964b05334ac179831c18e6cb95b396d Mon Sep 17 00:00:00 2001 From: Victor Morales Date: Sun, 6 Jan 2019 07:22:08 -0800 Subject: Refactor docker-compose variables The default environment variables required by docker-compose.yml file was exported to .env file to have better control on them. Change-Id: I52408cbf6e6918621a10158866d899d5f66a47eb Signed-off-by: Victor Morales Issue-ID: MULTICLOUD-301 --- vagrant/installer.sh | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'vagrant/installer.sh') diff --git a/vagrant/installer.sh b/vagrant/installer.sh index 271f44f5..cf1eb357 100755 --- a/vagrant/installer.sh +++ b/vagrant/installer.sh @@ -85,6 +85,16 @@ function _install_docker { sleep 10 } +function _set_environment_file { + ansible_ifconfig=$(ansible ovn-central[0] -i $krd_inventory -m shell -a "ifconfig eth1 |grep \"inet addr\" |awk '{print \$2}' |awk -F: '{print \$2}'") + if [[ $ansible_ifconfig != *CHANGED* ]]; then + echo "Fail to get the OVN central IP address from eth1 nic" + exit + fi + echo "export OVN_CENTRAL_ADDRESS=$(echo ${ansible_ifconfig#*>>} | tr '\n' ':')6641" | sudo tee --append /etc/environment + echo "export KUBE_CONFIG_DIR=/opt/kubeconfig" | sudo tee --append /etc/environment +} + # install_k8s() - Install Kubernetes using kubespray tool function install_k8s { echo "Deploying kubernetes" @@ -151,8 +161,8 @@ function install_plugin { sudo mkdir -p /opt/{kubeconfig,consul/config} sudo cp $HOME/.kube/config /opt/kubeconfig/krd - export KUBE_CONFIG_DIR=/opt/kubeconfig - echo "export KUBE_CONFIG_DIR=${KUBE_CONFIG_DIR}" | sudo tee --append /etc/environment + _set_environment_file + source /etc/environment pushd $krd_folder/../deployments sudo ./build.sh @@ -213,8 +223,7 @@ testing_enabled=${KRD_ENABLE_TESTS:-false} sudo mkdir -p $log_folder sudo mkdir -p /opt/csar sudo chown -R $USER /opt/csar -export CSAR_DIR=/opt/csar -echo "export CSAR_DIR=${CSAR_DIR}" | sudo tee --append /etc/environment +echo "export CSAR_DIR=/opt/csar" | sudo tee --append /etc/environment # Install dependencies # Setup proxy variables -- cgit 1.2.3-korg