In this article we are going to talk about ansible.
Ansible is one of the most popular tool and especially very popular in the
community of DevOps. Today i am going to demystify what ansible is, what is the
problem that it's trying to solve and will give you the most easiest
understandable explanation of what ansible is, what problem it solves and where
you can use it. Before we understand
what ansible is we need to understand what is the problem that ansible is
trying to solve, so we are going to take that now and also let me mention one
more thing that ansible is more popular not in the software developer or
software engineer community but moreover in the production engineer community. There
are different sets of challenges that are handled by the production engineer people
who takes your software or your web application and move it on to the production
environment the virtual machine like
AWS, Google cloud or whatever your favorite cloud provider is and there are
different set of challenges that are handled by these production engineer, ansible
is one of the most favorite tool for all these production engineer
So
ansible is a tool that helps you to either move things into production or the
things which are already in the production there are some config management or
there are some updation that needs to be made in the production it just helps
you to automate that task. So I will be explaining in the plain very simplistic
possible language, so let me first introduce you to the scenario of why ansible
is necessary. In general it’s not about just one machine which is handling your
database, your front end, your backend and everything. Usually we prefer to
deploy multiple machines so that either load can be balanced in the production or
maybe some other reasons as well maybe you want to have a separate mail server
say separate database server so it is very clear that you are not going to be
putting everything in just one virtual machine or one instance there would be
many.
That is all clear to us but let's just say there is something that you want to change in all the machine maybe there is an version update in the operating system from Ubuntu 18 to Ubuntu 18.5 or 8 or 19 the version is now changing and you want to make that version change or probably there is some updated feature that you have launched in your application and your application is running in three different computers to have a load balancing what you're going to do at that time you probably will use an approach which in which you are going to have a system and you're going to go ahead and use SSH or any other ways to connect those system you are going to login into each system every single time and will perform that update surely possible a lot of people does that and still this is one of the general way by a lot of people but this is not a feasible approach when you are scaling up quite a lot you have fleets of servers and probably you are having 100 different machines that is not even possible and even if you are doing it this is going to take a whole lot of your time
and
by the time there is also a possibility that not all of your users are getting
all that updated features.
Welcome
to ansible to solve this problem, ansible helps us to actually put up a config
file and then ansible will automatically be connected to all different machines
and will release those updates whether that's operating system patching maybe
an operating system upgrade, maybe a configuration update, maybe you want to
run an update on just the database whatever you want to do ansible comes in
between and it does that now before we talk and explore a little bit more on
ansible.
1.Inventory:- consider this scenario
Ansible allows us to have a separation as well as a segregation of the servers for example
coming
back now you understand that how the inventory is being done and how you can categorize
your servers into web maybe mail servers maybe all of that that is the one major
component of how ansible works moving a little bit more
2.Playbook:- Now playbook is actually
a set of instructions just like in the programming world we have loops and
functions and all of that in the world of ansible we have a playbook this
playbook is actually a set of instructions to perform that they run an
operating system update or probably create 10 different users whatever you
really want to do this is what you mentioned in the playbook so I hope you get
the idea that this is the playbook now how does it work and how this all
actually comes all together in the playbook you define all the things that you
want to do probably you want to do an OS upgrade and that upgrade needs to be
done in all of these three a virtual machine regardless of what categories they
are being in possible and until or probably there is a kind of a further subset
of instruction in which you want to do an Nginx update or Apache update and this update needs to go into this and this
virtual machine only that's where the inventory comes in you can have a
categorization and you can just put an instruction in your playbook that hey i
want all the machines to have an update in Ubuntu.
Now what happens actually is sets
of instructions goes from Playbook to Ansible and then ansibe performs all the
operations like upgrading the Ubuntu version from 18 to 19 and probably after
that you can set instructions to have an update in Apache and after we are done
with it we want you to take that app and deploy it. All that is done with
Ansible very easily




Comments
Post a Comment
Guys, if you have any doubts please let me know on my E-mail sumeshwar.bhadwal@gmail.com