|
@@ -0,0 +1,31 @@
|
|
|
+---
|
|
|
+- name: Checking generation of {{file_content.kind}} {{file_content.metadata.name}}
|
|
|
+ command: >
|
|
|
+ {{ openshift.common.client_binary }}
|
|
|
+ --config={{ kubeconfig }}
|
|
|
+ get {{file_content.kind}} {{file_content.metadata.name}}
|
|
|
+ -o jsonpath='{.metadata.resourceVersion}'
|
|
|
+ -n {{namespace}}
|
|
|
+ register: generation_init
|
|
|
+ changed_when: no
|
|
|
+
|
|
|
+- name: Applying {{file_name}}
|
|
|
+ command: >
|
|
|
+ {{ openshift.common.client_binary }} --config={{ kubeconfig }}
|
|
|
+ apply -f {{ file_name }}
|
|
|
+ -n {{ openshift_metrics_project }}
|
|
|
+ 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}}
|
|
|
+ command: >
|
|
|
+ {{ openshift.common.client_binary }} --config={{ kubeconfig }}
|
|
|
+ get {{file_content.kind}} {{file_content.metadata.name}}
|
|
|
+ -o jsonpath='{.metadata.resourceVersion}'
|
|
|
+ -n {{namespace}}
|
|
|
+ register: version_changed
|
|
|
+ vars:
|
|
|
+ init_version: "{{ (generation_init is defined) | ternary(generation_init.stdout, '0') }}"
|
|
|
+ failed_when: "'error' in version_changed.stderr"
|
|
|
+ changed_when: version_changed.stdout | int > init_version | int
|