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 can do this with a custom callback plugin or look for already existing solutions like ara https://ara.recordsansible.org/

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

(attachments)

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.

(attachments)

Hi!

Thanks for the replies, I’ll try your suggestions and let you know!

Regards,
Lean

(attachments)