Failed Task Summary In Play Recap

61 views
Skip to first unread message

Jitender J

unread,
Sep 2, 2021, 1:51:33 AM9/2/21
to Ansible Project
Hi Team,

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

Abhijeet Kasurde

unread,
Sep 2, 2021, 1:59:43 AM9/2/21
to ansible...@googlegroups.com
Hi,

Could you please elaborate how it will look like?



On Thu, Sep 2, 2021 at 11:21 AM 'Jitender J' via Ansible Project <ansible...@googlegroups.com> wrote:
Hi Team,

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

--
You received this message because you are subscribed to the Google Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ansible-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/37c85a83-e22c-4b11-b40d-1c8dcd116cfdn%40googlegroups.com.


--
Thanks,
Abhijeet Kasurde

Jitender J

unread,
Sep 2, 2021, 2:07:08 AM9/2/21
to ansible...@googlegroups.com
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




--
Regards,
Jitender

Abhijeet Kasurde

unread,
Sep 2, 2021, 2:34:51 AM9/2/21
to ansible...@googlegroups.com
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)



--
Thanks,
Abhijeet Kasurde

Jitender J

unread,
Sep 2, 2021, 2:38:20 AM9/2/21
to ansible...@googlegroups.com
Ok ..... thanks 



--
Regards,
Jitender
Reply all
Reply to author
Forward
0 new messages