Tuesday, 18 February 2020

STEP BY STEP PRACTICALS - ANSIBLE - HOW TO GET THE DATE FROM LINUX SERVERS

STEP BY STEP PRACTICALS - ANSIBLE

 

I have created the below demo environment:-



Master Server - 192.168.181.12
Client Server - 192.168.181.13
Ansible is installed on the Master Server 

1) In order to get the details from the slave server, I have generated the ssh file from the master Ansible server and copied it to the client servers.

I ran the command:- ssh-keygen -t rsa

2) Once the ssh file was generated in the root folder, I copied to my client server by running the below command:-

ssh-copy-id 192.168.181.13

3) I created a host file with the name linux and saved it in the folder Scripts created under /etc/ansible


Details of the host file:-

[root@Server1 Scripts]# cat linux
[linux]
192.168.181.13
[root@Server1 Scripts]#


4) I created the below playbook to get the date:-



5) Ran the date.yml playbook:- ansible-playbook date.yml -i linux


[root@Server1 Scripts]# ansible-playbook date.yml -i linux


6) Output of the date.yml playbook:-



No comments:

Post a comment