Monday, September 19, 2022

Ansible Lab Setup

Create two amazon Linux instances one for the management node and another for worker node.

Ansible Management node as root user

------------------------------------

Step 1) Login on host as root and add user ansadmin 

#useradd ansadmin 

Step 2) Set password to user ansadmin

#passwd ansadmin

Step 3) Give Sudo Access to User ansadmin

#visudo - Change permission [ansadmin ALL=(ALL)       NOPASSWD: ALL]

Step 4) Enable password authentication

#cd /etc/ssh

#vi sshd_config (PasswordAuthentication yes)

Step 5) Reload sshd service

#service sshd reload

Step 6) Install ansible

#amazon-linux-extras install ansible2 

#ansible --version

cd /etc/ansible/

#vi hosts - Add the ansible worker node ip to be managed 

#su ansadmin 


Ansible Management node as ansadmin user

----------------------------------------

#cd

#ssh-keygen - Generate public and private key 

#cd .ssh - check the keys generated

#ssh-copy-id ansadmin@<private-ip> - Copy public key to ansible worker node

#ssh 'ansadmin@172.31.25.99' - check if ssh connected

#ansible all -m ping - check ansible is working


Ansible Worker node as root user

--------------------------------

1)Add user ansadmin  on worker node.

#useradd ansadmin 

2)Set password for ansadmin  user

#passwd ansadmin 

3)Give Sudo Permission to ansadmin 

visudo - Change permission [ansadmin ALL=(ALL)       NOPASSWD: ALL]

4) Enable password authentication

cd /etc/ssh

vi  sshd_config  

   PasswordAuthentication yes

5)Reload sshd 

service sshd reload

ip addr - check the private ip address



No comments:

Post a Comment

Sample Game App Deployment on EKS cluster

 https://padmakshi.medium.com/setting-up-an-eks-cluster-and-deploying-a-game-application-a-step-by-step-guide-08790e0be117