Skip to content

Instantly share code, notes, and snippets.

@rosskukulinski
Created October 9, 2014 21:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rosskukulinski/0fcd47c6fccf79b4751b to your computer and use it in GitHub Desktop.
Save rosskukulinski/0fcd47c6fccf79b4751b to your computer and use it in GitHub Desktop.
CoreOS Rackspace IPs for /etc/environment
#!/bin/bash
for i in `ip a | grep -- 'inet ' | awk '{print $2}' | grep -v '^127.' | cut -d'/' -f1`; do
case `echo $i | cut -d. -f1` in
"10")
echo "RAX_SERVICENET_IPV4=$i"
;;
"192")
echo "RAX_PRIVATENET_IPV4=$i"
;;
"172")
echo "RAX_ETCDNET_IPV4=$i"
;;
*)
echo "RAX_PUBLICNET_IPV4=$i"
;;
esac
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment