# Ansible output customize

**URL:** <https://forum.ansible.com/t/ansible-output-customize/32377>\
**Category:** Ansible Project\
**Created:** [March 3, 2020, 8:42pm UTC](https://forum.ansible.com/t/ansible-output-customize/32377 "2020-03-03T20:42:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Parveen\_Datt](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@Parveen\_Datt](https://forum.ansible.com/u/Parveen_Datt)\
**Post date:** [March 3, 2020, 8:42pm UTC](https://forum.ansible.com/t/ansible-output-customize/32377/1 "2020-03-03T20:42:10Z")

</div>

Hi Team

I have written a playbook and using debug variable we are reading the output in multiple play. Is there any way we can customize the output of each registered variable and print it nicely formatted . Any suggestion would be appreciated

Thx

---

<div class="post-metadata">

**Author:** ![M\_F](https://avatars.discourse-cdn.com/v4/letter/m/5fc32e/32.png) [@M\_F](https://forum.ansible.com/u/M_F)\
**Post date:** [March 3, 2020, 8:49pm UTC](https://forum.ansible.com/t/ansible-output-customize/32377/2 "2020-03-03T20:49:18Z")

</div>

[https://github.com/roots/trellis/pull/531](https://github.com/roots/trellis/pull/531)

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [March 3, 2020, 8:54pm UTC](https://forum.ansible.com/t/ansible-output-customize/32377/3 "2020-03-03T20:54:52Z")

</div>

Hi,

What is nicely formatted ?

Please show on an example what you want

Regards,

JYL

---

<div class="post-metadata">

**Author:** ![Parveen\_Datt](https://avatars.discourse-cdn.com/v4/letter/p/85f322/32.png) [@Parveen\_Datt](https://forum.ansible.com/u/Parveen_Datt)\
**Post date:** [March 6, 2020, 5:51am UTC](https://forum.ansible.com/t/ansible-output-customize/32377/4 "2020-03-06T05:51:04Z")

</div>

Hi JYL,

Here is what i mean.

TASK [debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

ok: [192.168.56.50] =\> (item= 00:48:30 up 2 min, 1 user, load average: 0.05, 0.06, 0.03) =\> {

“msg”: " 00:48:30 up 2 min, 1 user, load average: 0.05, 0.06, 0.03"

}

ok: [192.168.56.50] =\> (item=4.1.12-124.36.4.el7uek.x86\_64) =\> {

“msg”: “4.1.12-124.36.4.el7uek.x86\_64”

}

Can we customize above output something like below

TASK [debug] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

“msg”: “Server Uptime is → [’ 00:50:34 up 4 min, 1 user, load average: 0.01, 0.04, 0.03’]”

“msg”: “Server Kernel is → [‘4.1.12-124.36.4.el7uek.x86\_64’]”

---

<div class="post-metadata">

**Author:** ![jean-yves](https://avatars.discourse-cdn.com/v4/letter/j/a587f6/32.png) [@jean-yves](https://forum.ansible.com/u/jean-yves)\
**Post date:** [March 6, 2020, 9:13am UTC](https://forum.ansible.com/t/ansible-output-customize/32377/5 "2020-03-06T09:13:57Z")

</div>

Hi,

Did you try a callback that satisfy you ?

[https://docs.ansible.com/ansible/latest/plugins/callback.html](https://docs.ansible.com/ansible/latest/plugins/callback.html)

If not you should probably have to create yours…

Ansible is not the most obvious tool to create some reports… What did you want to achieve ? If you want a proper report, perhaps use a template to create what you want on destination nodes and after get files back to your controller with slurp module.

Regards,

JYL

---

<div class="post-metadata">

**Author:** ![madan\_gopal](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@madan\_gopal](https://forum.ansible.com/u/madan_gopal)\
**Post date:** [September 18, 2020, 6:21pm UTC](https://forum.ansible.com/t/ansible-output-customize/32377/6 "2020-09-18T18:21:58Z")

</div>

Hi Praveen,

I am looking for a script to take user input and provide system uptime for both Windows and Linux environments.

Any assistance with this playbook is greatly appreciated.

Regards,  
Madan

---

<div class="post-metadata">

**Author:** ![Mike\_Eggleston](https://avatars.discourse-cdn.com/v4/letter/m/58956e/32.png) [@Mike\_Eggleston](https://forum.ansible.com/u/Mike_Eggleston)\
**Post date:** [September 18, 2020, 6:23pm UTC](https://forum.ansible.com/t/ansible-output-customize/32377/7 "2020-09-18T18:23:33Z")

</div>

I was only concerned with unix and would use this ad-hoc command:  
$ ansible all -m command -a uptime -o
