Leandro-
 The best solution is let Ansible do the hard work instead oi trying to
parse the out put for failures, setup an error trap for failures that
captures them in a report. Then email this repot to someone or drop the
report in an bucket or Jenkins process to be acted on.  Add bonus of doing
that based on the output you sent is that you can keep running tasks
checking for other services on the same server instead of that server
halting on the failure.

The next iteration of that play would then be to have the failures create
secondary playbooks or inventories and trigger a remediation task against
them.

On Tue, Sep 13, 2022 at 9:49 AM 'Hearn, Stan J.' via Ansible Project <
[email protected]> wrote:

> You didn't mention awx or Ansible Automation, so I assume you are using
> command line.
>
>
>
> ansible-playbook someplay.yml | sed -n '/PLAY RECAP /,$p' | egrep
> 'failed=[1-9]'
>
>
>
> sed  - only print the lines from "PLAY RECAP " top the end.
>
> egrep - only print lines that contain "failed=" with a non zero first
> digit.
>
>
>
> And then I would add '~~~' at the beginning and the end.
>
>
>
> Is that the mark down you are looking for?
>
>
>
> Regards,
>
> Stan
>
>
>
> *From:* 'Leandro Montesoro' via Ansible Project <
> [email protected]>
> *Sent:* Tuesday, September 13, 2022 8:52 AM
> *To:* Ansible Project <[email protected]>
> *Subject:* [EXTERNAL] [ansible-project] Playbook output to markdown?
>
>
>
> Hello!
>
>
>
> In my organization we have some jobs in jenkins that executes differents
> ansible playbooks to analize things from the differents servers (for
> example if certain services are found installed).
>
> The problem I have, this playbook is running on many servers, and the
> output is not very friendly.
>
> Something that would help me is to be able to show, in markdown for
> example, the final result since the "failed" records give me the indication
> that something is wrong. Is there a way to model the output as markdown?
> What do you suggest for this problem?
>
>
>
>
>
> Thank you very much!
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/17d9e52a-35a6-4520-8d9e-e78d33ecd7fan%40googlegroups.com
> <https://urldefense.com/v3/__https:/groups.google.com/d/msgid/ansible-project/17d9e52a-35a6-4520-8d9e-e78d33ecd7fan*40googlegroups.com?utm_medium=email&utm_source=footer__;JQ!!Fto3Xw!pGlnt6AiM2BIrPa7F-mUYZw3jFJqlkEYOFEkjEMxxvT_2jIrzvmOATrGLHvBtdKlW4DEkYo_CK6sz4TFeUKjrvDsq1oRn9Q$>
> .
>
> --
> 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 [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/PH0PR10MB55931CF7C8662E52A0E966CCF0479%40PH0PR10MB5593.namprd10.prod.outlook.com
> <https://groups.google.com/d/msgid/ansible-project/PH0PR10MB55931CF7C8662E52A0E966CCF0479%40PH0PR10MB5593.namprd10.prod.outlook.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAEcFzYw1oT%2BwPKRusCu0_9Six82_eSrMhi44zpEscANsQ-xOtA%40mail.gmail.com.

Reply via email to