- name: Configure volume domains
  include_tasks: create_domain.yml
  args:
    apply:
      run_once: true
      delegate_to: "{{ groups[domain.servers][0] }}"
  with_items: "{{ glusterfs_domains }}"
  loop_control:
    loop_var: domain  

- name: Mount volume domains
  include_tasks: mount_domain.yml
  when: domain.clients | default([]) | intersect(group_names) | length > 0
  with_items: "{{ glusterfs_domains }}"
  loop_control:
    loop_var: domain