Right, let me check I get the requirement -
so for example we're talking about say an 'apache' role and a 'kibana'
role that's going to need a vhost setup.
(with ansible 1.9 at least), if I set a vhost_conf_dir var in my
apache role (which is a path to a directory you can drop .vhost files
into to have them auto-included, nginx etc. has a similar feature) and
then have my kibana role list 'apache' as a dependency in its
meta/main.yml, it will be able to see that var and use it.
Another way is to explicitly set a 'global' (play wide or host wide,
point is its set external to the roles ) vhost_conf_dir and have each
role use it (that's less 'magical' so personally I prefer it, it's
easier to see what's going on).
One downside is the 'kibana' role needs handlers to restart the
webserver, which is a bit ugly.
Either way, you're going to have 2 roles that are co-dependant and not
too re-usable. That would
still be the case if you had the exact feature you describe, of course.
I'm of the opinion that 'role reuse' is a wild goose chase in CM
systems, so I'm fine with that :)