blob: f9b878715990f3f8c5165f099d2e4efb46d03d73 [file] [log] [blame]
Scott Baker50421662016-06-27 22:09:48 -07001source ../../setup/admin-openrc.sh
2
3get_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
9GRENAMES=()
10BM_IPS=()
11
12NODES=`sudo bash -c "source ../../setup/admin-openrc.sh ; nova hypervisor-list" |grep enabled|awk '{print $4}'`
13I=1
14for 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 ))
25done
26
27GRE_NAMES=${GRE_NAMES[@]}
28BM_IPS=${BM_IPS[@]}
29
30echo switch_volt ansible_ssh_host=$( get_ip mysite_volt flat-lan-1-net) grenames=\"$GRE_NAMES\" bm_ips=\"$BM_IPS\"
31
32NM=`grep "^nm" /root/setup/fqdn.map | awk '{ print $2 }'`
33echo "nm1 ansible_ssh_host=$NM ansible_ssh_private_key_file=/root/.ssh/id_rsa"
34
35echo "[baremetal]"
36I=1
37for NODE in $NODES; do
38 echo bm$I
39 I=$((I+1))
40done
41
42# now for the network management node
43echo "[nm]"
44echo "nm1"