So friends, let's walk through the solution.
So the very first thing I did was add a new disc to one of my devices.
The device I chose was my Blue Box device.
We can see it right here. If I don't lsblk-f,
here is the device right here. Nvme 0.0.
So what I'm going to do is I'm going to write a playbook that will use the file
system module
to format this new disc with the ext4 file system.
So let me create a playbook which is called this validation1.YMLGUNT
and set mode have my three hyphens at the top. Give the playbook a name and let
's just call this WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
's just call this
validation1. Here I'm going to target and I'm going to target my Blue Box. I
will set
gather facts to be false. And now I'm going to define my tasks.
So the task is going to be create an ext4 file system.
So I'm going to use the community general file system module and the device I
'll target will be
nvme 0.0 into the device that I just created and the file system type is going
to be ext4.
So if I just press escape colon wq to write and quit and I just say answer
playbook validation1.YML and to enter give it a moment and as we can see we WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
playbook validation1.YML and to enter give it a moment and as we can see we
have made the change.
Let's go to our device. If I do an lsblk-f now we can see here we have
successfully formatted
that particular disc with the ext4 file system. So now what I need to do is I
need to write a
second playbook that is going to create a new directory called validation_der
and the user's
home directory. So let's create a new playbook called validation2.YML. I'm
going to insert mode,
have our three high fins, give the playbook a name. I'll just call it
validation2. Again we'll WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
validation2. Again we'll
target the same device as before in my case here the blue box. I'll set gather
facts to be false
and now I'll specify my tasks. Now the first task here is going to be creating
a mount point.
So I'll say create a new dir for mounting. I'm going to use the answerable
built-in file module
and the path this time is going to be in the user's home directory as I'll say
forward slash home
in my case here I have nugget user and the name of directory is going to be
validation_der.
Now specify the state is going to be a directory and I'll give it the mode WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Now specify the state is going to be a directory and I'll give it the mode
which is maybe go with
or I don't know let's go with 075. So that's going to create the actual
directory but that is not all
we're going to also have to mount the newly created file system in this
directory and ensure that
the file system is mounted immediately and will persist across system reboots.
So the next task
I'm going to create will just say mount the device. I will use the answerable
POSIX mount module
or specify the path that I'm going to use it's going to be the home nugget user
and it's going to
be the validation_der directed that I'm going to use. Now specify the source is WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
be the validation_der directed that I'm going to use. Now specify the source is
going to be forward slash
dev nve 0 enter the fstype is going to be ext4 this time and state we want to
specify as mounted
because that will mount immediately and also modify it's the fstype to ensure
persistence. So let's
just write and quit and we'll try running this new playbook right here and to
enter give it a moment
we create the new directory and mount the device. So let's go to our blue box WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
we create the new directory and mount the device. So let's go to our blue box
once again if I don't
lsbok-f we can see here we have our device right here and it has successfully
mounted in the target
directory and also just to ensure persistence if I check my @sfs-tab file we
also have the entry
right here. So that is us for our validation challenge I hope this has been
informative for
you and I'd like to thank you for viewing.