summaryrefslogtreecommitdiffstats
path: root/roles/openshift_logging/tasks/oc_apply.yaml
diff options
context:
space:
mode:
authorewolinetz <ewolinet@redhat.com>2017-01-13 15:04:57 -0600
committerewolinetz <ewolinet@redhat.com>2017-01-13 15:16:23 -0600
commit8db66f0929fecb26b3c4e71fe0797f20df13007a (patch)
tree0cc550ed38ebb7acde999c671a273e365258f44b /roles/openshift_logging/tasks/oc_apply.yaml
parent55ddb4f4b901632f051251ba0387a107dd3bb7ef (diff)
downloadopenshift-8db66f0929fecb26b3c4e71fe0797f20df13007a.tar.gz
openshift-8db66f0929fecb26b3c4e71fe0797f20df13007a.tar.bz2
openshift-8db66f0929fecb26b3c4e71fe0797f20df13007a.tar.xz
openshift-8db66f0929fecb26b3c4e71fe0797f20df13007a.zip
Using oc_apply task for idempotent
Diffstat (limited to 'roles/openshift_logging/tasks/oc_apply.yaml')
-rw-r--r--roles/openshift_logging/tasks/oc_apply.yaml29
1 files changed, 29 insertions, 0 deletions
diff --git a/roles/openshift_logging/tasks/oc_apply.yaml b/roles/openshift_logging/tasks/oc_apply.yaml
new file mode 100644
index 000000000..c362b7fca
--- /dev/null
+++ b/roles/openshift_logging/tasks/oc_apply.yaml
@@ -0,0 +1,29 @@
+---
+- name: Checking generation of {{file_content.kind}} {{file_content.metadata.name}}
+ shell: >
+ {{ openshift.common.client_binary }}
+ --config={{ kubeconfig }}
+ get {{file_content.kind}} {{file_content.metadata.name}}
+ -o jsonpath='{.metadata.resourceVersion}'
+ -n {{namespace}} || echo 0
+ register: generation_init
+ changed_when: no
+
+- name: Applying {{file_name}}
+ command: >
+ {{ openshift.common.client_binary }} --config={{ kubeconfig }}
+ apply -f {{ file_name }}
+ -n {{ namespace }}
+ register: generation_apply
+ failed_when: "'error' in generation_apply.stderr"
+ changed_when: no
+
+- name: Determine change status of {{file_content.kind}} {{file_content.metadata.name}}
+ shell: >
+ {{ openshift.common.client_binary }} --config={{ kubeconfig }}
+ get {{file_content.kind}} {{file_content.metadata.name}}
+ -o jsonpath='{.metadata.resourceVersion}'
+ -n {{namespace}} || echo 0
+ register: generation_changed
+ failed_when: "'error' in generation_changed.stderr"
+ changed_when: generation_changed.stdout | int > generation_init.stdout | int