Make db-sync and package import conditional

Move code to initial db-sync and package import under 'if' block
  to be executed only on primary controller node.

Closes-bug: 1314085

Change-Id: Iaf51ffbd7e50969da418067ed39e3915fe91834a
Merge "Make db-sync and package import conditional"