Refactoring of mongodb host selector

* Moving ugly puppet logic into a function.
* Making simple mode work same as HA mode
  with primary and slave nodes

Change-Id: Ic5a334364afcd3673d1353db3685025e9da40b97