<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">template_module</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.2.1.0"><pre class="notranslate"><code class="notranslate">ansible 2.2.1.0
</code></pre></div>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">When <strong>Role Includes the Role</strong>, the template module browse the incorrect path looking for a template file</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[run with -vvvvv to see the paths]

TASK [app_campaigns_manager : Ensure service configuration] ********************
task path: /home/me/ansible/etc/playbooks/roles/app_generic/tasks/service.yml:1
looking for &quot;upstart.conf&quot; at &quot;/home/me/ansible/etc/playbooks/roles/app_campaigns_manager/templates/upstart.conf&quot;
looking for &quot;upstart.conf&quot; at &quot;/home/me/ansible/etc/playbooks/roles/app_campaigns_manager/upstart.conf&quot;
looking for &quot;upstart.conf&quot; at &quot;/home/me/ansible/etc/playbooks/roles/app_generic/tasks/templates/upstart.conf&quot;  &lt;&lt;&lt; TASKS?
looking for &quot;upstart.conf&quot; at &quot;/home/me/ansible/etc/playbooks/roles/app_generic/tasks/upstart.conf&quot;
looking for &quot;upstart.conf&quot; at &quot;/home/me/ansible/etc/playbooks/templates/upstart.conf&quot;
looking for &quot;upstart.conf&quot; at &quot;/home/me/ansible/etc/playbooks/upstart.conf&quot;"><pre class="notranslate"><code class="notranslate">[run with -vvvvv to see the paths]

TASK [app_campaigns_manager : Ensure service configuration] ********************
task path: /home/me/ansible/etc/playbooks/roles/app_generic/tasks/service.yml:1
looking for "upstart.conf" at "/home/me/ansible/etc/playbooks/roles/app_campaigns_manager/templates/upstart.conf"
looking for "upstart.conf" at "/home/me/ansible/etc/playbooks/roles/app_campaigns_manager/upstart.conf"
looking for "upstart.conf" at "/home/me/ansible/etc/playbooks/roles/app_generic/tasks/templates/upstart.conf"  &lt;&lt;&lt; TASKS?
looking for "upstart.conf" at "/home/me/ansible/etc/playbooks/roles/app_generic/tasks/upstart.conf"
looking for "upstart.conf" at "/home/me/ansible/etc/playbooks/templates/upstart.conf"
looking for "upstart.conf" at "/home/me/ansible/etc/playbooks/upstart.conf"
</code></pre></div>
<p dir="auto">The correct path is:<br>
<code class="notranslate">/home/me/ansible/etc/playbooks/roles/app_generic/templates/upstart.conf</code></p>
<h5 dir="auto">Observation</h5>
<p dir="auto">The problem happen, because the playbook include the role that include the role:<br>
<code class="notranslate">playbook -&gt; role: app_campaigns_manager -&gt; role: app_generic</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="playbook.yml
(...)
 roles: app_campaigns_manager 


roles/app_campaigns_manager/tasks/main.yml
(...)
- include: ../../app_so1_generic/tasks/main.yml
"><pre class="notranslate"><code class="notranslate">playbook.yml
(...)
 roles: app_campaigns_manager 


roles/app_campaigns_manager/tasks/main.yml
(...)
- include: ../../app_so1_generic/tasks/main.yml

</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Browse the proper files :)</p>
<p dir="auto">I know the template_module has 'template_path' and 'template_fullpath', but still it would be nice it the roles would be aware of it's location independent of it's include/execution.</p>
<hr>
<p dir="auto">I may take a minute later, to prepare PR, but having rather busy time, so any help appreciated.</p>
<p dir="auto">Consider this <a href="https://github.com/jhermann/jhermann.github.io/wiki/Ansible#installing-a-pre-release-version">command sequence to install the release candidate</a>.<br>
When I don't do the <code class="notranslate">setup.py</code> fix, I get the import error (see below), else I don't.<br>
Any reason you have the version with the explicit package name?</p>
<div class="highlight highlight-source-shell notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="$ ansible --version
Traceback (most recent call last):
  File &quot;…/.venv/ansible/bin/ansible&quot;, line 7, in &lt;module&gt;
    execfile(__file__)
  File &quot;…/bin/ansible&quot;, line 36, in &lt;module&gt;
    from ansible.runner import Runner
ImportError: No module named ansible.runner
$ sed -i~ -r -e &quot;s~'ansible': 'lib/ansible'~'': 'lib'~&quot; setup.py
$ python setup.py develop -U
…
$ ansible --version
ansible 1.9.0 (detached HEAD bce4bb2ce2) last updated 2015/03/11 23:41:25 (GMT +200)
…"><pre class="notranslate">$ ansible --version
Traceback (most recent call last):
  File <span class="pl-s"><span class="pl-pds">"</span>…/.venv/ansible/bin/ansible<span class="pl-pds">"</span></span>, line 7, <span class="pl-k">in</span> <span class="pl-k">&lt;</span>module<span class="pl-k">&gt;</span>
    execfile(__file__)
  File <span class="pl-s"><span class="pl-pds">"</span>…/bin/ansible<span class="pl-pds">"</span></span>, line 36, <span class="pl-k">in</span> <span class="pl-k">&lt;</span>module<span class="pl-k">&gt;</span>
    from ansible.runner import Runner
ImportError: No module named ansible.runner
$ sed -i~ -r -e <span class="pl-s"><span class="pl-pds">"</span>s~'ansible': 'lib/ansible'~'': 'lib'~<span class="pl-pds">"</span></span> setup.py
$ python setup.py develop -U
…
$ ansible --version
ansible 1.9.0 (detached HEAD bce4bb2ce2) last updated 2015/03/11 23:41:25 (GMT +200)
…</pre></div>
<p dir="auto">Also, a <code class="notranslate">test-requirements.txt</code> for <code class="notranslate">pip</code> would be helpful. If you agree, I can do a PR for both.</p>