Fix bugs with allow-duplicate-installations-on-an-agent.

- Make sure that the config setting is respected everywhere.
- If less agents than requested installs are present and duplicate installation is allowed, install
  more than one instance of a service per agent.