# Print output in tabular column format.

**URL:** <https://forum.ansible.com/t/print-output-in-tabular-column-format/37357>\
**Category:** Ansible Project\
**Tags:** ansible-project\
**Created:** [November 16, 2022, 3:08am UTC](https://forum.ansible.com/t/print-output-in-tabular-column-format/37357 "2022-11-16T03:08:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![saravanan\_jothilinga](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@saravanan\_jothilinga](https://forum.ansible.com/u/saravanan_jothilinga)\
**Post date:** [November 16, 2022, 3:08am UTC](https://forum.ansible.com/t/print-output-in-tabular-column-format/37357/1 "2022-11-16T03:08:50Z")

</div>

Hi,  
I need to get the ping status of all remote hosts and print its results in one neat tabular column format. Since I am a novice to ansible, I am looking for the appropriate playbook which does this.

**note** - the below task doesnt give any clear output .

- name: check reachable hosts  
hosts: remote-hosts  
gather\_facts: no  
tasks:
- command: ping -c1 {{ inventory\_hostname }}  
delegate\_to: localhost  
register: ping\_result

Thanks  
saravanan

---

<div class="post-metadata">

**Author:** ![dnmvisser](https://avatars.discourse-cdn.com/v4/letter/d/8e8cbc/32.png) [@dnmvisser](https://forum.ansible.com/u/dnmvisser)\
**Post date:** [November 16, 2022, 3:50am UTC](https://forum.ansible.com/t/print-output-in-tabular-column-format/37357/2 "2022-11-16T03:50:22Z")

</div>

Hi  
What is the reason you need to use ansible for this?

---

<div class="post-metadata">

**Author:** ![saravanan\_jothilinga](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@saravanan\_jothilinga](https://forum.ansible.com/u/saravanan_jothilinga)\
**Post date:** [November 16, 2022, 4:11am UTC](https://forum.ansible.com/t/print-output-in-tabular-column-format/37357/3 "2022-11-16T04:11:01Z")

</div>

We have around 300+ on-prem linux servers to manage its availability. We found ansible is one easy tool to manage it.

---

<div class="post-metadata">

**Author:** ![Walter\_Rowe](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/walter_rowe/32/4506_2.png) [@Walter\_Rowe](https://forum.ansible.com/u/Walter_Rowe)\
**Post date:** [November 16, 2022, 12:13pm UTC](https://forum.ansible.com/t/print-output-in-tabular-column-format/37357/4 "2022-11-16T12:13:00Z")

</div>

The command module runs the ping. It won’t display the output you register in ping\_result. You need a debug task if you want to see the result. If you want formatted output you may want to look at using a jinja2 template.

Walter

---

<div class="post-metadata">

**Author:** ![saravanan\_jothilinga](https://avatars.discourse-cdn.com/v4/letter/s/6bbea6/32.png) [@saravanan\_jothilinga](https://forum.ansible.com/u/saravanan_jothilinga)\
**Post date:** [November 16, 2022, 1:39pm UTC](https://forum.ansible.com/t/print-output-in-tabular-column-format/37357/5 "2022-11-16T13:39:53Z")

</div>

Thanks for this input.  
Could you please share one sample playbook code which does that? Appreciate your help!

---

<div class="post-metadata">

**Author:** ![utoddl](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/utoddl/32/249_2.png) [@utoddl](https://forum.ansible.com/u/utoddl)\
**Post date:** [November 16, 2022, 2:23pm UTC](https://forum.ansible.com/t/print-output-in-tabular-column-format/37357/6 "2022-11-16T14:23:49Z")

</div>

**$ cat pingout.yml**

---

<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:** [November 16, 2022, 4:06pm UTC](https://forum.ansible.com/t/print-output-in-tabular-column-format/37357/7 "2022-11-16T16:06:33Z")

</div>

I used the delegate to localhost to create a CSV report of inventory details. HTH

Mike
