Override a role's templates?

Hi

I'm using roles extensively to separate functionality, and I'm trying
to keep the roles as general as possible. The resulting playbooks are
very minimal, containing not more than a set of include_role tasks.

Many roles use templates, which are stored inside the role's templates
directory.
Those templates can sometimes be quite specific, and are not usable in
every scenario.
So I'm looking for a way to 'override' the templates.
Putting my custom template next to my playbook doesn't work, but it
comes close. That path is included in the searchpath - but has lower
priority:

- role_path/templates
- role_path
- role_path/tasks/templates
- role_path/tasks
- playbook_dir/templates
- playbook_dir

So I ended up working around this by renaming the template and
changing the template task to:

- name: Ensure All-in-one Nagios configuration is available
  template:
    src: "{{ item }}"
    dest: "/etc/nagios3/conf.d/local.cfg"
  with_first_found:
    - nagios_local.j2 <-- custom template
    - _nagios_local.j2 <-- default template

This does actually work, but it feels a bit kludgy.
Is there a way to change the ordering of the items in the template searchpath?

BTW - Ideally I would like to be able to use the same inheritance structure
that is already in place for variables, in particular these concepts:

- group_templates/all
- group_templates/mygroup
- host_templates/myhost

The same can be said for 'files'.

Maybe something like setting "NAGIOS_TEMPLATE: nagios_local.j2" in
your role's defaults then override NAGIOS_TEMPLATE (inventory variable
or whatever) as needed with a path to an alternate template.

Instead of template module use the copy module with content instead of src.

The template you have in a variable and use content like so.

- copy:
     content: '{{ my_template }}'
     dest: /tmp/test