Extracted function create_hosts_in_location.