check ping SSH connection for multiple host and uptime using playbook

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.

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.