# Avoid conditionals

**URL:** <https://forum.ansible.com/t/avoid-conditionals/3180>\
**Category:** Guides, FAQs & Howtos\
**Tags:** conditional, video, howto\
**Created:** [January 5, 2024, 8:15pm UTC](https://forum.ansible.com/t/avoid-conditionals/3180 "2024-01-05T20:15:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![IPvSean](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/ipvsean/32/1153_2.png) [@IPvSean](https://forum.ansible.com/u/IPvSean)\
**Post date:** [January 5, 2024, 8:15pm UTC](https://forum.ansible.com/t/avoid-conditionals/3180/1 "2024-01-05T20:15:22Z")

</div>

Write better playbooks! Avoid Ansible Conditionals! There are more efficient ways to write multi-vendor network automation playbooks. I recommend this with\_first\_found trick so that I can separate each network platform into its own file. This makes it much easier to extend an Ansible Playbook and actually reduces the amount of code (no when statements needed!)

[![](https://us1.discourse-cdn.com/ansible/original/2X/9/9aee9bc8214aec22bfa355eb70a56cf93d86a668.jpeg "Avoid conditional!s #shorts #ansible #devops #networkautomation #sysadmin") ](https://www.youtube.com/watch?v=2XqiKZgBzGo)

---

<div class="post-metadata">

**Author:** ![Dustin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dustin/32/2573_2.png) [@Dustin](https://forum.ansible.com/u/Dustin)\
**Post date:** [January 11, 2024, 12:30pm UTC](https://forum.ansible.com/t/avoid-conditionals/3180/2 "2024-01-11T12:30:13Z")

</div>

At execution time, does this help avoid all the “skipped” outputs that would normally show up? For instance with the original version of your script, all EOS devices would have a status of “skipped” for the IOS task.

---

<div class="post-metadata">

**Author:** ![Worreby](https://avatars.discourse-cdn.com/v4/letter/w/838e76/32.png) [@Worreby](https://forum.ansible.com/u/Worreby)\
**Post date:** [January 12, 2024, 2:40pm UTC](https://forum.ansible.com/t/avoid-conditionals/3180/3 "2024-01-12T14:40:46Z")

</div>

You could use  
ANSIBLE\_DISPLAY\_SKIPPED\_HOSTS=false ansible-playbook …  
or use an appropriate stdout\_callback in ansible.cfg

ansible.cfg: Unfortunately the following is obsolete

# Obsolete as of 2.14

# display\_skipped\_hosts = true

There’s surely more ways to suppress the output

---

<div class="post-metadata">

**Author:** ![Dustin](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dustin/32/2573_2.png) [@Dustin](https://forum.ansible.com/u/Dustin)\
**Post date:** [January 12, 2024, 2:53pm UTC](https://forum.ansible.com/t/avoid-conditionals/3180/4 "2024-01-12T14:53:34Z")

</div>

I was thinking about a situation where I want to keep the skipped messages for some tasks but not pollute the output logs with unnecessary skipped messages.
