ping command is basically used to test the reachability of a server. Ansible allows you to ping multiple servers or a group of servers at once. It is assumed that, Ansible tool is already installed in your linux system.
Steps:
1> Create empty yml file with the name pingserver.yml
2> Add following contents:
3> Save and execute the pingserver.yml file using followng command
[Alternative]
In this method no playbook file is needed to create.
Pass the following command to the terminal
Steps:
1> Create empty yml file with the name pingserver.yml
vim pingserver.yml
2> Add following contents:
--- - hosts: myservers tasks: - name: check the ping ping: ...
3> Save and execute the pingserver.yml file using followng command
ansible-playbook pingserver.yml
make sure following content is present in ansible_host inventory file
[myservers]
192.168.15.34 ansible_user=chinmaya ansible_ssh_pass=mypassword
www.chinmayadehury.in ansible_user=chinmaya ansible_ssh_pass=mypassword
192.168.15.37 ansible_user=chinmaya ansible_ssh_pass=mypassword
[Alternative]
In this method no playbook file is needed to create.
Pass the following command to the terminal
ansible myservers -m ping
-Thanks
No comments:
Post a Comment