---

- name: make server list
  set_fact: 
    server_list: "{{ gluster_servers|join(',') }}"

- name: show server list
  debug: var=server_list

- name: probe peers
  shell: "gluster peer probe {{ item }}"
  run_once: true
  with_items: "{{ (gluster_servers|difference([inventory_hostname])) }}"
  become: true
  become_user: root

- name: create volume
  gluster_volume: 
    name: "{{ volname }}"
    brick: "{{ brickmnt }}/brick"
    cluster: "{{ server_list }}"
    replicas: "{{ replicas }}"
    host: "{{ inventory_hostname }}"
    state: present
  sudo: true
#  run_once: true
  delegate_to: "{{ gluster_servers[0] }}"

