diff options
author | Scott Dodson <sdodson@redhat.com> | 2017-09-06 10:32:39 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-06 10:32:39 -0400 |
commit | bb59f5617bce05d61f594efe6e602d307bc6f200 (patch) | |
tree | 9b31d02dc5a8d8986e08901d6ea4ffd5ef07ca98 /roles/openshift_prometheus/tasks/create_pvs.yaml | |
parent | 5aaa24b25653cca479955eb39d353caee0fcf373 (diff) | |
parent | ec75d0ac888f3fab87f8d335224596df045e260a (diff) | |
download | openshift-bb59f5617bce05d61f594efe6e602d307bc6f200.tar.gz openshift-bb59f5617bce05d61f594efe6e602d307bc6f200.tar.bz2 openshift-bb59f5617bce05d61f594efe6e602d307bc6f200.tar.xz openshift-bb59f5617bce05d61f594efe6e602d307bc6f200.zip |
Merge pull request #4509 from zgalor/prometheus-role
Create ansible role for deploying prometheus on openshift
Diffstat (limited to 'roles/openshift_prometheus/tasks/create_pvs.yaml')
-rw-r--r-- | roles/openshift_prometheus/tasks/create_pvs.yaml | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/roles/openshift_prometheus/tasks/create_pvs.yaml b/roles/openshift_prometheus/tasks/create_pvs.yaml new file mode 100644 index 000000000..4e79da05f --- /dev/null +++ b/roles/openshift_prometheus/tasks/create_pvs.yaml @@ -0,0 +1,36 @@ +--- +# Check for existance and then conditionally: +# - evaluate templates +# - PVs +# +# These tasks idempotently create required Prometheus PV objects. Do not +# call this file directly. This file is intended to be ran as an +# include that has a 'with_items' attached to it. Hence the use below +# of variables like "{{ item.pv_label }}" + +- name: "Check if the {{ item.pv_label }} template has been created already" + oc_obj: + namespace: "{{ openshift_prometheus_namespace }}" + state: list + kind: pv + name: "{{ item.pv_name }}" + register: prom_pv_check + +# Skip all of this if the PV already exists +- block: + - name: "Ensure the {{ item.pv_label }} template is evaluated" + template: + src: "{{ item.pv_template }}.j2" + dest: "{{ tempdir }}/templates/{{ item.pv_template }}" + + - name: "Ensure {{ item.pv_label }} is created" + oc_obj: + namespace: "{{ openshift_prometheus_namespace }}" + kind: pv + name: "{{ item.pv_name }}" + state: present + delete_after: True + files: + - "{{ tempdir }}/templates/{{ item.pv_template }}" + when: + - not prom_pv_check.results.results.0 |