CORD-1033 Build and publish service synchronizers on corddev

Change-Id: I60f9169d61721a2472b7d8fdc433f915d57a0873
diff --git a/group_vars/all b/group_vars/all
index e4d2f61..3951042 100644
--- a/group_vars/all
+++ b/group_vars/all
@@ -73,3 +73,7 @@
 enabled_gui_extensions:
   - name: sample
     path: orchestration/xos-sample-gui-extension
+
+frontend_only: False
+
+xos_services: []
diff --git a/roles/build-images/tasks/main.yml b/roles/build-images/tasks/main.yml
index 6563ab2..2cdf2c1 100644
--- a/roles/build-images/tasks/main.yml
+++ b/roles/build-images/tasks/main.yml
@@ -41,3 +41,14 @@
     tag: "{{ build_docker_tag }}"
     pull: False
   with_items: "{{ enabled_gui_extensions }}"
+
+# Build synchronizer images
+- name: Build synchronizer docker images
+  docker_image:
+    name: "xosproject/{{ item.name }}-synchronizer"
+    path: "{{ cord_dir }}/{{ item.path }}/xos/synchronizer"
+    dockerfile: "Dockerfile.synchronizer"
+    tag: "{{ build_docker_tag }}"
+    pull: False
+  with_items: "{{ xos_services }}"
+  when: not frontend_only and item.synchronizer is defined and item.synchronizer
diff --git a/roles/publish-images/tasks/main.yml b/roles/publish-images/tasks/main.yml
index ca22035..fb808f6 100644
--- a/roles/publish-images/tasks/main.yml
+++ b/roles/publish-images/tasks/main.yml
@@ -30,6 +30,21 @@
   with_items: "{{ enabled_gui_extensions }}"
 
 # Remove the old local images to force them to be re-pushed
+- name: Remove old local synchronizer images
+  docker_image:
+    name: "{{ deploy_docker_registry }}/xosproject/{{ item.name }}-synchronizer:{{ deploy_docker_tag }}"
+    state: absent
+  with_items: "{{ xos_services }}"
+
+- name: Tag and push locally built synchronizer images to docker registry
+  docker_image:
+    name: "xosproject/{{ item.name }}-synchronizer:{{ deploy_docker_tag }}"
+    repository: "{{ deploy_docker_registry }}/xosproject/{{ item.name }}-synchronizer:{{ deploy_docker_tag }}"
+    push: True
+  with_items: "{{ xos_services }}"
+  when: not frontend_only and item.synchronizer is defined and item.synchronizer
+
+# Remove the old local images to force them to be re-pushed
 - name: Remove old local miscellaneous images
   docker_image:
     name: "{{ deploy_docker_registry }}/{{ item }}"