Created
September 12, 2016 23:15
-
-
Save andrewdmcleod/c4c429a5f1c82386852a64e316d35191 to your computer and use it in GitHub Desktop.
juju status with public ips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -f; IFS=$'\n' | |
juju status --format=tabular|sed -n '1,/Machines/ p' | |
#juju status --format=tabular|sed '/\[Machines\]/q' | |
echo . | |
echo 'ID STATE VERSION PRIVATE-IP PUBLIC-IP INS-ID SERIES HARDWARE' | |
machines=$(juju status --format=tabular|grep arch) | |
for a in $machines | |
do | |
novaIP=$(nova list | grep $(echo $a|awk '{print $4}')|awk -F ',' '{print $2}'|tr -d ' ') | |
if [ "$novaIP" == "" ] ; then novaIP='no public ip' ; fi | |
echo $a|sed "s/\([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}/\0|${novaIP}/g" | |
done | |
set +f; unset IFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment