# role dependencies with 'diamond' pattern

**URL:** <https://forum.ansible.com/t/role-dependencies-with-diamond-pattern/13376>\
**Category:** Ansible Project\
**Created:** [August 28, 2013, 9:19am UTC](https://forum.ansible.com/t/role-dependencies-with-diamond-pattern/13376 "2013-08-28T09:19:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nick](https://avatars.discourse-cdn.com/v4/letter/n/f9ae1b/32.png) [@Nick](https://forum.ansible.com/u/Nick)\
**Post date:** [August 28, 2013, 9:19am UTC](https://forum.ansible.com/t/role-dependencies-with-diamond-pattern/13376/1 "2013-08-28T09:19:29Z")

</div>

Hi,

A hopefully quick question about dependencies which I couldn't see answered in the current docs.

Given the classic 'diamond inheritance' kind of pattern, i.e

&nbsp;&nbsp;&nbsp;A requires B and C  
&nbsp;&nbsp;&nbsp;B requires D  
&nbsp;&nbsp;&nbsp;C requires D

Without parameters, does the role D get invoked once or twice? And what about if A, B C or D are invoked with (different) parameters?

I haven't had the time to create a test case so far which is mainly why I'm asking, but in any case, but it'd be nice to know: what is the intended behaviour, and is it likely to change?

Thanks,

N

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [August 28, 2013, 10:10am UTC](https://forum.ansible.com/t/role-dependencies-with-diamond-pattern/13376/2 "2013-08-28T10:10:47Z")

</div>

Right now, d would be run twice with one instance getting variables set from b and other with variables from c, so you end up with more of a fork than a diamond.

We have discussed adding a flag for roles that would mark them as unique so the are never included/depended more than once, but that would be a 1.4 feature at the earliest.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [August 28, 2013, 1:56pm UTC](https://forum.ansible.com/t/role-dependencies-with-diamond-pattern/13376/3 "2013-08-28T13:56:58Z")

</div>

I’d actually like to see this in 1.3 as I think it’s going to come up frequently enough.

I think “once: True” would be a sufficient syntax in the parameters.

–Michael
