# Reduce debug task

**URL:** <https://forum.ansible.com/t/reduce-debug-task/33517>\
**Category:** Ansible Project\
**Created:** [July 29, 2020, 7:58am UTC](https://forum.ansible.com/t/reduce-debug-task/33517 "2020-07-29T07:58:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 29, 2020, 7:58am UTC](https://forum.ansible.com/t/reduce-debug-task/33517/1 "2020-07-29T07:58:24Z")

</div>

Hi Ansible Gurus,

Is it possible to print some message in the task itself when condition is not matched , rather than having new task with debug module ?

Example: currently i am writing two tasks:

- name: Get Active Application server  
debug:  
msg: "No active Application server found. "  
when: app\_server\_result is failed  
tasks:

- include\_role:  
name: myrole  
tasks\_from: myapplicaton\_server  
when: app\_server\_result is not failed

can we avoid debug statement here and can manage only with second task ?

---

<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:** [July 29, 2020, 8:11am UTC](https://forum.ansible.com/t/reduce-debug-task/33517/2 "2020-07-29T08:11:00Z")

</div>

> Hi Ansible Gurus,  
> Is it possible to print some message in the task itself when condition is not matched , rather than having new task with  
> debug module ?
> 
> Example: currently i am writing two tasks:  
> - name: Get Active Application server  
> debug:  
> msg: "No active Application server found. "  
> when: app\_server\_result is failed  
> tasks:
> 
> ```
> \- include\_role:
> name: myrole
> tasks\_from: myapplicaton\_server
> when: app\_server\_result is not failed
> 
> ```
> 
> can we avoid debug statement here and can manage only with second task ?

Not to my knowledge and the benefits are unclear to me.

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

---

<div class="post-metadata">

**Author:** ![Rahul\_Kumar1](https://avatars.discourse-cdn.com/v4/letter/r/da6949/32.png) [@Rahul\_Kumar1](https://forum.ansible.com/u/Rahul_Kumar1)\
**Post date:** [July 29, 2020, 8:24am UTC](https://forum.ansible.com/t/reduce-debug-task/33517/3 "2020-07-29T08:24:45Z")

</div>

Benifit is reducing 2 tasks in one task ! Or 10 tasks in 5 tasks ! If it can be done !
