Wednesday, 4 March 2020

STEP BY STEP PRACTICALS - ANSIBLE - HOW TO TEST CONNECTIVITY FROM ANSIBLE SERVER TO ANOTHER LINUX SERVER

HOW TO TEST CONNECTIVITY FROM ANSIBLE SERVER TO ANOTHER LINUX SERVER

  

1)  Login to the Ansible Login Server. In my example I have taken a Cent OS 7 Server on which I have installed ansible.

 

 

 

2) Generate the SSH keys on the ansible server by running the below command:-

 

 ssh-keygen -t rsa



3) Now copy the keys to the remote server by running the below command

ssh-copy-id <IP Address>

In my example, I have taken the IP - 192.168.181.13 which is my another linux server.



4) Now I created a host file named linux and in that I have create a group - linux.

I have defined, 1 linux server under that group.

 


5) Now we will check the connection between the Ansible Master Server (192.168.181.12) and Client Server (192.168.181.13). We can test it, by running the below command:-

ansible linux -m ping -i /etc/ansible/Scripts/linux

 

Here in the command:- 

a) ansible linux - It is the name of the group defined in the host file.

b) ping - It is the ping module

c) -m - It is the syntax to use the ping module.

d) -i /etc/ansible/Scripts/linux - It defines the path of the host file named - linux.






No comments:

Post a Comment