DevOps Classroomnotes 05/Oct/2023

Ansible contd

Setting up password less authentication between linux machines

  • We have two servers with user devops
  • From server1 create a key pair

* Now copy the public key into server 2 ssh-copy-id <username>@<server-2-ip>
* After the ssh-copy-id is success, then we can login directly by using ip address as both machines have same username and password less authentication is setup

ssh <server-2-ip>

Ansible setup

  • we have two machines with common user devops with sudo permissions and password less authentication setup between server 1 and server 2
  • From now server 1 will be called as Ansible Control node
    and server 2 as node 1
  • Ensure python 3 is installed
  • Refer Here for installation guide
  • We have two approaches to install ansible
    • using python
    • using package managers like apt or yum (dnf)
  • Refer Here for ubuntu specific installation.
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
ansible --version

* Overview

Test ansible connectivity from ansible control node to node 1

  • Create a file with node 1 ip address in it
  • execute the following command ansible -m ping -i hosts all

Adding users to sudo

  • Refer Here for debian based systems
  • Refer Here for redhat based systems
  • In this case we will be editing sudoers file directly
sudo visudo



  • YAML Refer Here for yaml tutorial
  • install the following on ubuntu vm
    • openjdk 17
    • nginx
    • mysql
  • openjdk 17
sudo apt update
sudo apt install openjdk-17-jdk -y
java -version
  • Install ansible and test connnectiviy between two nodes

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About continuous learner

devops & cloud enthusiastic learner