Introduction Of Ansible In DevOps

Posted By :Kapil Soni |1st December 2022

Introduction Of Ansible
++++++++++++++++++++++++++++++++++++++

Ansible playbooks are lists of tasks that are automatically run against hosts. A group of hosts make up his Ansible inventory. Each module in an Ansible playbook performs a specific task. Each module contains metadata that determines when and where tasks are run and by whom.

Ansible is a serverless configuration management tool

Install Commands ----> sudo apt-get install ansible 

Then Install sudo apt-get install sshpass -y 

for ssh passwords for particular serverless

+++++++++++++++++++++++++++++++++++++++
Ansible Inventory
++++++++++++++++++++++

Ansible Inventory Format is ----> .yaml .ini  we can use

Ansible Inventory Default File Is ----> /etc/ansible/hosts

Firstly Uncomment this File
sudo nano /etc/ansible/ansible.cfg
++++++++++++++++++++++++++++++++++++++++++++++++++
# Uncomment this in order to avoid SSH key host checking.
host_key_checking = False
+++++++++++++++++++++++++++++++++++++++++++++++++++

ansible <alias name> -m modulename -i file name

+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Ansible Inventory File Desc:

we can Write this type

for ex : ansible-worker ansible_host=3.108.237.22 ansible_ssh_private_key_file=/home/kapil/Downloads/Ansible-Worker.pem  ansible_connection=ssh ansible_port=22 ansible_user=ubuntu
+++++++++++++++++++++++++++++++++++++++++++++++++++++++
ansible-worker ----> alias name of Inventory
ansible_host=3.108.237.22 ----> ansible host or IP that or ansible worker host IP which u want to control
ansible_ssh_private_key_file=/home/Kapil/Downloads/Ansible-Worker.pem  ----> server keys and file location
ansible_connection=ssh ----> ansible connection ssh or anything
ansible_port=22 ----> ansible-worker port 22 or 92 or another thing
ansible_user=ubuntu ----> ansible-worker user or us server ka kis user se command chalvana chate home
+++++++++++++++++++++++++++++++++++++++++++++++++++++++


Wild Cards:

If Hume alag alag Hostname hai or unka ek group banana hai to kasie banayege means alag naam hai 
but unko ek group mein setup krke run krna hai to kaise krege

ex: room,week,kapil,rahul,nitin,etc so aako ek hi group mein add krna hai to 

[webserver]             |  
room                        |
week                        |--------> group of webserver
kapil                        |
Rahul                      |

[database]              |-------------> group of database   
nitin                       |

 

Is an Ansible playbook a script?

Ansible playbooks are organizational units of scripts that define the work of server configuration managed by Ansible automation tools. Ansible is a configuration management tool that uses Ansible playbooks to automate the configuration of multiple servers.


About Author

Kapil Soni

Kapil is an exceptionally skilled DevOps Engineer with a profound understanding and expertise in a wide range of cutting-edge technologies. His knowledge encompasses AWS, Azure, GCP, Kubernetes, Azure DevOps CI/CD, ELK, and more. He has a proven track record of successfully deploying and managing large-scale cloud infrastructures. He leverages automation tools and follows industry best practices to ensure optimal performance and scalability. Kapil's collaborative approach and unwavering commitment to continuous improvement make him an invaluable team member in dynamic environments. He has made significant contributions to numerous projects, including Kubernetes and AWS, Oneinfinity, Dunkan, SecureNow, Yogamu, and several others.

Request For Proposal

[contact-form-7 404 "Not Found"]

Ready to innovate ? Let's get in touch

Chat With Us