Skip to content

Instantly share code, notes, and snippets.

@gridhead
Last active May 15, 2021 12:55
Show Gist options
  • Save gridhead/337f3c0c7557640915b4a25f6cbe527d to your computer and use it in GitHub Desktop.
Save gridhead/337f3c0c7557640915b4a25f6cbe527d to your computer and use it in GitHub Desktop.
How do you ping the remote systems in your inventory to check if they are up or not?
[web]
server1 ansible_host=192.168.0.163
server1 ansible_ssh_user=ubuntu
server1 ansible_ssh_pass=<add-your-ssh-password-here>
server1 ansible_sudo_pass=<add-your-sudo-password-here>
server2 ansible_host=192.168.0.115
server2 ansible_ssh_user=soumadeepdhar
server2 ansible_ssh_pass=<add-your-ssh-password-here>
server2 ansible_sudo_pass=<add-your-sudo-password-here>

How do you ping the remote systems in your inventory to check if they are up or not?

  1. Download the inventory.ini file and replace the attributes for SSH and sudo password.
  2. You can ping a group of machines using the following command.
ansible web -i inventory.ini -m ping
  1. You can ping a particular machine using the following command.
ansible server1 -i inventory.ini -m ping
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment