ovn-migration: UNDERCLOUD_NODE_USER variable

The undercloud node user is configurable in TripleO and isn't always set
to heat-admin. This patch introduces an environment variable for cases
where user is different.

Closes-bug: 1927213

Change-Id: If65925ded1b5df2bfdcfba50445ff7d821c725d8
Signed-off-by: Jakub Libosvar <libosvar@redhat.com>
(cherry picked from commit 7bb5fb2de1)
This commit is contained in:
Jakub Libosvar 2021-03-19 12:12:16 +01:00
parent f15fb6831a
commit c542b27bb9
2 changed files with 9 additions and 3 deletions

View File

@ -107,6 +107,9 @@ Perform the following steps in the undercloud
step 1. step 1.
Default: ~/overcloud-deploy-ovn.sh Default: ~/overcloud-deploy-ovn.sh
* UNDERCLOUD_NODE_USER - user used on the undercloud nodes
Default: heat-admin
* STACK_NAME - Name or ID of the heat stack * STACK_NAME - Name or ID of the heat stack
Default: 'overcloud' Default: 'overcloud'
If the stack that is migrated differs from the default, please set this If the stack that is migrated differs from the default, please set this

View File

@ -29,6 +29,9 @@ LANG=C
# overcloud deploy script for OVN migration. # overcloud deploy script for OVN migration.
: ${OVERCLOUD_OVN_DEPLOY_SCRIPT:=~/overcloud-deploy-ovn.sh} : ${OVERCLOUD_OVN_DEPLOY_SCRIPT:=~/overcloud-deploy-ovn.sh}
# user on the nodes in the undercloud
: ${UNDERCLOUD_NODE_USER:=heat-admin}
: ${OPT_WORKDIR:=$PWD} : ${OPT_WORKDIR:=$PWD}
: ${STACK_NAME:=overcloud} : ${STACK_NAME:=overcloud}
: ${PUBLIC_NETWORK_NAME:=public} : ${PUBLIC_NETWORK_NAME:=public}
@ -138,7 +141,7 @@ generate_ansible_inventory_file() {
ovn_central=False ovn_central=False
node="$node_name ansible_host=$node_ip ovn_central=true" node="$node_name ansible_host=$node_ip ovn_central=true"
fi fi
echo $node ansible_ssh_user=heat-admin ansible_become=true >> hosts_for_migration echo $node ansible_ssh_user=$UNDERCLOUD_NODE_USER ansible_become=true >> hosts_for_migration
done done
echo "" >> hosts_for_migration echo "" >> hosts_for_migration
@ -148,7 +151,7 @@ generate_ansible_inventory_file() {
OVN_CONTROLLERS=$(get_group_hosts "$inventory_file" neutron_ovs_agent) OVN_CONTROLLERS=$(get_group_hosts "$inventory_file" neutron_ovs_agent)
for node_name in $OVN_CONTROLLERS; do for node_name in $OVN_CONTROLLERS; do
node_ip=$(get_host_ip "$inventory_file" $node_name) node_ip=$(get_host_ip "$inventory_file" $node_name)
echo $node_name ansible_host=$node_ip ansible_ssh_user=heat-admin ansible_become=true ovn_controller=true >> hosts_for_migration echo $node_name ansible_host=$node_ip ansible_ssh_user=$UNDERCLOUD_NODE_USER ansible_become=true ovn_controller=true >> hosts_for_migration
done done
rm -f "$inventory_file" rm -f "$inventory_file"
echo "" >> hosts_for_migration echo "" >> hosts_for_migration
@ -168,7 +171,7 @@ EOF
cat >> hosts_for_migration << EOF cat >> hosts_for_migration << EOF
[$1:vars] [$1:vars]
remote_user=heat-admin remote_user=$UNDERCLOUD_NODE_USER
public_network_name=$PUBLIC_NETWORK_NAME public_network_name=$PUBLIC_NETWORK_NAME
image_name=$IMAGE_NAME image_name=$IMAGE_NAME
working_dir=$OPT_WORKDIR working_dir=$OPT_WORKDIR