CORD-2618 If an onboarding recipe does not exist, do not run it
Change-Id: I8df410309195cdcc0a74698a30b726dbab5f377b
diff --git a/roles/xos-core-build/tasks/main.yml b/roles/xos-core-build/tasks/main.yml
index 71675b7..23d80f1 100644
--- a/roles/xos-core-build/tasks/main.yml
+++ b/roles/xos-core-build/tasks/main.yml
@@ -21,10 +21,20 @@
set_fact:
recipes: ['/opt/cord/orchestration/xos/xos/core/core-onboard.yaml']
+- name: Check to see which recipes exist
+ stat:
+ path: "{{ build_cord_dir | realpath }}/{{ item.path }}/xos/{{ item.name }}-{{ item.operation | default('onboard') }}.yaml"
+ register: service_stats
+ with_items: "{{ xos_services }}"
+
- name: Generate list of recipes
set_fact:
- recipes: "{{ recipes }} + [ '/opt/cord/{{ item.path }}/xos/{{ item.name }}-{{ item.operation | default('onboard') }}.yaml']"
- with_items: "{{ xos_services }}"
+ recipes: "{{ recipes }} + [ '/opt/cord/{{ item.0.path }}/xos/{{ item.0.name }}-{{ item.0.operation | default('onboard') }}.yaml']"
+ with_together:
+ - "{{ xos_services }}"
+ - "{{ service_stats.results }}"
+ when:
+ - item.1.stat.exists == true
- name: Add in the profile library
set_fact: