# \[WARNING\]: flush\_handlers task does not support when conditional

**URL:** <https://forum.ansible.com/t/warning-flush-handlers-task-does-not-support-when-conditional/30547>\
**Category:** Ansible Project\
**Created:** [June 12, 2019, 3:47pm UTC](https://forum.ansible.com/t/warning-flush-handlers-task-does-not-support-when-conditional/30547 "2019-06-12T15:47:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arbab\_Nazar1](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Arbab\_Nazar1](https://forum.ansible.com/u/Arbab_Nazar1)\
**Post date:** [June 12, 2019, 3:47pm UTC](https://forum.ansible.com/t/warning-flush-handlers-task-does-not-support-when-conditional/30547/1 "2019-06-12T15:47:28Z")

</div>

I have really simple role, in which I have these tasks:

`

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [June 14, 2019, 4:25pm UTC](https://forum.ansible.com/t/warning-flush-handlers-task-does-not-support-when-conditional/30547/2 "2019-06-14T16:25:06Z")

</div>

This appears to be fine, but as you say this is only the role.  
This indicates that issue is elsewhere, for instance in the calling playbook.  
Can you share that?

---

<div class="post-metadata">

**Author:** ![Arbab\_Nazar1](https://avatars.discourse-cdn.com/v4/letter/a/3e96dc/32.png) [@Arbab\_Nazar1](https://forum.ansible.com/u/Arbab_Nazar1)\
**Post date:** [June 16, 2019, 5:15pm UTC](https://forum.ansible.com/t/warning-flush-handlers-task-does-not-support-when-conditional/30547/3 "2019-06-16T17:15:20Z")

</div>

my **main.yml** is really simply like this:

`

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [June 17, 2019, 2:16pm UTC](https://forum.ansible.com/t/warning-flush-handlers-task-does-not-support-when-conditional/30547/4 "2019-06-17T14:16:26Z")

</div>

When using `import_tasks`, ansible will read the file, and effectively replace your `import_tasks` with the tasks that are inside it. When we do that, the `when` statement gets added to each individual task within.

As such, you get this warning.

Switching to `include_tasks` should avoid this.
