---
- name: Iterate volumes
  include_tasks: "volume.yml"
  with_dict: "{{ domain.volumes }}"
  vars:
    name: "{{ volume.key }}"
    path: "{{ volume.value.mount }}"
    server_group: "{{ domain.servers }}"
    domain_servers: "{{ groups[domain.servers] | map('extract', hostvars, 'ands_storage_hostname') | list }}"
    domain_server_ids: "{{ groups[domain.servers] | map('extract', hostvars, 'ands_host_id') | list }}"
  when: volume.value.mount is defined
  loop_control:
    loop_var: volume