# check ping SSH connection for multiple host and uptime  using playbook

**URL:** <https://forum.ansible.com/t/check-ping-ssh-connection-for-multiple-host-and-uptime-using-playbook/33169>\
**Category:** Ansible Project\
**Created:** [June 13, 2020, 8:42am UTC](https://forum.ansible.com/t/check-ping-ssh-connection-for-multiple-host-and-uptime-using-playbook/33169 "2020-06-13T08:42:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Avinash\_Jadhav](https://avatars.discourse-cdn.com/v4/letter/a/958977/32.png) [@Avinash\_Jadhav](https://forum.ansible.com/u/Avinash_Jadhav)\
**Post date:** [June 13, 2020, 8:42am UTC](https://forum.ansible.com/t/check-ping-ssh-connection-for-multiple-host-and-uptime-using-playbook/33169/1 "2020-06-13T08:42:28Z")

</div>

Hello All,

I am trying to develop playbook check the ping, ssh, and uptime for multiple server /host

Ping if is successfully then print Yes otherwise No

SSH if successfully then checks for uptime and print Y and Uptime otherwise No

I am looking below output

Centralized Server Availability Check.

---

<div class="post-metadata">

**Author:** ![Michael\_M1](https://avatars.discourse-cdn.com/v4/letter/m/e274bd/32.png) [@Michael\_M1](https://forum.ansible.com/u/Michael_M1)\
**Post date:** [June 13, 2020, 5:18pm UTC](https://forum.ansible.com/t/check-ping-ssh-connection-for-multiple-host-and-uptime-using-playbook/33169/2 "2020-06-13T17:18:18Z")

</div>

If you use paramiko (ssh) as your transport, then by default any connection you make will be over ssh. And if you can ssh to it you can obviously ping it (unless ICMP is blocked). So I would just use a playbook that runs the ‘uptime’ command via the shell module. If you get a response, you have successfully covered all three requirements (ssh, ping, uptime).

As for the output of Yes or No, you can just do a conditional based on the stdout return value of your uptime command.
