In this video, we are going to learn all the additional commands that are available within Ansible.
Ansible software comes with additional resources and we can utilize those resources through built in
commands that comes with ANSIBLE software.
Following are the list or the list that we will go over with Ansible commands as of now.
So when I put it down as of now, meaning at this time while I'm doing this recording, all these commands
are available and can be used, but maybe a month, a year from now and you're watching this video,
maybe a few commands have are added to it or some of the commands have been deprecated.
So anyway, the most famous three commands that we have already covered, one of them is Ansible, just
the name Ansible.
We ran this command many times, a few times when especially when we ran the ad hoc command.
So you are very familiar with that.
The next command, which is used the most, and we have used this command the most throughout this course,
and that is Ansible Dash playbook.
We ran this command when we created a playbook and we run this command with the option of a playbook.
All right, then we have a command which we learned later on, which is Ansible Dash.
What this command is used to.
When you want to secure your environment, more specifically, you want it to secure your playbook or
you want it to secure a string.
All right.
So these are the three main commands that we learn so far in this entire course.
And you will be using, I will tell you, 95% of the time, only these commands.
All right.
So here are the other 5% of the commands that you could use and you might find them useful.
The first one is ansible config.
You will use that very rarely or maybe one time to do the configuration this shows or modifies ansible
configuration.
Not all configuration options are present in the command line.
Just the ones deemed most useful or common settings in the command line will override those paths through
the configuration file and the environment.
So if you do have the configuration file, which is ansible cfg, so pay close attention.
The last line is settings in the command line will override those paths through the configuration,
file and environment.
By the way, all of these commands, you could get the additional information on these commands if you
tied the command followed by the dash, dash or hyphen hyphen help.
Then we have another command ansible.
That's connection, connection command for the remote clients.
And by the way, this command, I try to do a lot of research.
I try to run this command many times to find out the exact purpose of it.
I couldn't find a lot of help, but so far I know it's a command that can be used for remote clients
and configuration moving on.
And then we have Ansible console.
Right now this Ansible console is somewhat, I would say, not clearly shown as to what it does, but
so far that I have used this command, I see.
I think this could do a lot more.
And if you understand this commands, functions or how to use this command accurately.
So this command allows for running ad hoc tasks against a chosen inventory from a nice shell with built
in tap completion.
It supports several commands and you can modify its configuration at runtime.
You can run a name of the listed command followed by the help as well.
So it's command, the option that are listed within this command and then the help to get more information.
All right.
So let's take a look if you want.
If you run the command ansible dash console, it will bring you to its own built in menu.
And within that menu you will get a list of additional commands that you could use as an option.
You can run help followed by that option to get more information about that command.
All right.
So let me go into my Ansible control node and I'll show you while I'm explaining that right here is
my Ansible control node.
Let me log in.
All right.
I am logged in as rude, and I am in a slash root directory.
All right, good.
Let's go ahead and clear the screen.
Now let's run the command ansible dash console and hit enter.
And when you hit enter, you see it's telling you welcome to the Ansible console type help or question
mark to list commands, the commands that will be used as an option for this command.
So you could use help or question mark.
Let's do help and you'll get a list of all the commands.
Or you could say a modules that we could use for those commands that we could run inside of this command.
So right here, for example, this is the DNF is the module.
If you wanted to know more about this, you could do help DNF and you'll get all the information about
what this module can do.
You could read through it and understand what you could expect when you run the Help Command.
All right.
It's the next command you can see is if you want to copy a file on the remote client, you could just
use the CPP, which is a shell command that you could use under more clients.
And by the way, this will copy the file locally available under more client to its local location.
So let's say if I go to my Linux machine right here and this is my control node and I will let me go
back into Ansible Dash Console menu.
And if I do keep that home so I keep temp ance.
This is the file that I wanted to copy.
So before I do that, I wanted to make sure this file exists in there are more clients.
So here I am in temp directly.
I see myself here in temp so I do not see an s file file.
So let me clear the screen.
I will just simply touch in five.
The file is created.
Now if I come back to the Ansible control node then I could use CP the shell command and do slash temp
ans, which is the source and the destination is I so and it should copy on to your.
If you go to Linux client and you go to home, I absol you will see the file file has been copied over.
See you right here.
There you go.
See, that's what you could use if you wanted to use a shell command.
Now there are many other commands and modules that you could use within this console.
I haven't tested every one of them, but I will definitely encourage you to go ahead and test and see
if you could run these ad hoc commands within this menu.
And that is easier for you.
Or simply just running the Ansible command with the ad hoc parameters is easier for you.
All right.
Anyway, so there are certain commands which are misleading in Ansible dash console, for example,
CD, which changes the host instead of changing the directory.
So, so here this is the CD command inside of Ansible Dash Console.
That's another one that I checked and I notice this CD does not mean that you wanted to change the directory.
It means changing the host.
All right, so that's that's about ansible console.
The next one is Ansible Dock.
Ansible Dash Dock.
You can access manual on plug ins and module through this command if you need any information.
So one of the modules or one of the command that I mostly run is Ansible Dash Doc minus L, which lists
all the modules that I have available out of the box.
So here is my client control node.
Let's clear the screen and if I want to get Ansible Dash Doc and a list of all the modules here I have
all the lists you can hit, enter or hit spacebar to go one page at a time and you'll get information
about every module and a short description of that module.
All right, good.
Moving on, then we have Ansible Galaxy.
That's another command, a command to manage Ansible roles and shared repository, the default of which
is Ansible Galaxy, ACP Call and slash slash galaxy does ansible.
By the way, all of these commands that I'm showing you and giving you all the information about you
could get the list of all these additional commands of Ansible by going into control node, and you
could just type simply Ansible and hit tab twice and you will get see these are the list of all the
commands that are available right now.
As I said, you could see some of them being deprecated or a few new of them will be added depending
on how the project goes.
The next command we will cover is Ansible Dash inventory, which we slightly touched on when we were
talking about adding our remote or hosts our clients to the Etsy's host file to create our inventory.
We are using the Ansible Dash Inventory Command provides you with the details of your hosts inventory
files.
It can be useful if you want to get an idea of how your hosts are grouped or grouped.
For example, run the following command ansible dash inventory minus EI option host SpaceX dash dash
graph.
Let me go to my control node and I will run this command and simple dash inventory dash I for host dash
dash graph.
All right, so right here, you see, I have everything as under all just one host that what I have
in the host file and there is nothing under Uncropped category.
All right.
So then what we could do also to get a list of all hosts in your host file, you can run the same command
with the option dash dash list.
It's just that simple.
Hit up arrow key, get rid of all the other option and do a dash dash list.
And you will see it will give me all the hosts that I have in the host file.
I have only one and it's showing me the IP address of that one remote client.
There isn't anything under on grouped category.
All right.
So also one more thing I wanted to tell you before I move on.
You could get the the help or the additional options of a command by simply running ansible dash inventory
or any other command for that matter.
You could do help and you will see that it has the list of all the options that are available to you.
You could try each one of them one by one, and see which one is useful for you.
So these were the additional commands that I wanted to cover in this video.
As I said initially, almost 95% of the time you will be using those main two commands.
One is the Ansible and the second one is Ansible Dash playbook.
And those commands are very useful to do all the work that you need to do for automation.
All of these other commands, you could get a lot more information about it through Ansible documentation.
So I will definitely recommend you that you please go to that website and find out what other information
that is available to you regarding these additional commands.