Ansible Installation
Lab Setup

- Create two ec2 machines with t2.micro in AWS
- Tag one machine as ACS and other as Node-1
- Login into ACS and become root user user
- Enable Password Based Authentication
vi /etc/ssh/sshd_config
change the contents
# PasswordAuthentication no => PasswordAuthentication yes
service sshd restart
- Create a user devops and give sudo permissions
adduser devops
visudo
# in the file opened
devops ALL=(ALL:ALL) NOPASSWD:ALL
# To test this
su devops
sudo apt-get update
# It should not ask for password and it should complete the command execution
- If python is not installed on ACS, install python
- To install ansible on Ubuntu Refer Here
- On the node execute the following lines
sudo apt update
sudo apt install software-properties-common
sudo apt-add-repository --yes --update ppa:ansible/ansible
sudo apt-get install python -y
- Install Ansible on ACS
- Repeat the steps from 3 to 6 on node-1
- Login into ACS as devops and configure password less login into node-1
ssh devops@<acspublicip>
ssh-keygen
ssh-copy-id devops@<node1privateip>
- Do the following to test connectivity
sudo mv /etc/ansible/hosts /etc/ansible/hosts.orig
sudo vi /etc/ansible/hosts
# add node1-private ip and save the file
# check by executing
ansible -m ping all
Refer the following
Like this:
Like Loading...