Fix workaround delegation when overcloud's name is not overcloud.

tripleo-ansible-inventory use overcloud as the name of the stack by
default.  On some ci, that value may be different, this then produces
an undercloud only inventory file.

Change-Id: Ic420c0717165e01df99ad2368a23fc9fc10e71c1
Closes-Bug: #1857120
(cherry picked from commit 6483436d7d)
(cherry picked from commit 1da968309d)
This commit is contained in:
Sofer Athlan-Guyot 2019-12-20 12:02:26 +01:00
parent 81035c28da
commit 889259d861
1 changed files with 12 additions and 2 deletions

View File

@ -47,6 +47,7 @@ function ansible_patch {
local ansible_filename=$1
local ansible_limit=""
local ansible_ssh_user="heat-admin"
local overcloud_stack_name="overcloud"
local ansible_dir=$HOME/ansible_workarounds
if [ ! -z $LIMIT ]
@ -57,11 +58,14 @@ function ansible_patch {
then
ansible_ssh_user=$ANSIBLE_SSH_USER
fi
if [ -n "${OVERCLOUD_STACK_NAME}" ];
then
overcloud_stack_name="${OVERCLOUD_STACK_NAME}"
fi
inventory_file=${ansible_dir}/tripleo-inventory.yaml
if [ ! -f "$inventory_file" ]; then
source {{ undercloud_rc }}
tripleo-ansible-inventory --ansible_ssh_user ${ansible_ssh_user} --static-yaml-inventory ${inventory_file}
tripleo-ansible-inventory --plan "${overcloud_stack_name}" --ansible_ssh_user ${ansible_ssh_user} --static-yaml-inventory ${inventory_file}
fi
# Run ansible playbook
@ -72,6 +76,7 @@ function ansible_patch {
# Global vars
LIMIT=""
ANSIBLE_SSH_USER=""
OVERCLOUD_STACK_NAME="{{ overcloud_stack_name }}"
while [[ $# -gt 0 ]]
do
@ -88,6 +93,11 @@ case $key in
shift # past argument
shift # past value
;;
-o|--overcloud-stack-name)
OVERCLOUD_STACK_NAME="$2"
shift # past argument
shift # past value
;;
-h|--help)
usage
exit 1