<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">dependency</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.1.3.0
  config file =
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.1.3.0
  config file =
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">default configuration without any changes</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">N/A (tested on Mac and Windows)</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Variables that get available by using dependencies in <code class="notranslate">meta</code>-information of a role do not propagate their variables correctly if they got set during inclusion of the role.</p>
<p dir="auto">I have not found anything in the changelog or documentation stating that this is now changed and correct behaviour, so I assume that it is a bug.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">One has two roles, one base-role and one role that will be used as a dependency role in the base role:</p>
<h6 dir="auto">example-role</h6>
<p dir="auto"><code class="notranslate">meta/main.yml</code></p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---

dependencies:
  - role: dependency-role
    base_path: &quot;/another/base&quot;"><pre class="notranslate">---

<span class="pl-ent">dependencies</span>:
  - <span class="pl-ent">role</span>: <span class="pl-s">dependency-role</span>
    <span class="pl-ent">base_path</span>: <span class="pl-s"><span class="pl-pds">"</span>/another/base<span class="pl-pds">"</span></span></pre></div>
<p dir="auto"><code class="notranslate">tasks/main.yml</code></p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---

- name: show example role ouput
  debug: 
    msg: &quot;base_path={{ base_path }}, detailled_path={{ detailled_path }}&quot;"><pre class="notranslate">---

- <span class="pl-ent">name</span>: <span class="pl-s">show example role ouput</span>
  <span class="pl-ent">debug</span>: 
    <span class="pl-ent">msg</span>: <span class="pl-s"><span class="pl-pds">"</span>base_path={{ base_path }}, detailled_path={{ detailled_path }}<span class="pl-pds">"</span></span></pre></div>
<h6 dir="auto">dependency-role</h6>
<p dir="auto"><code class="notranslate">vars/main.yml</code></p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---

base_path: &quot;/some/base/path&quot;

detailled_path: &quot;{{ base_path }}/detailed&quot;"><pre class="notranslate">---

<span class="pl-ent">base_path</span>: <span class="pl-s"><span class="pl-pds">"</span>/some/base/path<span class="pl-pds">"</span></span>

<span class="pl-ent">detailled_path</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ base_path }}/detailed<span class="pl-pds">"</span></span></pre></div>
<p dir="auto"><code class="notranslate">tasks/main.yml</code></p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---

- name: show example role ouput
  debug: 
    msg: &quot;base_path={{ base_path }}, detailled_path={{ detailled_path }}&quot;"><pre class="notranslate">---

- <span class="pl-ent">name</span>: <span class="pl-s">show example role ouput</span>
  <span class="pl-ent">debug</span>: 
    <span class="pl-ent">msg</span>: <span class="pl-s"><span class="pl-pds">"</span>base_path={{ base_path }}, detailled_path={{ detailled_path }}<span class="pl-pds">"</span></span></pre></div>
<h6 dir="auto">playbook</h6>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="---

- hosts: localhost
  gather_facts: no
  connection: local
  become: no
  roles:
    - dependency-role
    - example-role"><pre class="notranslate">---

- <span class="pl-ent">hosts</span>: <span class="pl-s">localhost</span>
  <span class="pl-ent">gather_facts</span>: <span class="pl-s">no</span>
  <span class="pl-ent">connection</span>: <span class="pl-s">local</span>
  <span class="pl-ent">become</span>: <span class="pl-s">no</span>
  <span class="pl-ent">roles</span>:
    - <span class="pl-s">dependency-role</span>
    - <span class="pl-s">example-role</span></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">As of Ansible 2.0.2.0, the variable adjusted by including the dependency-role is available in the example-role after solving the dependency:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="No config file found; using defaults

PLAYBOOK: play.yml *************************************************************
1 plays in play.yml

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

TASK [dependency-role : Show dependency debut output] **************************
task path: /Users/stli/projects/ansible-test/roles/dependency-role/tasks/main.yml:3
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;base_path=/some/base/path, detailled_path=/some/base/path/detailed&quot;
}

TASK [dependency-role : Show dependency debut output] **************************
task path: /Users/stli/projects/ansible-test/roles/dependency-role/tasks/main.yml:3
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;base_path=/another/base, detailled_path=/another/base/detailed&quot;
}

TASK [example-role : show example role ouput] **********************************
task path: /Users/stli/projects/ansible-test/roles/example-role/tasks/main.yml:3
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;base_path=/another/base, detailled_path=/another/base/detailed&quot;
}

PLAY RECAP *********************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0   "><pre class="notranslate"><code class="notranslate">No config file found; using defaults

PLAYBOOK: play.yml *************************************************************
1 plays in play.yml

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

TASK [dependency-role : Show dependency debut output] **************************
task path: /Users/stli/projects/ansible-test/roles/dependency-role/tasks/main.yml:3
ok: [localhost] =&gt; {
    "msg": "base_path=/some/base/path, detailled_path=/some/base/path/detailed"
}

TASK [dependency-role : Show dependency debut output] **************************
task path: /Users/stli/projects/ansible-test/roles/dependency-role/tasks/main.yml:3
ok: [localhost] =&gt; {
    "msg": "base_path=/another/base, detailled_path=/another/base/detailed"
}

TASK [example-role : show example role ouput] **********************************
task path: /Users/stli/projects/ansible-test/roles/example-role/tasks/main.yml:3
ok: [localhost] =&gt; {
    "msg": "base_path=/another/base, detailled_path=/another/base/detailed"
}

PLAY RECAP *********************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0   
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">In Ansible 2.1.3.0 (also tested in 2.1.0.0 - 2.1.2.0), the variable will use its defaults afterwards, without taking the included variable in account</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="No config file found; using defaults

PLAYBOOK: play.yml *************************************************************
1 plays in play.yml

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

TASK [dependency-role : Show dependency debut output] **************************
task path: /Users/stli/projects/ansible-test/roles/dependency-role/tasks/main.yml:3
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;base_path=/some/base/path, detailled_path=/some/base/path/detailed&quot;
}

TASK [dependency-role : Show dependency debut output] **************************
task path: /Users/stli/projects/ansible-test/roles/dependency-role/tasks/main.yml:3
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;base_path=/another/base, detailled_path=/another/base/detailed&quot;
}

TASK [example-role : show example role ouput] **********************************
task path: /Users/stli/projects/ansible-test/roles/example-role/tasks/main.yml:3
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;base_path=/some/base/path, detailled_path=/some/base/path/detailed&quot;
}

PLAY RECAP *********************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0   "><pre class="notranslate"><code class="notranslate">No config file found; using defaults

PLAYBOOK: play.yml *************************************************************
1 plays in play.yml

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

TASK [dependency-role : Show dependency debut output] **************************
task path: /Users/stli/projects/ansible-test/roles/dependency-role/tasks/main.yml:3
ok: [localhost] =&gt; {
    "msg": "base_path=/some/base/path, detailled_path=/some/base/path/detailed"
}

TASK [dependency-role : Show dependency debut output] **************************
task path: /Users/stli/projects/ansible-test/roles/dependency-role/tasks/main.yml:3
ok: [localhost] =&gt; {
    "msg": "base_path=/another/base, detailled_path=/another/base/detailed"
}

TASK [example-role : show example role ouput] **********************************
task path: /Users/stli/projects/ansible-test/roles/example-role/tasks/main.yml:3
ok: [localhost] =&gt; {
    "msg": "base_path=/some/base/path, detailled_path=/some/base/path/detailed"
}

PLAY RECAP *********************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0   
</code></pre></div>
<p dir="auto">The whole test can be found in a <a href="https://github.com/stehefan/ansible-dependency-bug-report">repo of mine</a>, including the output of the different versions I tried this with.</p>
<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="Commit 3b69ef7e8b34d736770aed8f2b31cfec522ed2d8"><pre class="notranslate"><code class="notranslate">Commit 3b69ef7e8b34d736770aed8f2b31cfec522ed2d8
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">Ansible from Source (since commit <a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/ansible/ansible/commit/33de7707c9027ace26ec62bff8f58717f4080538/hovercard" href="https://github.com/ansible/ansible/commit/33de7707c9027ace26ec62bff8f58717f4080538"><tt>33de770</tt></a> ) and dependencies with pip</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Docker Image library/jenkins:1.651.1 with Ansible from Source</p>
<p dir="auto">Also Ubuntu 16.04</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Ansible is confused by passing dictionaries through nested role dependencie calls. See steps to reproduce and expected/actual results for explanation.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">The following files will demonstrate the bug and are also available for download at <a href="https://github.com/ThomasSteinbach/ansible_bug_15996">https://github.com/ThomasSteinbach/ansible_bug_15996</a></p>
<p dir="auto">Playbooks <code class="notranslate">site.yml</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="roles:
  - role: testone
    onevar: onevarcontent"><pre class="notranslate"><code class="notranslate">roles:
  - role: testone
    onevar: onevarcontent
</code></pre></div>
<p dir="auto"><code class="notranslate">testone/meta/main.yml</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="dependencies:
  - role: testtwo
    initial:
      ONE: &quot;{{ onevar }}&quot;
      TWO: zwei"><pre class="notranslate"><code class="notranslate">dependencies:
  - role: testtwo
    initial:
      ONE: "{{ onevar }}"
      TWO: zwei
</code></pre></div>
<p dir="auto"><code class="notranslate">testtwo/meta/main.yml</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="dependencies:
  - role: testthree
    inside_var: &quot;{{ initial.ONE }}&quot;"><pre class="notranslate"><code class="notranslate">dependencies:
  - role: testthree
    inside_var: "{{ initial.ONE }}"
</code></pre></div>
<p dir="auto"><code class="notranslate">testthree/tasks/main.yml</code>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- include: test.yml"><pre class="notranslate"><code class="notranslate">- include: test.yml
</code></pre></div>
<p dir="auto"><code class="notranslate">testthree/tasks/test.yml</code></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- debug: msg=&quot;everythingsfine&quot;
  when: &quot;{{ inside_var == 'onevarcontent' }}&quot;"><pre class="notranslate"><code class="notranslate">- debug: msg="everythingsfine"
  when: "{{ inside_var == 'onevarcontent' }}"
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Ansible 2.0.2.0 installed with pip behaves like expected:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [this playbook is for testing purposes] ***********************************

TASK [testthree : include] *****************************************************
included: /home/uid1000/ansible/ansible_playbooks/test/roles/testthree/tasks/test.yml for localhost

TASK [testthree : debug] *******************************************************
ok: [localhost] =&gt; {
    &quot;msg&quot;: &quot;everythingsfine&quot;
}"><pre class="notranslate"><code class="notranslate">PLAY [this playbook is for testing purposes] ***********************************

TASK [testthree : include] *****************************************************
included: /home/uid1000/ansible/ansible_playbooks/test/roles/testthree/tasks/test.yml for localhost

TASK [testthree : debug] *******************************************************
ok: [localhost] =&gt; {
    "msg": "everythingsfine"
}
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">The latest Ansible version from source seems to be broken and leads to following result:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [this playbook is for testing purposes] ***********************************

TASK [testthree : include] *****************************************************
included: /var/jenkins_home/workspace/develop/xarifP/test/roles/testthree/tasks/test.yml for acia.vm

TASK [testthree : debug] *******************************************************
fatal: [acia.vm]: FAILED! =&gt; {&quot;failed&quot;: true, &quot;msg&quot;: &quot;The conditional check '{{ inside_var == 'onevarcontent' }}' failed. The error was: error while evaluating conditional ({{ inside_var == 'onevarcontent' }}): {{ initial.ONE }}: 'initial' is undefined\n\nThe error appears to have been in '/var/jenkins_home/workspace/develop/xarifP/test/roles/testthree/tasks/test.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- debug: msg=\&quot;everythingsfine\&quot;\n  ^ here\n&quot;}"><pre class="notranslate"><code class="notranslate">PLAY [this playbook is for testing purposes] ***********************************

TASK [testthree : include] *****************************************************
included: /var/jenkins_home/workspace/develop/xarifP/test/roles/testthree/tasks/test.yml for acia.vm

TASK [testthree : debug] *******************************************************
fatal: [acia.vm]: FAILED! =&gt; {"failed": true, "msg": "The conditional check '{{ inside_var == 'onevarcontent' }}' failed. The error was: error while evaluating conditional ({{ inside_var == 'onevarcontent' }}): {{ initial.ONE }}: 'initial' is undefined\n\nThe error appears to have been in '/var/jenkins_home/workspace/develop/xarifP/test/roles/testthree/tasks/test.yml': line 2, column 3, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n---\n- debug: msg=\"everythingsfine\"\n  ^ here\n"}
</code></pre></div>