Move IP determination logic out of the hosts.cfg ERB and into the default library.  This will allow is to be expanded upon later, while keeping the ERB readable.