summaryrefslogtreecommitdiffstats
path: root/roles/glusterfs/tasks/create_block.yml
diff options
context:
space:
mode:
Diffstat (limited to 'roles/glusterfs/tasks/create_block.yml')
-rw-r--r--roles/glusterfs/tasks/create_block.yml18
1 files changed, 18 insertions, 0 deletions
diff --git a/roles/glusterfs/tasks/create_block.yml b/roles/glusterfs/tasks/create_block.yml
new file mode 100644
index 0000000..5b30f02
--- /dev/null
+++ b/roles/glusterfs/tasks/create_block.yml
@@ -0,0 +1,18 @@
+- name: Check if the holding volume already exists
+ shell: "gluster volume info {{ block.value.volume }}"
+ changed_when: false
+ register: gv_results
+
+- name: Get list of existing block volumes
+ shell: "gluster-block list {{ block.value.volume }}"
+ changed_when: false
+ register: bv_results
+
+- name: Create block volume
+ shell: "gluster-block create {{ block.value.volume }}/{{ block.key }} ha {{ servers | length }} auth disable prealloc no {{ servers | join(',') }} {{ block.value.capacity }}"
+ when: block.key not in bv_results.stdout_lines
+ vars:
+ ha: "{{ block.value.ha | default(3) }}"
+ servers: "{{ domain_servers[0:(ha | int)] }}"
+ loop_control:
+ loop_var: volume