# Playbook output to markdown?

**URL:** <https://forum.ansible.com/t/playbook-output-to-markdown/37092>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [September 13, 2022, 12:52pm UTC](https://forum.ansible.com/t/playbook-output-to-markdown/37092 "2022-09-13T12:52:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Leandro\_Montesoro](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@Leandro\_Montesoro](https://forum.ansible.com/u/Leandro_Montesoro)\
**Post date:** [September 13, 2022, 12:52pm UTC](https://forum.ansible.com/t/playbook-output-to-markdown/37092/1 "2022-09-13T12:52:19Z")

</div>

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?

 ![ansible_mail.png](https://us1.discourse-cdn.com/ansible/original/2X/e/ecfe129feb8cbb863a2349bae832df17d9b3a2fd.png)

Thank you very much!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [September 13, 2022, 2:22pm UTC](https://forum.ansible.com/t/playbook-output-to-markdown/37092/2 "2022-09-13T14:22:39Z")

</div>

You can do this with a custom callback plugin or look for already existing solutions like ara [https://ara.recordsansible.org/](https://ara.recordsansible.org/)

---

<div class="post-metadata">

**Author:** ![shearn](https://avatars.discourse-cdn.com/v4/letter/s/ba8739/32.png) [@shearn](https://forum.ansible.com/u/shearn)\
**Post date:** [September 13, 2022, 2:48pm UTC](https://forum.ansible.com/t/playbook-output-to-markdown/37092/3 "2022-09-13T14:48:54Z")

</div>

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)**
>
> ![ansible_mail.png](https://us1.discourse-cdn.com/ansible/original/2X/e/ecfe129feb8cbb863a2349bae832df17d9b3a2fd.png)

---

<div class="post-metadata">

**Author:** ![Evan\_Hisey](https://avatars.discourse-cdn.com/v4/letter/e/ce73a5/32.png) [@Evan\_Hisey](https://forum.ansible.com/u/Evan_Hisey)\
**Post date:** [September 13, 2022, 2:57pm UTC](https://forum.ansible.com/t/playbook-output-to-markdown/37092/4 "2022-09-13T14:57:27Z")

</div>

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)**
>
> ![ansible_mail.png](https://us1.discourse-cdn.com/ansible/original/2X/e/ecfe129feb8cbb863a2349bae832df17d9b3a2fd.png)

---

<div class="post-metadata">

**Author:** ![Leandro\_Montesoro](https://avatars.discourse-cdn.com/v4/letter/l/258eb7/32.png) [@Leandro\_Montesoro](https://forum.ansible.com/u/Leandro_Montesoro)\
**Post date:** [September 15, 2022, 2:24pm UTC](https://forum.ansible.com/t/playbook-output-to-markdown/37092/5 "2022-09-15T14:24:10Z")

</div>

Hi!

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

Regards,  
Lean

> **(attachments)**
>
> ![ansible_mail.png](https://us1.discourse-cdn.com/ansible/original/2X/e/ecfe129feb8cbb863a2349bae832df17d9b3a2fd.png)
