# Ansible when statements NOT WORKING when checking the ansible\_os\_family fact

**URL:** <https://forum.ansible.com/t/ansible-when-statements-not-working-when-checking-the-ansible-os-family-fact/21175>\
**Category:** Ansible Project\
**Created:** [April 15, 2016, 4:54pm UTC](https://forum.ansible.com/t/ansible-when-statements-not-working-when-checking-the-ansible-os-family-fact/21175 "2016-04-15T16:54:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![vmartin](https://avatars.discourse-cdn.com/v4/letter/v/d6d6ee/32.png) [@vmartin](https://forum.ansible.com/u/vmartin)\
**Post date:** [April 15, 2016, 4:54pm UTC](https://forum.ansible.com/t/ansible-when-statements-not-working-when-checking-the-ansible-os-family-fact/21175/1 "2016-04-15T16:54:18Z")

</div>

Ok so I have this code(using version 2.0.1.0 of ansible):

```

```

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [April 15, 2016, 5:10pm UTC](https://forum.ansible.com/t/ansible-when-statements-not-working-when-checking-the-ansible-os-family-fact/21175/2 "2016-04-15T17:10:04Z")

</div>

I guess you just need to use "include" instead of "role:", then the  
when-statement should work...

Johannes

---

<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:** [April 15, 2016, 5:46pm UTC](https://forum.ansible.com/t/ansible-when-statements-not-working-when-checking-the-ansible-os-family-fact/21175/3 "2016-04-15T17:46:38Z")

</div>

Conditionals are working as intended, it is not possible to make ‘roles’ conditional, any when: clause will be added to the tasks of the role, but do NOT prevent the import of the role itself.

​
