Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Get initial values
- AZS=( ${availability_zones} )
- declare -a RESULTS=()
- # Loop through each AZ to find instance IPs
- for zone in "$${AZS[@]}"; do
- echo "> Get Consul seeds from AWS $zone"
- NUM_SEEDS=0
- while [[ $NUM_SEEDS -lt $((${min_cluster_size_consul} / 3)) ]]; do
- SEEDS=`aws ec2 describe-instances --filters \
- "Name=availability-zone,Values=$zone" \
- "Name=tag:Name,Consul=Server" \
- "Name=tag:Environment,Values=${environment}"`
- NUM_SEEDS=`echo $SEEDS | jq '{Reservations}[] | length'`
- echo "> NUM_SEEDS: $NUM_SEEDS"
- sleep 1
- done
- RESULTS+=( `echo $SEEDS | jq -r '.Reservations[].Instances[].NetworkInterfaces[].PrivateIpAddresses[].PrivateIpAddress'` )
- done
- # Don't look
- RETRYJOIN="-retry-join=$${RESULTS[0]}$(printf " -retry-join=%s" "$${RESULTS[@]:1}")"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement