Reduce debug task

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 ?

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
         Racke

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