Ansible Setup
-
Overview
-
Pre-reqs:
- Servers should be reachable from Ansible control node
- Servers should have python3 installed
- Steps:
- Create a user
devopsand give this usersudopermissions - Install Ansible on the control node
- Test the setup
- Create a user
Linux Instances – Login
- SSH (Secure Shell) is protocol used to login into linux instances which on a broader note supports two types
- password based authentication
- key based authentication
- Windows earlier didn’t had inbuild ssh clients now on all latest distributions from windows 11, ssh clients are part of windows
- SSH Command For password based
ssh <username>@<ip/name-server>
Ansible installation on Azure
- Both distributions will be ubuntu 24.04.
- This installation will be going on the linux machines with password enabled
- Creating linux machine on Azure (Watch classroom recording) or Refer Here
- Created two ubuntu vms
ansible-control-nodeandnode-in the same network with os ubuntu-24.04 and usernamedevops - Lets create inventory, create a new file on ansible control node
hostswith node-1 s private ip - Now lets install ansible on ubuntu
sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository --yes --update ppa:ansible/ansible
sudo apt install ansible -y
- To verify ansible installation
ansible --version

Ansible ping
- Ansible ping will verify if the ansible control node to node configuration is done correctly or not
- This also requires inventory
- The command is
ansible -m ping -i hosts all, This command expects the credentials to be keys - Ensure you perform a manual ssh into node from control node as it generates an entry in known_hosts file which is used by ansible for password based authenticates
- Since we are using password based our command would be
ansible -m ping -k -i hosts all

