[CORD-2950] Fix ansible 2.5.1 breakage by using union operator instead of iterating over docker image lists

Change-Id: I7b651d881870b7f0daff02d28f1b1213073aa51d
diff --git a/Makefile b/Makefile
index 12152e3..2e53c9d 100644
--- a/Makefile
+++ b/Makefile
@@ -101,7 +101,7 @@
 
 $(CONFIG_FILES):
 	@test -e "$(PODCONFIG_PATH)" || { echo ""; echo "PODCONFIG file $(PODCONFIG_PATH) doesn't exist!" ; echo "*** Specify a valid CORD config file using PODCONFIG or PODCONFIG_PATH ***"; echo ""; exit 1; }
-	ansible-playbook -i 'localhost,' --extra-vars="cord_podconfig='$(PODCONFIG_PATH)' genconfig_dir='$(GENCONFIG_D)' scenarios_dir='$(SCENARIOS_D)' platform_install_dir='$(PI)' cord_profile_src_dir='$(PROFILE_D)' " $(BUILD)/ansible/genconfig.yml $(LOGCMD)
+	ansible-playbook $(ANSIBLE_ARGS) -i 'localhost,' --extra-vars="cord_podconfig='$(PODCONFIG_PATH)' genconfig_dir='$(GENCONFIG_D)' scenarios_dir='$(SCENARIOS_D)' platform_install_dir='$(PI)' cord_profile_src_dir='$(PROFILE_D)' " $(BUILD)/ansible/genconfig.yml $(LOGCMD)
 
 printconfig:
 	@echo "Scenario: '$(SCENARIO)'"
diff --git a/ansible/roles/genconfig/tasks/main.yml b/ansible/roles/genconfig/tasks/main.yml
index 8f4bde3..2f837db 100644
--- a/ansible/roles/genconfig/tasks/main.yml
+++ b/ansible/roles/genconfig/tasks/main.yml
@@ -79,20 +79,19 @@
 
 - name: Add items to profile_container_list from profile_manifest.xos_services
   set_fact:
-    profile_container_list: "{{ profile_container_list }} + [ 'xosproject/{{ item.name }}-synchronizer' ]"
-  with_items: "{{ profile_manifest.xos_services }}"
-  when:  item.synchronizer is not defined or item.synchronizer
+    profile_container_list: |
+      {{ profile_container_list | union(profile_manifest.xos_services | map(attribute='name') | map('regex_replace', '(.*)','xosproject/\1-synchronizer') | list) }}
 
 - name: Add items to profile_container_list from profile_manifest.xos_dynamic_services
+  when: profile_manifest.xos_dynamic_services
   set_fact:
-    profile_container_list: "{{ profile_container_list }} + [ 'xosproject/{{ item.name }}-synchronizer' ]"
-  with_items: "{{ profile_manifest.xos_dynamic_services if 'xos_dynamic_services' in profile_manifest else [] }}"
-  when: item.synchronizer is not defined or item.synchronizer
+    profile_container_list: |
+      {{ profile_container_list | union(profile_manifest.xos_dynamic_services | map(attribute='name') | map('regex_replace', '(.*)','xosproject/\1-synchronizer') | list) }}
 
 - name: Add items to profile_container_list from profile_manifest.enabled_gui_extensions
   set_fact:
-    profile_container_list: "{{ profile_container_list }} + [ 'xosproject/gui-extension-{{ item.name }}' ]"
-  with_items: "{{ profile_manifest.enabled_gui_extensions }}"
+    profile_container_list: |
+      {{ profile_container_list | union(profile_manifest.enabled_gui_extensions | map(attribute='name') | map('regex_replace', '(.*)','xosproject/gui-extension-\1') | list) }}
 
 - name: Update docker_image_whitelist to include containers specified by profile
   set_fact: