Merge "Robust base dir support for bootstrapping"
This commit is contained in:
commit
0f2fcc342a
@ -29,16 +29,18 @@ export DEBIAN_FRONTEND=${DEBIAN_FRONTEND:-"noninteractive"}
|
|||||||
# Set the role fetch mode to any option [galaxy, git-clone]
|
# Set the role fetch mode to any option [galaxy, git-clone]
|
||||||
export ANSIBLE_ROLE_FETCH_MODE=${ANSIBLE_ROLE_FETCH_MODE:-galaxy}
|
export ANSIBLE_ROLE_FETCH_MODE=${ANSIBLE_ROLE_FETCH_MODE:-galaxy}
|
||||||
|
|
||||||
|
# This script should be executed from the root directory of the cloned repo
|
||||||
|
cd "$(dirname "${0}")/.."
|
||||||
|
|
||||||
## Functions -----------------------------------------------------------------
|
## Functions -----------------------------------------------------------------
|
||||||
info_block "Checking for required libraries." 2> /dev/null ||
|
info_block "Checking for required libraries." 2> /dev/null ||
|
||||||
source $(dirname ${0})/scripts-library.sh ||
|
|
||||||
source scripts/scripts-library.sh
|
source scripts/scripts-library.sh
|
||||||
|
|
||||||
## Main ----------------------------------------------------------------------
|
## Main ----------------------------------------------------------------------
|
||||||
info_block "Bootstrapping System with Ansible"
|
info_block "Bootstrapping System with Ansible"
|
||||||
|
|
||||||
# Set the variable to the role file to be the absolute path
|
# Set the variable to the role file to be the absolute path
|
||||||
ANSIBLE_ROLE_FILE="$(readlink -f ${ANSIBLE_ROLE_FILE})"
|
ANSIBLE_ROLE_FILE="$(readlink -f "${ANSIBLE_ROLE_FILE}")"
|
||||||
|
|
||||||
# Create the ssh dir if needed
|
# Create the ssh dir if needed
|
||||||
ssh_key_create
|
ssh_key_create
|
||||||
|
@ -31,7 +31,7 @@ export OSA_GATE_JOB=true
|
|||||||
export ANSIBLE_ROLE_FETCH_MODE="git-clone"
|
export ANSIBLE_ROLE_FETCH_MODE="git-clone"
|
||||||
|
|
||||||
## Functions -----------------------------------------------------------------
|
## Functions -----------------------------------------------------------------
|
||||||
info_block "Checking for required libraries." 2> /dev/null || source $(dirname ${0})/scripts-library.sh
|
info_block "Checking for required libraries." 2> /dev/null || source "$(dirname "${0}")/scripts-library.sh"
|
||||||
|
|
||||||
## Main ----------------------------------------------------------------------
|
## Main ----------------------------------------------------------------------
|
||||||
# Set gate job exit traps, this is run regardless of exit state when the job finishes.
|
# Set gate job exit traps, this is run regardless of exit state when the job finishes.
|
||||||
@ -41,7 +41,7 @@ trap gate_job_exit_tasks EXIT
|
|||||||
log_instance_info
|
log_instance_info
|
||||||
|
|
||||||
# Get minimum disk size
|
# Get minimum disk size
|
||||||
DATA_DISK_MIN_SIZE="$((1024**3 * $(awk '/bootstrap_host_data_disk_min_size/{print $2}' $(dirname ${0})/../tests/roles/bootstrap-host/defaults/main.yml) ))"
|
DATA_DISK_MIN_SIZE="$((1024**3 * $(awk '/bootstrap_host_data_disk_min_size/{print $2}' "$(dirname "${0}")/../tests/roles/bootstrap-host/defaults/main.yml") ))"
|
||||||
|
|
||||||
# Determine the largest secondary disk device that meets the minimum size
|
# Determine the largest secondary disk device that meets the minimum size
|
||||||
DATA_DISK_DEVICE=$(lsblk -brndo NAME,TYPE,RO,SIZE | awk '/d[b-z]+ disk 0/{ if ($4>m && $4>='$DATA_DISK_MIN_SIZE'){m=$4; d=$1}}; END{print d}')
|
DATA_DISK_DEVICE=$(lsblk -brndo NAME,TYPE,RO,SIZE | awk '/d[b-z]+ disk 0/{ if ($4>m && $4>='$DATA_DISK_MIN_SIZE'){m=$4; d=$1}}; END{print d}')
|
||||||
@ -52,7 +52,7 @@ if [ -n "${DATA_DISK_DEVICE}" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Bootstrap Ansible
|
# Bootstrap Ansible
|
||||||
source $(dirname ${0})/bootstrap-ansible.sh
|
source "$(dirname "${0}")/bootstrap-ansible.sh"
|
||||||
|
|
||||||
# Log some data about the instance and the rest of the system
|
# Log some data about the instance and the rest of the system
|
||||||
log_instance_info
|
log_instance_info
|
||||||
@ -69,7 +69,7 @@ iptables -P FORWARD ACCEPT
|
|||||||
iptables -P OUTPUT ACCEPT
|
iptables -P OUTPUT ACCEPT
|
||||||
|
|
||||||
# Bootstrap an AIO
|
# Bootstrap an AIO
|
||||||
pushd $(dirname ${0})/../tests
|
pushd "$(dirname "${0}")/../tests"
|
||||||
sed -i '/\[defaults\]/a nocolor = 1/' ansible.cfg
|
sed -i '/\[defaults\]/a nocolor = 1/' ansible.cfg
|
||||||
ansible-playbook -i test-inventory.ini \
|
ansible-playbook -i test-inventory.ini \
|
||||||
-e "${BOOTSTRAP_OPTS}" \
|
-e "${BOOTSTRAP_OPTS}" \
|
||||||
@ -81,9 +81,9 @@ popd
|
|||||||
mkdir -p /openstack/log
|
mkdir -p /openstack/log
|
||||||
|
|
||||||
# Implement the log directory link for openstack-infra log publishing
|
# Implement the log directory link for openstack-infra log publishing
|
||||||
ln -sf /openstack/log $(dirname ${0})/../logs
|
ln -sf /openstack/log "$(dirname "${0}")/../logs"
|
||||||
|
|
||||||
pushd $(dirname ${0})/../playbooks
|
pushd "$(dirname "${0}")/../playbooks"
|
||||||
# Disable Ansible color output
|
# Disable Ansible color output
|
||||||
sed -i 's/nocolor.*/nocolor = 1/' ansible.cfg
|
sed -i 's/nocolor.*/nocolor = 1/' ansible.cfg
|
||||||
|
|
||||||
@ -100,13 +100,13 @@ log_instance_info
|
|||||||
|
|
||||||
# Execute the Playbooks
|
# Execute the Playbooks
|
||||||
export DEPLOY_AIO=true
|
export DEPLOY_AIO=true
|
||||||
bash $(dirname ${0})/run-playbooks.sh
|
bash "$(dirname "${0}")/run-playbooks.sh"
|
||||||
|
|
||||||
# Log some data about the instance and the rest of the system
|
# Log some data about the instance and the rest of the system
|
||||||
log_instance_info
|
log_instance_info
|
||||||
|
|
||||||
# Run the tempest tests
|
# Run the tempest tests
|
||||||
source $(dirname ${0})/run-tempest.sh
|
source "$(dirname "${0}")/run-tempest.sh"
|
||||||
|
|
||||||
# Log some data about the instance and the rest of the system
|
# Log some data about the instance and the rest of the system
|
||||||
log_instance_info
|
log_instance_info
|
||||||
|
@ -76,7 +76,7 @@ function playbook_run {
|
|||||||
|
|
||||||
trap run_play_book_exit_message EXIT
|
trap run_play_book_exit_message EXIT
|
||||||
|
|
||||||
info_block "Checking for required libraries." 2> /dev/null || source $(dirname ${0})/scripts-library.sh
|
info_block "Checking for required libraries." 2> /dev/null || source "$(dirname "${0}")/scripts-library.sh"
|
||||||
|
|
||||||
# Initiate the deployment
|
# Initiate the deployment
|
||||||
pushd "playbooks"
|
pushd "playbooks"
|
||||||
|
@ -27,7 +27,7 @@ export RUN_TEMPEST_OPTS=${RUN_TEMPEST_OPTS:-'--serial'}
|
|||||||
export TESTR_OPTS=${TESTR_OPTS:-''}
|
export TESTR_OPTS=${TESTR_OPTS:-''}
|
||||||
|
|
||||||
## Library Check -------------------------------------------------------------
|
## Library Check -------------------------------------------------------------
|
||||||
info_block "Checking for required libraries." 2> /dev/null || source $(dirname ${0})/scripts-library.sh
|
info_block "Checking for required libraries." 2> /dev/null || source "$(dirname "${0}")/scripts-library.sh"
|
||||||
|
|
||||||
|
|
||||||
## Main ----------------------------------------------------------------------
|
## Main ----------------------------------------------------------------------
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
## Shell Opts ----------------------------------------------------------------
|
## Shell Opts ----------------------------------------------------------------
|
||||||
set -e -u -v
|
set -e -u -v
|
||||||
|
|
||||||
export SCRIPTS_PATH="$(dirname $(readlink -f $0))"
|
export SCRIPTS_PATH="$(dirname "$(readlink -f "${0}")")"
|
||||||
export MAIN_PATH="$(dirname ${SCRIPTS_PATH})"
|
export MAIN_PATH="$(dirname "${SCRIPTS_PATH}")"
|
||||||
export UPGRADE_PLAYBOOKS="${SCRIPTS_PATH}/upgrade-utilities/playbooks"
|
export UPGRADE_PLAYBOOKS="${SCRIPTS_PATH}/upgrade-utilities/playbooks"
|
||||||
|
|
||||||
## Functions -----------------------------------------------------------------
|
## Functions -----------------------------------------------------------------
|
||||||
@ -99,7 +99,7 @@ function check_for_current {
|
|||||||
|
|
||||||
function pre_flight {
|
function pre_flight {
|
||||||
## Library Check -------------------------------------------------------------
|
## Library Check -------------------------------------------------------------
|
||||||
echo "Checking for required libraries." 2> /dev/null || source $(dirname ${0})/scripts-library.sh
|
echo "Checking for required libraries." 2> /dev/null || source "$(dirname "${0}")/scripts-library.sh"
|
||||||
## Pre-flight Check ----------------------------------------------------------
|
## Pre-flight Check ----------------------------------------------------------
|
||||||
# Clear the screen and make sure the user understands whats happening.
|
# Clear the screen and make sure the user understands whats happening.
|
||||||
clear
|
clear
|
||||||
|
@ -232,7 +232,7 @@ if [[ "${OSA_BRANCH}" != "master" ]]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Now use the information we have to update the ansible-role-requirements file
|
# Now use the information we have to update the ansible-role-requirements file
|
||||||
$(dirname ${0})/ansible-role-requirements-editor.py -f ansible-role-requirements.yml -n "${role_name}" -v "${role_version}"
|
"$(dirname "${0}")/ansible-role-requirements-editor.py" -f ansible-role-requirements.yml -n "${role_name}" -v "${role_version}"
|
||||||
done
|
done
|
||||||
echo "Completed updating ansible-role-requirements.yml"
|
echo "Completed updating ansible-role-requirements.yml"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user