Relative Search Paths

As of 1.6.2 (yes, not quite current, though I did not see anything in the changelog that addressed this), when using roles, each role is called relative to its own directory.

E.g.

playbook1.yml :

I’m having trouble parsing this one, sorry.

Would it be possible to see a git repo or something for this ticket that minimally reproduces the question?

It might take me a few days yet, but I will try to create a minimalist one that shows what I am talking about.

Please make sure you check out the README as I believe I not only better explain the “problem” but note ways I could make it work with the existing Ansible (things I hadn’t realized when I made this request).

Basically, this is a pretty specific request to slightly expand functionality and is probably not worth the time-investment.

But, since I promised it, here is a github where you can see a skinned down example: https://github.com/rayvenshire/Ansible/tree/master/relative_search_paths_3j0SYZN4r3Q

You lost me on sentence #2 about inheritance, as I’m unclear how inheritance applies to directories.

“It would be nice if one role could inherit another’s directory structure.”

Looking at the two YAML files, I see both “broken” and “working” contain the same playbook basically:

Gmail sent this email early, one sec while I finish it :slight_smile:

Basically my question is

(A) how is “broken” different from “working” in your two examples?

If I try to step back to the higher level, I think this may be saying something like “if role dependencies are used, look for files also in the paths the dependent role might be”?

Though I’m having trouble fitting a use case to that one. (Also, role deps were never meant to be an inheritance mechanism, they are a dependency mechanism - run this before that).

“Broken” and “working” are exactly the same except that the certificate that “working” uses is within the apache2-ssl directory structure (i.e. roles/apache2/files/external.crt) whereas “broken” has its own certificate in its own directory structure (i.e. roles/servers/broken/files/IN_MY_DIRECTORY.crt) . This is the only difference in this example.

While technically I did not setup role dependencies (according to documentation http://docs.ansible.com/playbooks_roles.html#role-dependencies), that is in an essence how I am using the apache-ssl playbook in this example. And I believe you have accurately stated what I attempted to by taking a step back, let me restate it and make sure we understand each other: “for each role (r) that is listed as a dependency of some other role (x), when running that role (r), prioritize files provided by role (x)”.

The use cases are for when a file would have to be so different from the generic template that it could not be easily mangled or assembled using current modules or that each instance of that file is unique such that no template exists. So in my example, “external.crt” and “IN_MY_DIRECTORY.crt” are two completely different SSL certificates. They have no relation to each other (except that they are SSL certificates), and no relation to the generic apache-ssl playbook because they are server specific certificates.

Yes, I do agree that it is odd for a dependency to “inherit” the dependent’s directory structure.

As I mentioned in the readme, there are sufficiently valid ways to cope with this problem, so if this is too odd, pointless or “un-Ansible-like”, it won’t stop my setup :slight_smile: