{% set i = 0 %}
{% for domain in glusterfs_domains %}
{%   for name, vol in domain.volumes.items() %}
{%      if vol.nfs_clients is defined %}
{%        set nfs = vol.nfs_clients %}
{%        set i = i + 1 %}
EXPORT {
      Export_Id = {{ i }};
      Path = "/{{ name }}";
      FSAL {
            name = GLUSTER;
            hostname = "localhost";
            volume = "{{ name }}";
      }
      Access_type = RW;
      Disable_ACL = true;
      Squash = "No_root_squash";
      Pseudo = "/{{ name }}";
      Protocols = "3", "4" ;
      Transports = "UDP","TCP";
      SecType = "sys";
      Manage_gids = true;

{%        if nfs.rw is defined %}
{%          for net in nfs.rw %}
      CLIENT {
            clients = {{ net }};
            Access_type = RW;
      }
{%          endfor %}
{%        endif  %}

{%        if nfs.ro is defined %}
{%          for net in nfs.ro %}
      CLIENT {
            clients = {{ net }};
            Access_type = RO;
      }
{%          endfor %}
{%        endif  %}
}

{%     endif %}
{%   endfor %}
{% endfor %}
