# when  ansible Conditionals

**URL:** <https://forum.ansible.com/t/when-ansible-conditionals/34661>\
**Category:** Ansible Project\
**Created:** [February 21, 2021, 9:06am UTC](https://forum.ansible.com/t/when-ansible-conditionals/34661 "2021-02-21T09:06:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kiran\_Kumar](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@Kiran\_Kumar](https://forum.ansible.com/u/Kiran_Kumar)\
**Post date:** [February 21, 2021, 9:06am UTC](https://forum.ansible.com/t/when-ansible-conditionals/34661/1 "2021-02-21T09:06:45Z")

</div>

Hello

In below how can i skip the output when is not relevant or how to do this better way ?

Thanks

---

<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:** [February 21, 2021, 3:14pm UTC](https://forum.ansible.com/t/when-ansible-conditionals/34661/2 "2021-02-21T15:14:48Z")

</div>

This information is already gathered and available to you by default, no need for wheel reinventing

---

<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:** [February 21, 2021, 7:12pm UTC](https://forum.ansible.com/t/when-ansible-conditionals/34661/3 "2021-02-21T19:12:14Z")

</div>

> Hello
> 
> In below how can i skip the output when is not relevant or how to do this better way ?

It is not clear from your tasks or their name what you are trying to achieve.  
"check OS version" - what does that mean?  
More generally speaking, without knowing what you want to do, it's  
also not possible to tell how to do it better.

Also, what does "relevant" mean in this context? That seems a highly  
subjective term...

---

<div class="post-metadata">

**Author:** ![Kiran\_Kumar](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@Kiran\_Kumar](https://forum.ansible.com/u/Kiran_Kumar)\
**Post date:** [February 21, 2021, 9:36pm UTC](https://forum.ansible.com/t/when-ansible-conditionals/34661/4 "2021-02-21T21:36:35Z")

</div>

This playbook check OS & then run diff cmd per OS & works fine

But the Debug output is not compact … it is verbose mode kind… if the OS is not say CentOS it gives 4 to 5 lines stating the same … the out is not compact … somehow is it possible to ignore that … so mat be debug is not the way to go … hence asking to folks for suggestions … thanks

---

<div class="post-metadata">

**Author:** ![racke](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/racke/32/4767_2.png) [@racke](https://forum.ansible.com/u/racke)\
**Post date:** [February 22, 2021, 8:22am UTC](https://forum.ansible.com/t/when-ansible-conditionals/34661/5 "2021-02-22T08:22:31Z")

</div>

> This playbook check OS & then run diff cmd per OS & works fine
> 
> But the Debug output is not compact .. it is verbose mode kind.. if the OS is not say CentOS it gives 4 to 5 lines  
> stating the same .. the out is not compact .. somehow is it possible to ignore that .. so mat be debug is not the way to  
> go .. hence asking to folks for suggestions .. thanks

So which output do you expect?

BTW: you can improve the readability of the output with setting "stdout\_callback = yaml" in your ansible.cfg.

Regards  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Racke
