Use hostnames method to generate hosts array.