fda773c682
1.switch to get-pip.py script to install pip on undercloud 2.pip the python-openstackclient at 3.11.0 for python2 3.make the tripleo based hostfile script as default choice Change-Id: Idc90832ee9372954e4e05ce36a0a00886a427bce
63 lines
2.2 KiB
Bash
Executable File
63 lines
2.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
function usage
|
|
{
|
|
echo "usage: generate_tripleo_hostfile.sh"
|
|
echo " [-t | --tripleo_ip_address <tripleo_ip_address> [-l | --localhost]]"
|
|
echo " [-o | --overcloud_stack_name <overcloud_stack_name>]"
|
|
echo " [-u | --user <user>]"
|
|
echo " [-c | --ceph_stack_name <ceph_stack_name>]"
|
|
echo " [-h | --help]"
|
|
echo "Generates ssh config file to use with an TripleO undercloud host as a jumpbox and creates ansible inventory file."
|
|
}
|
|
|
|
user="stack"
|
|
uncomment_localhost=false
|
|
tripleo_ip_address=
|
|
|
|
while [ "$1" != "" ]; do
|
|
case $1 in
|
|
-l | --localhost ) uncomment_localhost=true
|
|
tripleo_ip_address="localhost"
|
|
;;
|
|
-t | --tripleo_ip_address )
|
|
shift
|
|
tripleo_ip_address=$1
|
|
;;
|
|
-u | --user )
|
|
shift
|
|
user=$1
|
|
;;
|
|
-h | --help ) usage
|
|
exit
|
|
;;
|
|
* ) usage
|
|
exit 1
|
|
esac
|
|
shift
|
|
done
|
|
if [ -z "$tripleo_ip_address" ]; then
|
|
usage
|
|
exit 1
|
|
fi
|
|
|
|
out_file="hosts.yml"
|
|
if [ $uncomment_localhost ]; then
|
|
source ~/stackrc
|
|
tripleo-ansible-inventory --static-yaml-inventory ${out_file}
|
|
else
|
|
file_path=$(ssh -tt -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" ${user}@${tripleo_ip_address} ". ~/stackrc; tripleo-ansible-inventory --static-yaml-inventory ${out_file}; pwd ${out_file}")
|
|
scp -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" ${user}@${tripleo_ip_address}:${file_path}/${out_file} .
|
|
fi
|
|
|
|
sed -i '1iBrowbeat:\n hosts:\n undercloud: {}' ${out_file}
|
|
sed -i '$aStockpile:\n hosts:\n undercloud: {}' ${out_file}
|
|
|
|
# Copy heat-admin key so we can use jumpbox
|
|
echo ""
|
|
echo "---------------------------"
|
|
echo "Copying heat-admin key to local machine for use with ssh config file"
|
|
echo "---------------------------"
|
|
echo ""
|
|
scp -o "UserKnownHostsFile /dev/null" -o "StrictHostKeyChecking no" "${user}@${tripleo_ip_address}":/home/${user}/.ssh/id_rsa heat-admin-id_rsa
|