# Does this Ansible feature make sense to anyone at all?

**URL:** <https://forum.ansible.com/t/does-this-ansible-feature-make-sense-to-anyone-at-all/20931>\
**Category:** Ansible Project\
**Created:** [March 20, 2016, 5:21am UTC](https://forum.ansible.com/t/does-this-ansible-feature-make-sense-to-anyone-at-all/20931 "2016-03-20T05:21:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dejay\_Clayton](https://avatars.discourse-cdn.com/v4/letter/d/6de8d8/32.png) [@Dejay\_Clayton](https://forum.ansible.com/u/Dejay_Clayton)\
**Post date:** [March 20, 2016, 5:21am UTC](https://forum.ansible.com/t/does-this-ansible-feature-make-sense-to-anyone-at-all/20931/1 "2016-03-20T05:21:26Z")

</div>

I’m really puzzled by how a certain Ansible feature appears to work, and I can’t figure out why anyone in the world would ever want it to work that way. I hope that I’m just densely mis-interpreting how it works.

It seems that the **when:** attribute for the **include:** task doesn’t actually constrain _when_ the specified playbook is included. Rather, the specified playbook is _always_ included, and _every_ task within the playbook is executed, with the original **when:** clause applied to the task.

This doesn’t make any sense whatsoever. I cannot think of a single use case for this.

On the one hand, if **when:** evaluates to **false** , then every task within the playbook will be skipped. If it evaluates to **true** , every task within the playbook will be executed. That sounds like a really stupid alternative to only including the playbook when **when:** evaluates to **true**. In fact, this implementation actually prevents us from conditionally including a playbook only if it hasn’t been included before, which seems like a really useful feature in general, and one of the strategies I was hoping to use in order to compensate for Ansible’s really terrible lack of composable language constructs.

What am I missing?

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 28, 2016, 5:07pm UTC](https://forum.ansible.com/t/does-this-ansible-feature-make-sense-to-anyone-at-all/20931/2 "2016-03-28T17:07:58Z")

</div>

This is because includes before 2.0 were ‘preprocessing macros’ and did not evaluate the ‘when:’ condition at all, most of the time they did not have the proper data to do so, that is why tasks just inherited the clause. I know this is confusing as they appear to be ‘normal tasks’.

Starting at 2.0, ‘task includes’ are now dynamic and will work as you expected, the one exception is when the ‘when:’ clause fails to ‘execute’, Ansible assumes this is because of missing data so it then appends the clause to the included tasks, which might have the required data in scope.

‘Play includes’ still work as in 1.9. They use the same keyword `include` but include full plays instead of just task lists.
