So previously we learned about the different organizations we can create as
well as how we can create different users and teams.
Now what I want to do is to turn your attention to the actual devices that we
're going to be managing.
So how do we detail which devices we want to manage, but we can do this via our
inventory.
The same may be Auto-Nallywood with Ansible.
So within our inventory we can list all of the devices we manage as well as
subdivide them into different logical groupings.
Same thing is true here, similarly we also have to think about how do we
actually authenticate with the devices that we happen to be managing, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
actually authenticate with the devices that we happen to be managing,
how do we log into them, well that is going to be specified via particular
credentials.
So let's go and see how this actually operates then.
So let's start by first creating an inventory.
Now just before we begin to keep things really quite simple, all I will do is I
'll log out of my John McG account
and I'll just log in as the regular admin with the username admin and the
password of password 1.
So what I will do here is I will go to my inventory and as we can see we have a
demo inventory. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
demo inventory.
Let's create one for ourselves.
So let's just add this here and we'll say add inventory and now I'll give this
inventory a name.
So let's just call this inventory Linux inventory because it's going to be an
inventory of the Linux devices that we happen to be managing
and the description can be inventory for red hat enterprise Linux devices.
What is the organization?
Well we know we created one.
So let's collect this little magnifying glass and I will just select nugget
tick and then choose select.
Now all I will do here is scroll down and choose save kill. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Now all I will do here is scroll down and choose save kill.
So we actually have created this inventory but as we know right now we actually
haven't specified any groups or any hosts.
Now we can actually see we do have these different tabs for such a thing.
So what I will do first is I will go and specify my hosts.
So let's go into hosts and I'll just choose add.
Now the name of the host here is going to be blue box.
And description can just be the blue box rail machine or real device whatever
it may be.
Now important point to note remember in regular answerable for each device we WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Now important point to note remember in regular answerable for each device we
can have this host vars directory.
And inside of that directory we're going to have a pair host yaml file for
every single host and we can define those variables according to that host.
In the case here we can also define these host variables for that particular
device.
Okay, so say for example the blue box happened to have a particular or let's
maybe say variable calls.
I don't know what to say custom message okay doesn't actually matter and I just
say greetings from the blue box.
We can just simply define these variables as we are the marleu woods and again WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
We can just simply define these variables as we are the marleu woods and again
of course if you want to leave this blank then you are absolutely free to do so
.
So all I will do right now with that created I will choose save.
So now we have created the blue box we see the description and what I can do is
go back to my hosts and I'll just simply
add another one so I'll add this here and I'll just say the yellow box and the
description is the yellow box rail device.
Now of course we can add in more host variables but in my case here I'm just
going to leave this blank so I'll just go down and click save. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
going to leave this blank so I'll just go down and click save.
And now again if you go back to your host we can see here within this inventory
the Linux inventory we have two devices blue box and yellow box.
Now recall the automation platform right here is running on my control node so
we actually do have resolutions or name resolutions for these particular names
okay so blue box does actually correspond to a particular IP address as those
yellow box in fact if I just minimized this here and I just go into it say
hosts.
We can see here we actually do have these mapping so the device itself or WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
We can see here we actually do have these mapping so the device itself or
rather the answerable automation platform has access to this name and its
subsequent resolution so well know how to connect to the device for you.
Yes I paid this okay now what I will do here is if I go and create a group and
I just select ads now I can just create a regular group so let's maybe say I
have a group called USA okay I can just say devices that are in the USA and
again I can add in some group variable values for the USA group such as I don't
know let's go with NTP server is one two three four doesn't actually matter and WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
know let's go with NTP server is one two three four doesn't actually matter and
also let's maybe go and add in a custom message as well and just say.
There I am in the USA group cause let's go and save these so maybe happen to
have a USA group as well as some group vars for that particular group but right
now if we happen to look at the host that belong to this particular group we
don't actually have any hosts within that group so this is kind of like if I
just go back and show you my regular answerable inventory let's go back here.
Let me just substitute to the answerable user if I don't if I go into the WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Let me just substitute to the answerable user if I don't if I go into the
inventory I and I form this is effectively what I'm doing I've created the USA
group just in the same way I did in my answerable I and I file and what I want
to do is I want to now add the yellow box to that particular group so inside of
the USA group we want to add in the yellow box so all I will do is choose add
and I can choose to add an existing host I a host I have defined within my
automation platform so let's click this here
and all I will do is click yellow box and then choose save and now the yellow WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
and all I will do is click yellow box and then choose save and now the yellow
box is a member of the USA group and that means that the yellow box is also
going to have access to those group variables within the USA group so again we
click on the details we can see the yellow box would get this custom message
unless it has a more specific variable within its host vars.
Basically this is just operating the same way a regular answerable would. Coats
like I say we now have our Linux inventory we have our two hosts we can see the
two hosts are right here and we can see the groups that we have defined right
now I have the USA group if I add another group and I just say UK just say UK WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
now I have the USA group if I add another group and I just say UK just say UK
for UK devices.
Again you can add in whatever variables you want if you so wish but for now I
will just choose save for simplicity and all I will do now is add in the host
for that particular group now the group here or the host I'm going to add will
be an existing host and this time I will put the blue box into the UK group so
now blue box is a member of UK again getting access to any variables that you
happen to define within that group.
Now we want to be able to log in to our devices so all I will do now is go to WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Now we want to be able to log in to our devices so all I will do now is go to
credentials and again we happen to have these automatically created credentials
what I want to do is to define my own set I will choose add and I will give
this a name so let's maybe just call this a real credentials
I will just say log in details for my real devices what is the organization
well if I choose the magnifying glass and choose nugget take once again that's
for that organization and here is the credential type now depending on what you
happen to be logging into you can have different credentials maybe you happen WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
happen to be logging into you can have different credentials maybe you happen
to need an API token maybe you want to supply some type of username and
password whatever it may be pretty much you have support for that the one we
want to be looking at is one known as machine just to log into a regular
machine
and that is going to allow to supply a username and password so when I want to
log into these devices I would say Ansible or SSH Ansible and then give the
name of the device such as yellow box if I enter I have actually configured
passwordless authentication for Ansible the way I did this was by copying over
my SSH keys WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
my SSH keys
now here is the thing on the Ansible automation platform what I actually can do
is I can actually copy over these private keys if I so wish but because Ansible
automation platform can affect it will just save these details we don't have to
continually type in the password anyway which is really quite handy so in that
case here I'm just going to provide these details directly so I'll say Ansible
is the login username and the password to log into these devices with this Ans
ible account is actually the keyword Ansible as well
so if I just happened to show this we can see it as Ansible but right now if I WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
so if I just happened to show this we can see it as Ansible but right now if I
just save this now if I scroll on down a little bit what I want to do is to
specify what my privilege escalation method is so if we happen to need to use
super user access how do we get that
if I hit the down arrow we get the drop down the way I actually get this is by
saying the sudo command now what is the privilege escalation user name well
that would be the root accounts and now I have to define what my privilege
escalation password actually is so on the devices if I say for example go to
the
blue box if I want to become the super user I would say su root to substitute WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
blue box if I want to become the super user I would say su root to substitute
user to the root account and now I specify what the root password is now in my
case here the password will be password one now you can see here who might I am
the root accounts now just to be clear here this just happens to be the
password for the root account that I created for that particular virtual
machine at its very creation way way back at the beginning of this course it's
nothing to do with the actual admin password that we created for the Ansible
automation platform
automation platform which also happens to be password one that is purely just a WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
automation platform which also happens to be password one that is purely just a
coincidence.
What we're talking about here is how do we actually escalate to the root
account on the
machine that you're managing. So on both the yellow box and the blue box, the
way I get
to my root account is via the password password one. So that is what I'm going
to supply within
the automation platform. So again here I will just supply that information
password one and
we can see it is right there. Cool. So if I just scroll down and click save,
here I now
have my credentials and I also have to find an inventory. So check this out
what I can
do is I can test something out. Let me go to my inventory. Okay. And let me go WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
do is I can test something out. Let me go to my inventory. Okay. And let me go
to my
Linux inventory and say for example, I want to target a particular host to test
. Okay.
So I'll go on to the blue box right here and then I will choose run command
against that
particular device. So I can choose an Ansible module. So let me go with maybe
the command
module and the argument and supply will simply be the IP adder commands. Now if
I scroll
on down, we can see some different options. We can also supply some variables
at runtime
if you so wish. But all I'm going to do right now is select next. Now we're WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
if you so wish. But all I'm going to do right now is select next. Now we're
going to specify
what the execution environment is now by default, it will be the default
execution environment.
And that is what I'm going to use it is going to execute on this particular
node right here.
So I will just choose next. Now we specify the credentials we want to supply.
So if I
just choose the rail credentials, that is going to log in with the username Ans
ible with
the password Ansible. And if we want to go in and get root privileges, we can
use the
pseudo command to elevate to the root accounts. And then we can provide the
password of password
one if necessary in this case here, that escalation will not be necessary. So WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
one if necessary in this case here, that escalation will not be necessary. So
if I just choose next,
here we get a general summary of what we're going to do and all I can do is
select launch.
Now the command runs. And as we can see, it says successful. Now right now, if
I just click on
say, for example, details and toggle back to output, we actually see the output
from that
particular command. You see that we can see Ansible is effectively logged into
the blue box.
And we have issued that particular command IP either. Scrolling on down there,
we can see the
output right here. There's IP address 192.168.160.134. And if I want to go back WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
output right here. There's IP address 192.168.160.134. And if I want to go back
, let me go to my
inventory once again, let's go to Linux inventory. This time we'll go to groups
. I will target,
say for example, the USA group, and I can choose to run a command. This time I
will just say
touch and let's go into the 10th directory. And we'll just say a AP for Ansible
automation platform
dot TXT. Basically, we're just going to create a little text file. And again,
scrolling on down,
I'll just choose next, choose the default, I will log in with my real
credentials. And next, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
credentials. And next,
and then I can just choose launch. So again, we see successful right now, if I
just toggle
between details and the output once again, you can see the actual general
output. This time,
it's on the yellow box. So let me go in to my yellow box device. Let me go to
my terminal.
If I just cd to the 10th directory, do an LS. And let me just scroll on up. As
we can see here,
we have in the created this file, a AP dot TXT. So now we can clearly see that
we can reach our
devices via our inventory and we can log into these devices with our
credentials. What we now WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
credentials. What we now
want to be able to do is to learn how we can actually integrate our Ansible
Playbooks directly
within the automation controllers graphical user interface.