So friends, let's walk through the validation solution.
So the very first thing that I'm going to have to do is I'm going to have to
create a playbook called validation.yml
that is going to install the system tools group package on one of my managed
nodes.
So with that said, let's go and do that.
So we create playbook called validation.yml and I'm going to insert mode, have
my three hyphens at the top
and I'll give this playbook a name and I'll just call this one validation one.
Again, super original, you know me.
And my host, I'm going to target in my topology, I will target the blue box, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
And my host, I'm going to target in my topology, I will target the blue box,
but choose anyone you so wish.
So now I'm going to do here as I'm going to specify that I'm going to gather
facts,
what we said to false, we don't actually need those facts for this particular
play.
And now I'm going to define my tasks.
So in the case here, I will give this task a name and I'll just say install
group package with DNF.
So I'll use my Ansible built in DNF module and I'll specify the name is going
to be
and what am I going to use? I'm going to have my at symbol and then I will say
system space tools. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
system space tools.
And then all I will do here is specify that the state should be present.
So really simple. If I just write and collect, let's say answer will playbook
validation.yml
and to enter and just give it some time because as it stands, we should be
installing multiple
different packages. Perfect. So if I go over to my blue box right here and I
now say DNF group list
and to enter as we can see within my installed groups, top of the list, we can
see the system
tools group. Perfect. So that's the first task and now complete. What I'm now WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
tools group. Perfect. So that's the first task and now complete. What I'm now
going to do is to go
back to my terminal here. I'm now going to write the second playbook to
configure my server.
So this playbook here should be called validation to yml and it's going to
configure this Ansible
control node to act as that local repository. So I'll just say them validation
to yml,
going to insert mode, have our three hyphens at the top. And the name of this
playbook,
you guessed it, it's going to be validation to now for the host. I'm going to
target the local host
because it's going to be applied to the local server and now specify gather WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
because it's going to be applied to the local server and now specify gather
facts should be the
value false. Now I'll define my tasks and the name of the first task or just
simply be install
packages. Then I'll use Ansible built in DNF and now I specify the list of
names of the packages
that I need to install. So remember, we're going to be installing an ftpd
server. So we need to have
that daemon as well as an order to be able to create the necessary metadata for
the repo to operate.
We want to have access to the create repo command. So I'll specify that I want
to install the create WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
to install the create
repo C library, then I'll specify the state should be present. And now I'm
going to start my ftp server.
So you guessed I'm going to use the Ansible built in service module. The name
of the service I want
to start will be vs ftpd. And the state is going to be started and enabled will
be set to yes.
So now I'm going to configure my firewall here. So I'll use the Ansible POSIX
firewall D module
now. The service will be ftp. The state is going to be enabled and I'll set the
value permanent to be
yes, so that these rows are persistent. Now recall what I want to do here is WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
yes, so that these rows are persistent. Now recall what I want to do here is
because I've made a
change onto my firewall, I want to notify a handler so that any changes are
reloaded. So I'll
have a handler called reload firewall, I'll get to that later on. Now I'm going
to create my repo
directory. So I will use the Ansible built in file module. And the path here is
going to be within
the var directory and then ftp. And the directory is going to be called valid
repo. Now I want to
specify that this is going to be a directory. So I'll use the state parameter. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
specify that this is going to be a directory. So I'll use the state parameter.
And now I'm going to
download the HTTP package that I can actually serve. So once again, I'm going
to use the Ansible
built in DNF module, the name of the package is going to be 80 dpd. The
download directory is
going to be your guest that's going to be forward slash var forward slash ftp
forward slash valid
repo. And now I specify that I only want to download the package but not
install it. So I'll
set download only to the Boolean value of true. Now I'm going to issue the WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
set download only to the Boolean value of true. Now I'm going to issue the
create repo command.
So I'll use the Ansible built in command module. And I'll use the cmd parameter
to run the command
create repo on var ftp forward slash valid repo. And now I have to define my
handlers. So at the
same level of indentation as I define my tasks, I must specify the name and I'm
going to sync it up
with the name of the notify keyword, which is going to be reload firewall. And
now I'm going to use
the Ansible built in service module. And the name of the service I want to
reload will be firewall WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
reload will be firewall
D and the state is going to be reloaded. So let's just save this for the moment
. And I'll now run
this new playbook validation to dot y mail. And to enter so the playbook
executes, we begin installing
the packages and now we begin to start up the ftp server and the playbook now
completes. So what
I want to do here is I want to go in to my configuration file so it's a vs ftpd
and vs ftpd.conf. And all
I'm going to do here is comment out anonymous enable. And in fact, actually, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
I'm going to do here is comment out anonymous enable. And in fact, actually,
for bonus points,
what you could have done is actually manipulate this file directly with Ansible
by using the line
and file module. But nevertheless, you don't have to do that if you did very,
very impressed. So
let's continue on. So now we're going to have our FTP directory. And then we're
going to have the
valid repo directory right here. And inside of here, we should have this repo
data directory,
as well as by the way, all of this 80dpd package information. Okay, now we're
going to write the
third playbook. So let's go back to our main directory. And I'll say them WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
third playbook. So let's go back to our main directory. And I'll say them
validation three dot y mail.
So let's go into this again, let's get this simple heading. This will just be
validation three,
whom I'm going to target this time. Well, in this case, here, I'm going to
target the blue box
once again, I'll set gather facts to be false. And now I'll define my tasks.
Now, previously,
if you recall what I did was I actually configured DNS mapping for the repo
server. This is a more
elegant solution. But like I said, you do not actually have to do it. So if you
did add in this
particular task, then very, very good. But ultimately, you don't have to. And WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
particular task, then very, very good. But ultimately, you don't have to. And
in fact, to
demonstrate that I'm just going to leave it out right here. So all I will do
here is instead just
move directly into installing the FTP clients. So what we're going to use, I'm
going to say
Ansible, built in DNF. And the name of the service I want to install is going
to be FTP.
And the states is going to be present. The next task is going to be configure
the local
repository. And this time, I'm going to use the Ansible built in young
underscore repository
module. Now the name of the repository, as per instructions should actually be WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
module. Now the name of the repository, as per instructions should actually be
called
my local repo here. So that's what we'll do give this a description of anything
you so wish,
just say validation repo. And now specify the base URL. So I'm going to specify
FTP colon
forward slash forward slash. And because I don't have my DNS mapping, what I'm
going to do is I'm
going to specify the IP address of the server. So in my case, here on my
control node, if I say IP
adder, we can see this as the IP address that I can be reached on. So I'm going
to copy this here, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
to copy this here,
and I'll just paste this in, and then I'll specify forward slash and then the
name of the actual
repository that we created. So the repository is going to be valid repo. And we
should also be
ensuring that we have disabled gpg checking. So I'll say gpg check is at the
value, no. And with
our repository now configured, what we have to do is we want to install the 80
DPD package from
this repository. So I'll use the answerable built in dnf module. The name of
the package I want to
install is hdpd. And the state is going to be present. Okay, so moment of truth WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
install is hdpd. And the state is going to be present. Okay, so moment of truth
, let's go and
try to run this particular playbook will say validation three dot yml and hit
enter. Open appears I
happen to have an error here. It says we can't resolve the module answerable
built in yum rest
positori. That's obviously a typo. So let's go back in again. This is why it's
very important
to actually read the output of the error messages. So let's go back in here
going to insert mode and
just delete this here. That looks a little bit better. So now just before I run WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
just delete this here. That looks a little bit better. So now just before I run
this playbook,
I'm going to run systemctl restart vs ftpd to ensure that my anonymous login is
going to be
allowed. And the configuration changes are applied with that now done. I will
just say
answerable playbook validation three dot yml and hit enter. So now we begin to
install the ftb client
configure the local repo and now we begin to download at dpd from the local
server or rather
the local repository. If I now do dnf repo list on my target device, we can see
here my local repo
is now configured. And if I do dnf repo query and I check the location for hdpd WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
is now configured. And if I do dnf repo query and I check the location for hdpd
, we can actually
see here a multi configuration we actually have our ftp server with the IP
address 192.168.160.133.
So that is us for our validation challenge. I hope it's been informative for
you and I'd like to
thank you for viewing.