Scott Baker | 5042166 | 2016-06-27 22:09:48 -0700 | [diff] [blame] | 1 | source ../../setup/admin-openrc.sh |
| 2 | |
| 3 | get_ip () { |
| 4 | LABEL=$1 |
| 5 | NETWORK=$2 |
| 6 | nova list --all-tenants|grep $LABEL|sed "s/^.*$NETWORK=//g"|sed 's/; .*$//g'|awk '{print $1}' |
| 7 | } |
| 8 | |
| 9 | GRENAMES=() |
| 10 | BM_IPS=() |
| 11 | |
| 12 | NODES=`sudo bash -c "source ../../setup/admin-openrc.sh ; nova hypervisor-list" |grep enabled|awk '{print $4}'` |
| 13 | I=1 |
| 14 | for NODE in $NODES; do |
| 15 | BM_SSH_IP=`getent hosts $NODE | awk '{ print $1 }'` |
| 16 | IFS=. read BM_NAME BM_REMAINDER <<< $NODE |
| 17 | BM_IP=`sudo grep -i $BM_NAME /root/setup/data-hosts.flat-lan-1 | awk '{print $1}'` |
| 18 | |
| 19 | GRE_NAMES+=("gre-bm-$I") |
| 20 | BM_IPS+=("$BM_IP") |
| 21 | |
| 22 | #echo switch_volt$I ansible_ssh_host=$( get_ip mysite_volt flat-lan-1-net) grename=gre-bm-$I bm_addr=$BM_IP |
| 23 | echo bm$I ansible_ssh_host=$BM_SSH_IP grename=gre-bm-$I volt_addr=$( get_ip mysite_volt flat-lan-1-net) ansible_ssh_private_key_file=/root/.ssh/id_rsa |
| 24 | I=$(( I+1 )) |
| 25 | done |
| 26 | |
| 27 | GRE_NAMES=${GRE_NAMES[@]} |
| 28 | BM_IPS=${BM_IPS[@]} |
| 29 | |
| 30 | echo switch_volt ansible_ssh_host=$( get_ip mysite_volt flat-lan-1-net) grenames=\"$GRE_NAMES\" bm_ips=\"$BM_IPS\" |
| 31 | |
| 32 | NM=`grep "^nm" /root/setup/fqdn.map | awk '{ print $2 }'` |
| 33 | echo "nm1 ansible_ssh_host=$NM ansible_ssh_private_key_file=/root/.ssh/id_rsa" |
| 34 | |
| 35 | echo "[baremetal]" |
| 36 | I=1 |
| 37 | for NODE in $NODES; do |
| 38 | echo bm$I |
| 39 | I=$((I+1)) |
| 40 | done |
| 41 | |
| 42 | # now for the network management node |
| 43 | echo "[nm]" |
| 44 | echo "nm1" |