From bc3a8a003982bd536cf0712ec68494b9142e6c9b Mon Sep 17 00:00:00 2001 From: holmesb <5072156+holmesb@users.noreply.github.com> Date: Mon, 11 Nov 2019 11:13:41 +0000 Subject: [PATCH] Fixes issue #5299 (#5300) --- .../roles/glusterfs/server/tasks/main.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/contrib/network-storage/glusterfs/roles/glusterfs/server/tasks/main.yml b/contrib/network-storage/glusterfs/roles/glusterfs/server/tasks/main.yml index 03d290832..b8fe9f9e3 100644 --- a/contrib/network-storage/glusterfs/roles/glusterfs/server/tasks/main.yml +++ b/contrib/network-storage/glusterfs/roles/glusterfs/server/tasks/main.yml @@ -36,7 +36,7 @@ - "{{ gluster_brick_dir }}" - "{{ gluster_mount_dir }}" -- name: Configure Gluster volume. +- name: Configure Gluster volume with replicas gluster_volume: state: present name: "{{ gluster_brick_name }}" @@ -46,6 +46,18 @@ host: "{{ inventory_hostname }}" force: yes run_once: true + when: groups['gfs-cluster']|length > 1 + +- name: Configure Gluster volume without replicas + gluster_volume: + state: present + name: "{{ gluster_brick_name }}" + brick: "{{ gluster_brick_dir }}" + cluster: "{% for item in groups['gfs-cluster'] -%}{{ hostvars[item]['ip']|default(hostvars[item].ansible_default_ipv4['address']) }}{% if not loop.last %},{% endif %}{%- endfor %}" + host: "{{ inventory_hostname }}" + force: yes + run_once: true + when: groups['gfs-cluster']|length <= 1 - name: Mount glusterfs to retrieve disk size mount: