summaryrefslogtreecommitdiffstats
path: root/roles/openshift_resource/tasks/resource.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_resource/tasks/resource.yml')
-rw-r--r--roles/openshift_resource/tasks/resource.yml20
1 files changed, 20 insertions, 0 deletions
diff --git a/roles/openshift_resource/tasks/resource.yml b/roles/openshift_resource/tasks/resource.yml
new file mode 100644
index 0000000..326abbb
--- /dev/null
+++ b/roles/openshift_resource/tasks/resource.yml
@@ -0,0 +1,20 @@
+---
+- block:
+ - name: Find out which resources we are going to configure
+ set_fact: rkind="{{ tmpl.kind }}" rname="{{ tmpl.metadata.name }}"
+
+ - name: Lookup the specified resource
+ command: "oc get -n {{project}} {{rkind}}/{{rname}}"
+ register: result
+ failed_when: false
+ changed_when: (result | failed)
+
+ - name: Detroy existing resources
+ command: "oc delete -n {{project}} {{rkind}}/{{rname}}"
+ failed_when: false
+ when: (recreate|default(false))
+
+ - name: Create resources defined in template
+ command: "oc create -n {{project}} -f '{{ template_path }}/{{ template }}' {{ create_args | default('') }}"
+ when: (recreate|default(false)) or (result | changed)
+ run_once: true