From ff3cbb6ee9aeac44a329c8eee505f60144d44b48 Mon Sep 17 00:00:00 2001 From: "Suren A. Chilingaryan" Date: Sun, 26 Jan 2020 02:48:45 +0100 Subject: Create missing OpenShift resources when policy is 'replace'. Due to the bug previously, previously only existing resources were replaced, but no new resource was created without reporting a error (for instance the new StatefulSet were not created). --- roles/openshift_resource/tasks/resource.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'roles/openshift_resource/tasks/resource.yml') diff --git a/roles/openshift_resource/tasks/resource.yml b/roles/openshift_resource/tasks/resource.yml index b07f645..416f485 100644 --- a/roles/openshift_resource/tasks/resource.yml +++ b/roles/openshift_resource/tasks/resource.yml @@ -17,6 +17,6 @@ when: (recreate|default(false)) - name: "Populate resources defined in {{ template }} to {{project}} ({{ replace | default(false) | ternary('replace', 'create') }})" - command: "oc {{ replace | default(false) | ternary('replace', 'create') }} -n {{project}} -f '{{ template_path }}/{{ template }}' {{ create_args | default('') }}" + command: "oc {{ replace | default(false) | ternary((find_result.rc == 0) | ternary('replace', 'create'), 'create') }} -n {{project}} -f '{{ template_path }}/{{ template }}' {{ create_args | default('') }}" when: (recreate|default(false)) or (replace | default(false)) or (find_result.rc != 0) run_once: true -- cgit v1.2.3