Factor out "roles_to_remotes()" into common code

Signed-off-by: Dan Mick <dan.mick@inktank.com>