Failed Task Summary In Play Recap

Hi Team,

Is there anyway/module to print each failed task error summary in play recap

Hi,

Could you please elaborate how it will look like?

Sure …

stdout: ##### Maintainance Check #####
CRITICAL
154 4145 65541 871 hm

PLAY RECAP ***************************************************************************************************************************************************************************************************************************

Playbook Executed: smsm_audit1.yml ***************************************************************************************************************************************************************************************************

LIST OF FAILED NODES AND TASKS WHICH FAILED ON THEM **********************************************************************************************************************************************************************************

TASK=Executing Cluster Node Maintenace Check On CA:
FAILED NODES=chi1-ca-1b
Need error marked in red here so that I don’t need to scroll up to find error on 100 nodes everything should be there in play recap
SERVICE FAILED ON TOTAL INSTANCES : 1

Hi Jitendar,

You need to write your callback plugin based upon the default callback plugin.

You can take inspiration from -

  1. Developing callback plugin - https://docs.ansible.com/ansible/latest/dev_guide/developing_plugins.html#callback-plugins
  2. You need to override the method mentioned here to include your business logic - https://github.com/ansible/ansible/blob/90518d8bb5b82827829e364696c326e31c6b3c74/lib/ansible/plugins/callback/default.py#L78
  3. This is an example blog post for writing your own callback plugin - https://purnapoudel.blogspot.com/2020/10/how-to-write-ansible-callback-plugin.html (not tested by me, but looks ok to me)

Ok … thanks