So friends, let's discuss the game plan to setting up our own local repository
here on the control
node. So here it is right here. This is our Ansible server. Okay. And again, we
have our blue box
and our yellow box. So a few things have got to happen in order for this to
correctly operate.
So the very first thing I'm going to have to do is to install two different
packages.
One package is going to be for an FTP server, because basically this is how we
're going to
set the server up so that these client devices, say for example, the blue box,
when we have
configured this device to use the control node as a valid repository, we are WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
configured this device to use the control node as a valid repository, we are
going to be pulling
down the packages over FTP. So this server here actually has to be configured
with the FTP
daemon. So that is something we're going to have to install straight away. And
also, so that we
can create the necessary metadata so that DNF or YUM from these devices over
here, so that they
can actually understand what the server is serving up. We're going to have to
run a very
particular command known as create repo. Now this command is not available on a WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
particular command known as create repo. Now this command is not available on a
default installation.
So we're going to have to install a package which gives us access to that
command. So we'll have to
install those two things, the server as well as the package which houses that
command. Now with the
FTP server installed on the system, the next thing we want to do is to start
that particular
server so that it is operational. Now think about it once the server is started
and up and running,
we want to be able to accept incoming connections straight away, you should be
thinking, we're going
to have to have some firewall considerations because ordinarily that port would WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
to have to have some firewall considerations because ordinarily that port would
just be blocked.
So we'll also have to open up that particular port for that particular service.
Then the next
thing we want to do is to actually create a directory on the server itself that
is going to be used
as the repository itself. So if anyone accesses that directory, this is where
all the packages
are going to reside. And then we want to download some packages. Say for
example, in our case here,
we will use an engine X server for the demonstration. So that we actually have
the package available
on the system. And then we can put the package inside of our repo directory so WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
on the system. And then we can put the package inside of our repo directory so
that when anyone
goes to use our particular repository, say for example, the blue box looking
for engine X,
they're going to be able to find it within our specially designated directory.
Now like I say,
we're going to have this directory, but in order to actually transform this
otherwise regular
directory into a fully blown repo directory, we actually want to run that
particular command
that we just installed, the create repo commands against this newly created
directory. And with
that in play, the server will be up and running. So with the server all set up, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
that in play, the server will be up and running. So with the server all set up,
the next thing we
want to do is actually to install an FTP client on both of our managed devices.
Because if we have
an FTP client on the devices, then they can begin making a quest to the FTP
server. Now it's not
enough just to have FTP on our device. What we're also going to do is to use
that module we just
talked about in the previous video, the yum_reportatory module to basically
tell our local systems where
they should actually look on the server to find all the packages, ie which WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
they should actually look on the server to find all the packages, ie which
directory should we be looking
for. So this is a process that we have to walk through. Let's begin with the
server configuration
then. So what I will do here is I will just create a new playbook and let's
call this play3.yml.
Going to insert mode, have a three hyphens at the top and I'll just say
configure server to be repo.
Now pop quiz, what should I actually configure for the host here? It's not
going to be the blue box
or the yellow box, but actually going to add on ourselves the local host in
this case. Okay. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
this case. Okay.
Next I'll say gather facts to be false. And now I'm going to define my tasks.
So here is the first
task or the set install necessary packages. Now what I will use here is the Ans
ible built-in
dnf module. Again, if you want to use yum, feel free. And now specify the names
of the packages
that I want to install me because it's going to be more than one. I'm going to
use an array. So
we have our hyphen here. And the first package is going to be vs ftp_d. This is
the FTP daemon
that we want to use to run the FTP server. Next we're going to install the WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
that we want to use to run the FTP server. Next we're going to install the
create repo underscore
c package, giving us access to that particular command that we need. And then I
'll specify that
the state is going to be present. So once we have FTP installed on the system,
we want to start
the FTP server. So I will use the Ansible built-in service module. And the name
of the service that
I want to be configuring here is vs ftp_d. And now I'll specify that the state
is going to be
started. So we actually started. And then I'll set enabled to be yes. That WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
started. So we actually started. And then I'll set enabled to be yes. That
means that if we
happen to reboot the system, then the server is going to automatically start up
. After all,
if we're going to run a repository, we want the repository to be available.
Next time we'll just
take and figure the firewall to allow FTP communication. So this time I'm going
to use the Ansible
POSIX firewall d module, and now specify the service I want to be configuring.
So the service
is going to be FTP, I'll specify that the state is going to be enabled. And I
want this to persist
reboot source a permanent is equal to yes. And that should open up the firewall WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
reboot source a permanent is equal to yes. And that should open up the firewall
. So the next thing
I will do will be to create the directory for the repository. And now I'll use
the Ansible built-in
file module. Now specify the path. The path I'm going to specify here is going
to be forward slash
var forward slash FTP. And then I can give any name I so wish. Now strictly, we
don't actually
have to use this particular path here. But this is a common convention. The var
directory after
all is used to house files, which are going to be variable in size, such as you
know, packages or WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
know, packages or
log files that type of thing. So it makes sense to put our FTP configuration
within that particular
directory. And then like I say, we can choose any name we so wish. So my case
here, I would just say
forward slash var forward slash FTP and let's just call this local repository.
And then I want to
specify that the state is going to be a directory. And now I'm going to
download the engine X package,
because basically this is going to be a package that I want to be able to serve
up to my network.
And again, how am I going to get that package? I can use the Ansible built-in D
NF module once WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
NF module once
again, I specify that the name is going to be engine X. So let's now briefly go
to the Ansible
built-in DNF module page. We're going to look at two parameters. We actually
haven't used yet.
So let's scroll on down a little bit here. Here they are right here. Okay. Here
is the download
directory. This is going to take a string value. And this is going to allow us
to specify an
alternative directory, whereby we're going to store packages. Now this is only
going to take an
effect. If you have to specify the download only parameter, which is the one
below we want to look
at, this one is just going to be a billion value, either true or false. And WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
at, this one is just going to be a billion value, either true or false. And
what this option is going
to do, it's going to specify that we download the package, but do not install
them, which makes
sense because you want to download the package so that we can effectively serve
it up to other
users. We don't necessarily want to say, for example, install an engine X7 on
our own local system.
We just want to host that package. So let's go and add these in. So specify the
download
underscore there is going to be where do you think it's going to be in var and
then in the local
repository directory, we just created above. And then I'll specify download WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
repository directory, we just created above. And then I'll specify download
only and then set
that to the billion value of true. Next, the final task is going to be use the
create repo commands
on the directory. So in the case here, we're just going to use the answerable
built in command module
with the CMD parameter. And the command we want to run is going to be create
repo or one word.
And then we just specify the name of the directory we want to target, which is
going to be var
FTP local repository. So let's save this right and quit. And now let's run the WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
FTP local repository. So let's save this right and quit. And now let's run the
playbook. And the
playbook kicks off and we install the necessary packages and the playbook
completes. So now if
I go into my var FTP directory and on LS, we now have this local repository. If
I go inside of here,
and I do a listing, this here is our download folder. So everything that we
downloaded is now
present. And because we run that create repo command, we also have this repo
data directory
who go inside of here, the LS, we have all this information here that can WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
who go inside of here, the LS, we have all this information here that can
ultimately be used by
DNF or by Yum, whoever is trying to consume us as a repository. So one last
thing I want to do
right now is to go into the Etsy directory, I'm going to VS FDPD, and then VS F
DPD.conf. If I go in here,
going to insert mode, all I'm going to do here is because for any lab
environment, I'm going to
copy out this particular configuration saying anonymous enable no. Basically,
this will allow
people to access our FTP server without having to specify particular
credentials, quite simply WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
credentials, quite simply
allowing an anonymous login. So let's just write and quit. And all I want to do
here is to say
sudo systemctl restart VS FDPD and to enter to redin those new configurations.
So what's the
server now up and running? How about we go and begin configuring our client?