Replace loopback urls (eg.localhost; 127.x.x.x) with IP.

Bug 1309207: https://bugs.launchpad.net/juju-core/+bug/1309207