Print output in tabular column format.

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

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

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

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

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

$ cat pingout.yml

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

Mike