summaryrefslogtreecommitdiffstats
path: root/roles/openshift_cfme/tasks/create_pvs.yml
diff options
context:
space:
mode:
authorScott Dodson <sdodson@redhat.com>2017-06-15 15:05:41 -0400
committerGitHub <noreply@github.com>2017-06-15 15:05:41 -0400
commit1ded13614039e408c81520020b5dccf3523915a4 (patch)
tree7a70c321962053c319f46bd2a73d5e7d5fd1174a /roles/openshift_cfme/tasks/create_pvs.yml
parent0862f7b6f1448d6ea1fe6c836b3ba1de0afb4485 (diff)
parent39e3ae639217738e3ffbb7e90a1e8940bc840798 (diff)
downloadopenshift-1ded13614039e408c81520020b5dccf3523915a4.tar.gz
openshift-1ded13614039e408c81520020b5dccf3523915a4.tar.bz2
openshift-1ded13614039e408c81520020b5dccf3523915a4.tar.xz
openshift-1ded13614039e408c81520020b5dccf3523915a4.zip
Merge pull request #4041 from tbielawa/cfme
CFME as an OpenShift Pod
Diffstat (limited to 'roles/openshift_cfme/tasks/create_pvs.yml')
-rw-r--r--roles/openshift_cfme/tasks/create_pvs.yml36
1 files changed, 36 insertions, 0 deletions
diff --git a/roles/openshift_cfme/tasks/create_pvs.yml b/roles/openshift_cfme/tasks/create_pvs.yml
new file mode 100644
index 000000000..7fa7d3997
--- /dev/null
+++ b/roles/openshift_cfme/tasks/create_pvs.yml
@@ -0,0 +1,36 @@
+---
+# Check for existance and then conditionally:
+# - evaluate templates
+# - PVs
+#
+# These tasks idempotently create required CFME 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_cfme_project }}"
+ state: list
+ kind: pv
+ name: "{{ item.pv_name }}"
+ register: miq_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: "{{ template_dir }}/{{ item.pv_template }}"
+
+ - name: "Ensure {{ item.pv_label }} is created"
+ oc_obj:
+ namespace: "{{ openshift_cfme_project }}"
+ kind: pv
+ name: "{{ item.pv_name }}"
+ state: present
+ delete_after: True
+ files:
+ - "{{ template_dir }}/{{ item.pv_template }}"
+ when:
+ - not miq_pv_check.results.results.0