<p dir="auto">The bug  <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="46037935" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/9362" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/9362/hovercard" href="https://github.com/ansible/ansible/issues/9362">#9362</a> is available.</p>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">templar</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<ul dir="auto">
<li>Ansible: 2.4.3.0
<ul dir="auto">
<li>python version = 3.6.2 |Anaconda custom (64-bit)| (default, Jul 20 2017, 13:14:59) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)]</li>
</ul>
</li>
</ul>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="x: 0
a:
  b: 1
s:
  t:
    u: 2"><pre class="notranslate"><span class="pl-ent">x</span>: <span class="pl-c1">0</span>
<span class="pl-ent">a</span>:
  <span class="pl-ent">b</span>: <span class="pl-c1">1</span>
<span class="pl-ent">s</span>:
  <span class="pl-ent">t</span>:
    <span class="pl-ent">u</span>: <span class="pl-c1">2</span></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [debug] ********************************************************************************************************************************
ok: [local] =&gt; {
    &quot;x&quot;: 0
}

TASK [debug] ********************************************************************************************************************************
ok: [local] =&gt; {
    &quot;a.b&quot;: &quot;1&quot;
}

TASK [debug] ********************************************************************************************************************************
ok: [local] =&gt; {
    &quot;s.t.u&quot;: &quot;2&quot;
}"><pre class="notranslate"><code class="notranslate">TASK [debug] ********************************************************************************************************************************
ok: [local] =&gt; {
    "x": 0
}

TASK [debug] ********************************************************************************************************************************
ok: [local] =&gt; {
    "a.b": "1"
}

TASK [debug] ********************************************************************************************************************************
ok: [local] =&gt; {
    "s.t.u": "2"
}
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<h5 dir="auto">SUMMARY</h5>
<h5 dir="auto">EXPECTED RESULTS</h5>
<h5 dir="auto">Issue Type: Bug Report</h5>
<h5 dir="auto">Ansible Version: 1.9.0.1</h5>
<h5 dir="auto">Environment: Ubuntu 14.04</h5>
<h5 dir="auto">Summary:</h5>
<p dir="auto">When 2 roles using the same transitive dependency (more than 1 level deep) are applied to a single host, the transitive dependency is applied only once.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<p dir="auto">I have 4 roles:</p>
<ol dir="auto">
<li>
<p dir="auto"><code class="notranslate">postgresql_third_party</code> : from Ansible Galaxy, install and configure an instance of PostgreSQL</p>
</li>
<li>
<p dir="auto"><code class="notranslate">roles/postgresql_commons/meta/main.yml</code> : commons settings for my projects</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# allow_duplicates: yes
dependencies:
  - postgresql_third_party"><pre class="notranslate"><code class="notranslate"># allow_duplicates: yes
dependencies:
  - postgresql_third_party
</code></pre></div>
</li>
<li>
<p dir="auto"><code class="notranslate">roles/postgresql_db1/meta/main.yml</code>: creates a database named DB1</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# allow_duplicates: yes
dependencies:
  - { role: postgresql_commons, db_name: DB1 }"><pre class="notranslate"><code class="notranslate"># allow_duplicates: yes
dependencies:
  - { role: postgresql_commons, db_name: DB1 }
</code></pre></div>
</li>
<li>
<p dir="auto"><code class="notranslate">roles/postgresql_db2/meta/main.yml</code>: creates a database named DB2</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# allow_duplicates: yes
dependencies:
  - { role: postgresql_commons, db_name: DB2 }"><pre class="notranslate"><code class="notranslate"># allow_duplicates: yes
dependencies:
  - { role: postgresql_commons, db_name: DB2 }
</code></pre></div>
</li>
</ol>
<p dir="auto">Enabling or disabling <code class="notranslate">allow_duplicate</code> does not change anything when executing the playbook:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- name : Install multiple DB on a single instance of PostgreSQL
  hosts: db
  sudo: true
  roles:
    - postgresql_db1
    - postgresql_db2"><pre class="notranslate"><code class="notranslate">- name : Install multiple DB on a single instance of PostgreSQL
  hosts: db
  sudo: true
  roles:
    - postgresql_db1
    - postgresql_db2
</code></pre></div>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">I would expect that the third party role is executed twice, once for DB1 and the other for DB2. The end result would be the creation of the 2 databases.</p>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto">The role is applied only once. Only the first database is created.</p>