summaryrefslogtreecommitdiffstats
path: root/roles/openshift_storage_glusterfs/tasks/glusterblock_deploy.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/openshift_storage_glusterfs/tasks/glusterblock_deploy.yml')
-rw-r--r--roles/openshift_storage_glusterfs/tasks/glusterblock_deploy.yml66
1 files changed, 66 insertions, 0 deletions
diff --git a/roles/openshift_storage_glusterfs/tasks/glusterblock_deploy.yml b/roles/openshift_storage_glusterfs/tasks/glusterblock_deploy.yml
new file mode 100644
index 000000000..bba1de654
--- /dev/null
+++ b/roles/openshift_storage_glusterfs/tasks/glusterblock_deploy.yml
@@ -0,0 +1,66 @@
+---
+- name: Delete pre-existing glusterblock provisioner resources
+ oc_obj:
+ namespace: "{{ glusterfs_namespace }}"
+ kind: "{{ item.kind }}"
+ name: "{{ item.name | default(omit) }}"
+ selector: "{{ item.selector | default(omit) }}"
+ state: absent
+ with_items:
+ - kind: "all,deploy,sa,clusterrole,clusterrolebinding"
+ selector: "glusterblock"
+ failed_when: False
+ when: glusterfs_wipe
+
+- name: Wait for glusterblock provisioner pods to terminate
+ oc_obj:
+ namespace: "{{ glusterfs_namespace }}"
+ kind: pod
+ state: list
+ selector: "glusterfs=block-{{ glusterfs_name }}-provisioner-pod"
+ register: glusterblock_pod
+ until: "glusterblock_pod.results.results[0]['items'] | count == 0"
+ delay: 10
+ retries: "{{ (glusterfs_timeout | int / 10) | int }}"
+ when: glusterfs_wipe
+
+- name: Copy initial glusterblock provisioner resource file
+ copy:
+ src: "{{ openshift.common.examples_content_version }}/{{ item }}"
+ dest: "{{ mktemp.stdout }}/{{ item }}"
+ with_items:
+ - "glusterblock-template.yml"
+
+- name: Create glusterblock provisioner template
+ oc_obj:
+ namespace: "{{ glusterfs_namespace }}"
+ kind: template
+ name: "glusterblock"
+ state: present
+ files:
+ - "{{ mktemp.stdout }}/glusterblock-template.yml"
+
+- name: Deploy glusterblock provisioner
+ oc_process:
+ namespace: "{{ glusterfs_namespace }}"
+ template_name: "glusterblock"
+ create: True
+ params:
+ IMAGE_NAME: "{{ glusterfs_block_image }}"
+ IMAGE_VERSION: "{{ glusterfs_block_version }}"
+ NAMESPACE: "{{ glusterfs_namespace }}"
+ CLUSTER_NAME: "{{ glusterfs_name }}"
+
+- name: Wait for glusterblock provisioner pod
+ oc_obj:
+ namespace: "{{ glusterfs_namespace }}"
+ kind: pod
+ state: list
+ selector: "glusterfs=block-{{ glusterfs_name }}-provisioner-pod"
+ register: glusterblock_pod
+ until:
+ - "glusterblock_pod.results.results[0]['items'] | count > 0"
+ # Pod's 'Ready' status must be True
+ - "glusterblock_pod.results.results[0]['items'] | oo_collect(attribute='status.conditions') | oo_collect(attribute='status', filters={'type': 'Ready'}) | map('bool') | select | list | count == 1"
+ delay: 10
+ retries: "{{ (glusterfs_timeout | int / 10) | int }}"