# allow\_duplicates does not appear to be working in my use case

**URL:** <https://forum.ansible.com/t/allow-duplicates-does-not-appear-to-be-working-in-my-use-case/15924>\
**Category:** Ansible Project\
**Created:** [August 12, 2014, 5:09pm UTC](https://forum.ansible.com/t/allow-duplicates-does-not-appear-to-be-working-in-my-use-case/15924 "2014-08-12T17:09:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Martin](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Andrew\_Martin](https://forum.ansible.com/u/Andrew_Martin)\
**Post date:** [August 12, 2014, 5:09pm UTC](https://forum.ansible.com/t/allow-duplicates-does-not-appear-to-be-working-in-my-use-case/15924/1 "2014-08-12T17:09:24Z")

</div>

Hello,

See [https://github.com/ansible/ansible/issues/8559](https://github.com/ansible/ansible/issues/8559) for additional details, but in brief I have 3 roles:

roles/apache2/meta/main.yml:

> * * *
> 
> allow\_duplicates: yes

roles/apache2-php/meta/main.yml:

> * * *
> 
> allow\_duplicates: yes  
> dependencies:
> 
> - { role: apache2 }

roles/apache2-ssl/meta/main.yml:

> * * *

> allow\_duplicates: yes

> dependencies:
> 
> - { role: apache2-php, when: include\_php == True }
> - { role: apache2, when: include\_php == False }

I would like to be able to use the apache2-ssl role in a playbook and have it recursively call the apache2-php and apache2 dependent roles. This works for the most part, except with handlers in the base apache2 role. Even with allow\_duplicates: yes everywhere, when I call the apache2-ssl role with include\_php == False, the “reload apache” handler still gets skipped:

excerpt from roles/apache2/tasks/main.yml:

> - name: copy apache configuration (12.04)  
> template: src=000-default.j2 dest=/etc/apache2/sites-enabled/000-default  
> when: ansible\_distribution\_version == “12.04”  
> notify: reload apache2

excerpt from roles/apache2/handlers/main.yml:

> - name: reload apache2  
> service: name=apache2 state=reloaded enabled=true

The handler is NOTIFIED, but skipped:

> NOTIFIED: [apache2 | reload apache2] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
> skipping: [apachetest]

I think this occurs because the first dependent role, apache2-php, is skipped because include\_php is False. It then recusively marks all tasks and handlers in apache2-php and apache2 as skipped, and then when it goes to apache2 a second time (when it hits the second dependent role), it is already marked as skipped and so the handler doesn’t execute. Any ideas on what is going on here, and how to fix it?

Thanks!

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 12, 2014, 6:33pm UTC](https://forum.ansible.com/t/allow-duplicates-does-not-appear-to-be-working-in-my-use-case/15924/2 "2014-08-12T18:33:07Z")

</div>

So the first thing I notice is this ticket was filed on 1.6.2.

The current released version of Ansible is 1.7.0, have you checked on the latest?

Not saying this is not a thing, but would save us time and we’d appreciate the updated report.

Thanks!

---

<div class="post-metadata">

**Author:** ![Andrew\_Martin](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Andrew\_Martin](https://forum.ansible.com/u/Andrew_Martin)\
**Post date:** [August 18, 2014, 7:20pm UTC](https://forum.ansible.com/t/allow-duplicates-does-not-appear-to-be-working-in-my-use-case/15924/3 "2014-08-18T19:20:22Z")

</div>

I tried this test again after upgrading to 1.7 and the behavior is the same: the task is listed as changed and the handler as NOTIFIED, but it is skipped

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [August 19, 2014, 6:36pm UTC](https://forum.ansible.com/t/allow-duplicates-does-not-appear-to-be-working-in-my-use-case/15924/4 "2014-08-19T18:36:49Z")

</div>

Ok, good deal, thanks for checking on the latest - can you please file a github ticket on this one?

Thanks!

---

<div class="post-metadata">

**Author:** ![Andrew\_Martin](https://avatars.discourse-cdn.com/v4/letter/a/77aa72/32.png) [@Andrew\_Martin](https://forum.ansible.com/u/Andrew_Martin)\
**Post date:** [August 19, 2014, 7:26pm UTC](https://forum.ansible.com/t/allow-duplicates-does-not-appear-to-be-working-in-my-use-case/15924/5 "2014-08-19T19:26:38Z")

</div>

Filed here, thanks!  
[https://github.com/ansible/ansible/issues/8684](https://github.com/ansible/ansible/issues/8684)
