# conditional "when" doesn't work..

**URL:** <https://forum.ansible.com/t/conditional-when-doesnt-work/13700>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [October 16, 2013, 10:51pm UTC](https://forum.ansible.com/t/conditional-when-doesnt-work/13700 "2013-10-16T22:51:55Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![iat00](https://avatars.discourse-cdn.com/v4/letter/i/898d66/32.png) [@iat00](https://forum.ansible.com/u/iat00)\
**Post date:** [October 16, 2013, 10:51pm UTC](https://forum.ansible.com/t/conditional-when-doesnt-work/13700/1 "2013-10-16T22:51:55Z")

</div>

Hello,

following doesn’t work:

% nl -ba OS.yml  
1 —  
2 - hosts: all  
3 tasks:  
4 - name: print Ubuntu  
5 shell: echo Ubuntu  
6 when: ansible\_os\_family == “Ubuntu”  
7  
8 - name: print Debian  
9 shell: echo Debian  
10 when: ansible\_os\_family == “Debian”

Do you have an idea?

Thnx, regards  
🙂

---

<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:** [October 17, 2013, 1:03pm UTC](https://forum.ansible.com/t/conditional-when-doesnt-work/13700/2 "2013-10-17T13:03:13Z")

</div>

ansible\_os\_family for Ubuntu is Debian, by design, as it’s in the Debian family.

Similarly, Fedora is a Red Hat derived distribution, as is CentOS.

You should use a different fact.

see “ansible hostname -m setup” for all available facts.
