Extend Ivy resolver

I have a legacy ivy repository that I need to be able to support through gradle.
The repo is stored in distributed filesystem with non standard structure.
for artifacts:
/repo/{organisation}/{suborganization}/{module}/{version}/lib/{artifacts}.{ext}
for ivyies:
/repo/{organisation}/{suborganization}/{module}/{version}/etc/{artifacts}.xml
in the ivyies the organization ={organisation}.{suborganization}
To make gradle support such structure I thought about creating a custom ivy resolver that will use a custom ivy ressource pattern that will split the organization and add new attributes that can be used in the patterns(artifact , ivy).
Any idea how to provide that to gradle ?