[%
  # Return an array of IPv6 addresses from the interface of a given
  # type for all nodes which act as a given role
  #
  # @param argv.role	The role of the node to process
  #			One of: proxy, lb, mgmt
  # @param argv.type	The interface type of a node to extract
  #			the ip from
  #			One of: web_int, web_ext, sip_int, sip_ext, ...
  # @return out		The array of ips
-%]
[% out = [] -%]
[% FOREACH host IN hosts.keys.sort -%]
[% IF hosts.$host.role.grep('^' _ argv.role _ '$').size() -%]
[% FOREACH iface IN hosts.$host.interfaces -%]
[% FOREACH realiface IN hosts.$host.keys -%]
[% IF realiface == iface -%]
[% IF hosts.$host.$realiface.type.grep('^' _ argv.type _ '$').size() -%]
[% out.push(hosts.$host.$realiface.v6ip) -%]
[% END -%]
[% END -%]
[% END -%]
[% END -%]
[% END -%]
[% END -%]
[% out = out.sort -%]
