Ansible part1
Class 70th AWS Ansible Part1 July 21st
What is Ansible?
Multiple servers handling with one server.
Ansible handle the all servers , install the softwares maintain them, it is end to end auto machine tool
Ansible we called Configuration management tool
Configuration :(Software,hardware,os cpu ram..etc)
Management :(Tomcat(install,update,patches,delete))
it came 2014 Maichel dehhan Free and open source, maintained by red hat
We have configure one we can use an number of times
Setup will be complex
Ansible Architecture
Playbook file (code) Server create ,software install ,deploy any application
playbook code in yaml format we called yml, Once you create ansible server(main server) playbook, it will create and manage the servers .One server (worker node)to other server to connect we need SSH
Ansible server has(Inventory file , it has work node ip address to manage)
Practicals
Step1: Create 5 instance,ad above shown, Use the MobaXterm termal, it will help to use muti execution
Same command ,all 5 instance

Mobxterm mutiexec mode window
Step2: Give Hostname for server identification
EXECUTE THE BELOW COMMANDS ON ALL 5 SERVERS:
sudo -i
hostnamectl set-hostname ansible/dev-1/dev-2/test-1/test-2
Change the name exclude windows give name
Change all server with name
Step3: in ansible server using sudo user or ansible user to communicate work nodes with SSH connection[root@ansible ~]# python3 --version
Python 3.9.23
[root@ansible ~]# ansible --version
ansible [core 2.15.3]
config file = None
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3.9/site-packages/ansible
ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
executable location = /usr/bin/ansible
python version = 3.9.23 (main, Jun 27 2025, 00:00:00) [GCC 11.5.0 20240719 (Red Hat 11.5.0-5)] (/usr/bin/python3.9)
jinja version = 3.1.4
libyaml = True
[root@ansible roles]# ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa
Your public key has been saved in /root/.ssh/id_rsa.pub
The key fingerprint is:
SHA256:YMrH1dtBtnV8CaJ/hKtBNcFZXCjxh8gKOMxD+QvuZl0 root@ansible
The key's randomart image is:
+---[RSA 3072]----+
| .. .*Oo=oo|
| +.. .+**=.oo|
| *+..o.+++ ..|
| . =o+o ooo.. |
| + + So.o.. |
| o . Eo . |
| . . .. |
| + . |
| o |
+----[SHA256]-----+
Step8:The Key file will store in the below path
[root@ansible .ssh]# pwd
/root/.ssh
[root@ansible .ssh]# ls -lrt
total 12
-rw-------. 1 root root 562 Jul 25 18:33 authorized_keys
-rw-r--r--. 1 root root 566 Jul 25 20:11 id_rsa.pub
-rw-------. 1 root root 2602 Jul 25 20:11 id_rsa