5 # set vars from env if not provided by user as options
6 installer_key_file=${installer_key_file:-$HOME/installer_key_file}
7 opnfv_installer=${opnfv_installer:-$HOME/opnfv-installer.sh}
9 # Fetch INSTALLER_IP for APEX deployments
10 if [[ ${INSTALLER_TYPE} == 'apex' ]]; then
12 echo "Gathering IP information for Apex installer VM"
13 ssh_options="-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
14 if sudo virsh list | grep undercloud; then
15 echo "Installer VM detected"
16 undercloud_mac=$(sudo virsh domiflist undercloud | grep default | \
17 grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
18 export INSTALLER_IP=$(/usr/sbin/arp -e | grep ${undercloud_mac} | awk {'print $1'})
19 echo "Installer ip is ${INSTALLER_IP}"
21 echo "No available installer VM exists and no credentials provided...exiting"
25 sudo cp /root/.ssh/id_rsa ${installer_key_file}
26 sudo chown `whoami`:`whoami` ${installer_key_file}
28 elif [[ ${INSTALLER_TYPE} == 'daisy' ]]; then
29 echo "Gathering IP information for Daisy installer VM"
30 if sudo virsh list | grep daisy; then
31 echo "Installer VM detected"
33 bridge_name=$(sudo virsh domiflist daisy | grep vnet | awk '{print $3}')
34 echo "Bridge is $bridge_name"
36 installer_mac=$(sudo virsh domiflist daisy | grep vnet | \
37 grep -Eo "[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+:[0-9a-f]+")
38 export INSTALLER_IP=$(/usr/sbin/arp -e -i $bridge_name | grep ${installer_mac} | head -n 1 | awk {'print $1'})
40 echo "Installer ip is ${INSTALLER_IP}"
42 echo "No available installer VM exists...exiting"
46 elif [[ ${INSTALLER_TYPE} == 'fuel' ]]; then
47 if [[ ! "${BRANCH}" =~ "danube" ]]; then
48 export SSH_KEY=${SSH_KEY:-/var/lib/opnfv/mcp.rsa}
49 sudo cp ${SSH_KEY} ${installer_key_file}
50 sudo chown `whoami`:`whoami` ${installer_key_file}
55 # Checking if destination path is valid
56 if [ -d $opnfv_installer ]; then
57 error "Please provide the full destination path for the installer ip file including the filename"
59 # Check if we can create the file (e.g. path is correct)
60 touch $opnfv_installer || error "Cannot create the file specified. Check that the path is correct and run the script again."
64 # Write the installer info to the file
65 echo export INSTALLER_TYPE=${INSTALLER_TYPE} > $opnfv_installer
66 echo export INSTALLER_IP=${INSTALLER_IP} >> $opnfv_installer
67 if [ -e ${installer_key_file} ]; then
68 echo export SSH_KEY=${installer_key_file} >> $opnfv_installer