<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mjs10:ansible_test mspreitz$ ansible --version
ansible 2.1.0.0
  config file = 
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">mjs10:ansible_test mspreitz$ ansible --version
ansible 2.1.0.0
  config file = 
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">No special configuration is involved.</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">I have been testing in MacOS 10.10.5.</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">If a playbook includes another playbook and then invokes a role, and the included playbook is from a different directory, then the role will not be sought in the right directories.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Use the attached zip archive, the quote below shows how.<br>
<a href="https://github.com/ansible/ansible/files/338050/ansible_test.zip">ansible_test.zip</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mjs10:Desktop mspreitz$ unzip ansible_test.zip 
Archive:  ansible_test.zip
   creating: ansible_test/
  inflating: ansible_test/.DS_Store  
   creating: ansible_test/foo/
  inflating: ansible_test/foo/preplays.yml  
   creating: ansible_test/roles/
   creating: ansible_test/roles/role1/
   creating: ansible_test/roles/role1/tasks/
 extracting: ansible_test/roles/role1/tasks/main.yml  
  inflating: ansible_test/site.yml   
mjs10:Desktop mspreitz$ cd ansible_test
mjs10:ansible_test mspreitz$ ansible-playbook site.yml 
ERROR! the role 'role1' was not found in /Users/mspreitz/Desktop/ansible_test/foo/roles:/Users/mspreitz/Desktop/ansible_test/foo:/etc/ansible/roles

The error appears to have been in '/Users/mspreitz/Desktop/ansible_test/site.yml': line 6, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  roles:
  - role1
    ^ here
"><pre class="notranslate"><code class="notranslate">mjs10:Desktop mspreitz$ unzip ansible_test.zip 
Archive:  ansible_test.zip
   creating: ansible_test/
  inflating: ansible_test/.DS_Store  
   creating: ansible_test/foo/
  inflating: ansible_test/foo/preplays.yml  
   creating: ansible_test/roles/
   creating: ansible_test/roles/role1/
   creating: ansible_test/roles/role1/tasks/
 extracting: ansible_test/roles/role1/tasks/main.yml  
  inflating: ansible_test/site.yml   
mjs10:Desktop mspreitz$ cd ansible_test
mjs10:ansible_test mspreitz$ ansible-playbook site.yml 
ERROR! the role 'role1' was not found in /Users/mspreitz/Desktop/ansible_test/foo/roles:/Users/mspreitz/Desktop/ansible_test/foo:/etc/ansible/roles

The error appears to have been in '/Users/mspreitz/Desktop/ansible_test/site.yml': line 6, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  roles:
  - role1
    ^ here

</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">With 1.9, and the latest devel sources, it goes like this:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mjs10:ansible_test mspreitz$ ansible --version
ansible 2.2.0 (devel e04d552bc6) last updated 2016/06/28 15:57:48 (GMT -400)
  lib/ansible/modules/core: (detached HEAD 3c6f2c2db1) last updated 2016/06/28 15:59:09 (GMT -400)
  lib/ansible/modules/extras: (detached HEAD 1c36665545) last updated 2016/06/28 15:59:16 (GMT -400)
  config file = 
  configured module search path = Default w/o overrides
mjs10:ansible_test mspreitz$ 
mjs10:ansible_test mspreitz$ 
mjs10:ansible_test mspreitz$ ansible-playbook site.yml 

PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;Preplay here&quot;
}

PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [role1 : debug] ***********************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;role1 here&quot;
}

PLAY RECAP *********************************************************************
localhost                  : ok=4    changed=0    unreachable=0    failed=0   "><pre class="notranslate"><code class="notranslate">mjs10:ansible_test mspreitz$ ansible --version
ansible 2.2.0 (devel e04d552bc6) last updated 2016/06/28 15:57:48 (GMT -400)
  lib/ansible/modules/core: (detached HEAD 3c6f2c2db1) last updated 2016/06/28 15:59:09 (GMT -400)
  lib/ansible/modules/extras: (detached HEAD 1c36665545) last updated 2016/06/28 15:59:16 (GMT -400)
  config file = 
  configured module search path = Default w/o overrides
mjs10:ansible_test mspreitz$ 
mjs10:ansible_test mspreitz$ 
mjs10:ansible_test mspreitz$ ansible-playbook site.yml 

PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [debug] *******************************************************************
ok: [localhost] =&gt; {
    "msg": "Preplay here"
}

PLAY [localhost] ***************************************************************

TASK [setup] *******************************************************************
ok: [localhost]

TASK [role1 : debug] ***********************************************************
ok: [localhost] =&gt; {
    "msg": "role1 here"
}

PLAY RECAP *********************************************************************
localhost                  : ok=4    changed=0    unreachable=0    failed=0   
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="mjs10:ansible_test mspreitz$ ansible-playbook -vvvv site.yml 
No config file found; using defaults
ERROR! the role 'role1' was not found in /Users/mspreitz/Desktop/ansible_test/foo/roles:/Users/mspreitz/Desktop/ansible_test/foo:/etc/ansible/roles

The error appears to have been in '/Users/mspreitz/Desktop/ansible_test/site.yml': line 6, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  roles:
  - role1
    ^ here"><pre class="notranslate"><code class="notranslate">mjs10:ansible_test mspreitz$ ansible-playbook -vvvv site.yml 
No config file found; using defaults
ERROR! the role 'role1' was not found in /Users/mspreitz/Desktop/ansible_test/foo/roles:/Users/mspreitz/Desktop/ansible_test/foo:/etc/ansible/roles

The error appears to have been in '/Users/mspreitz/Desktop/ansible_test/site.yml': line 6, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  roles:
  - role1
    ^ here
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.1.0.0 (detached HEAD 036547b4dd) last updated 2016/05/19 15:27:19 (GMT -400)
  lib/ansible/modules/core: (detached HEAD 297710c37e) last updated 2016/05/19 15:28:19 (GMT -400)
  lib/ansible/modules/extras: (detached HEAD fa00795662) last updated 2016/05/19 15:28:19 (GMT -400)
  config file =
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.1.0.0 (detached HEAD 036547b4dd) last updated 2016/05/19 15:27:19 (GMT -400)
  lib/ansible/modules/core: (detached HEAD 297710c37e) last updated 2016/05/19 15:28:19 (GMT -400)
  lib/ansible/modules/extras: (detached HEAD fa00795662) last updated 2016/05/19 15:28:19 (GMT -400)
  config file =
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto"><code class="notranslate">playbook_dir</code> is not getting reset across multiple <code class="notranslate">- include:</code> invocations</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=".
├── child
│   ├── child.yml
│   └── sibling.yml
├── parent1.yml
└── parent2.yml

# child.yml

---
- include: &quot;{{ playbook_dir }}/sibling.yml&quot;
- include: &quot;{{ playbook_dir }}/../parent1.yml&quot;
- include: &quot;{{ playbook_dir }}/../parent2.yml&quot;"><pre class="notranslate"><code class="notranslate">.
├── child
│   ├── child.yml
│   └── sibling.yml
├── parent1.yml
└── parent2.yml

# child.yml

---
- include: "{{ playbook_dir }}/sibling.yml"
- include: "{{ playbook_dir }}/../parent1.yml"
- include: "{{ playbook_dir }}/../parent2.yml"
</code></pre></div>
<p dir="auto"><code class="notranslate">ansible-playbook child.yml</code></p>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">For all playbooks to be successfully included and ran.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ERROR! the file_name '/Users/meyers/ansible/examples/bugs/parent2.yml' does not exist, or is not readable"><pre class="notranslate"><code class="notranslate">ERROR! the file_name '/Users/meyers/ansible/examples/bugs/parent2.yml' does not exist, or is not readable
</code></pre></div>