In this video, we will learn how Ansible works.
So we know until now that Ansible is used to automate our I.T. tasks.
All right.
So very first thing is each of those specific tasks in Ansible is written through module or a group
of modules.
Multiple modules are written in sequential order as how you want them to be executed.
Then multiple modules for related tasks is called a play.
If you have one, two or three modules to to perform certain tasks or they are related to each other,
then together that's a task and that that become a play.
Then all of those little plays together makes a playbook.
Playbook is written as a file format called YAML.
All right.
So through these statements, if you still have a confusion or still don't understand how Ansible works,
that's perfectly fine.
Let's visualize it.
You start writing your YAML file through Vim or VI, whichever your preferred editor is, and you want
to execute tasks to all the remote servers, those remote servers or your hosts or the Web servers.
All right.
On those Web servers, you have installed the operating system.
Everything's done.
It's now it's time to install a HTTP ready.
And if you need to install HTTP, you have to use a module to install a package, then you have to enable
a.s.a.p.
That enabling is the service of http and then you have to use a module.
That module will be a service module, same thing.
Then you have to start that HTTP service and you will use a service module.
All right.
That all of them, all three of them together makes a play because they are all related task.
When I say related, it all has to do with http, http, http.
All right.
Next one is enable a HTTP port on firewall.
Now, that is another module.
That module is to enable or go to firewall and enable port 84 HTTP.
That's a play itself because it's not part of the play right above where we are starting and installing
HTTP because in this one we are going to firewall.
However, all of these together because all these tasks or all these modules are combined together makes
a task because they are going to the Web servers.
All right.
So now if you wanted to do certain task or run certain task on database servers and you wanted to use
the same YAML file, then you will most likely will log in to database server, create a table, restart
the database.
All three of them would require a module to do that and that three modules makes a play.
And then of course, that's another task because it's going to another set of servers.
All right.
All of these three plays together, if you are done with that file, makes the playbook.
And that playbook is written in what?
Language?
It's written in YAML format.
All right, moving on.
Commands example that are used to run Ansible to run modules through a Jammal file, you would have
to run the command ansible playbook.
That's all one command space followed by the name of the YAML file.
Then it will simply go through all the modules you have written inside of the YAML file and execute
them sequentially to run module independently.
Meaning if you wanted to run a specific module without running it through a YAML file as an ad hoc,
you could do just ansible.
My servers, for example, my server are the list of your host and let's say if you want to run the
module Peng to paying them, you could do that for this.
You don't need a YAML file, however, we will cover that later on, so not to worry about it right
now.
Ansible configuration files are at see ansible ansible cfg.
Ansible ETSI Ansible host That's where all of your host or remote hosts where you want to execute your
task on all of them reside in this file.
And then etsi ansible rolls or rolls is where if you want to separate each of the plays on a separate
files, that becomes a lot easier.
So your YAML file doesn't look cluttered.
Anyway, once again, we'll cover roles later on.
So that's how Ansible works.
Maybe if you are still a little confused.
Trust me on this.
Don't worry about it.
I'll take it.
I'll make it so easy for you that you will understand everything one by one in the later lectures.