From 78e94aa9822952347e16e1a400a1d718c3675377 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Mass=C3=A9?= Date: Wed, 21 Jun 2017 13:06:36 +0200 Subject: [PATCH] handle errors while creating objects --- roles/3scale/tasks/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/roles/3scale/tasks/main.yml b/roles/3scale/tasks/main.yml index ca7811d..cd9050f 100644 --- a/roles/3scale/tasks/main.yml +++ b/roles/3scale/tasks/main.yml @@ -21,7 +21,10 @@ when: '"project/" ~ threescale_options.project not in oc_get_projects.stdout_lines' - name: Process the OpenShift Template and create the OpenShift objects for the 3scale API Management Platform - shell: oc process -f "{{ threescale_options.template }}" -p "TENANT_NAME={{ threescale_options.tenant_name }}" -p "WILDCARD_DOMAIN={{ threescale_options.wildcard_domain }}" | oc create -f - -n "{{ threescale_options.project }}" + shell: oc process -f "{{ threescale_options.template }}" -p "TENANT_NAME={{ threescale_options.tenant_name }}" -p "WILDCARD_DOMAIN={{ threescale_options.wildcard_domain }}" -n "{{ threescale_options.project }}" | oc create -f - -n "{{ threescale_options.project }}" + register: oc + failed_when: oc.rc > 0 and 'Error from server (AlreadyExists):' not in oc.stderr + changed_when: oc.rc == 0 - include: status.yml tags: status