So friends in this particular video, what I want to do is to continue on our
path of
automating SE Linux.
But this time, what I want to do is to show you how we can actually use one of
the Ansible
system roles or the rail system roles which I'd say to perform this particular
action.
So with that said, why don't we dive on in and just get to it.
So what I'm going to do here is going to my user share document directory and
then I
should have this folder rail system roles because we have installed this
earlier on in
the previous scale.
If I do an LS, what we're going to see here is we do have this particular WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
If I do an LS, what we're going to see here is we do have this particular
directory known
as SE Linux.
So let's go inside here, do an LS.
If we just look at the example playbook, let's just open this up and to enter
and wow, this
looks really, really intimidating.
Now the good news is is that a lot of this is just comments and just variable
values which
you can set.
Quite honestly, you can really minimize this a lot, which is exactly what we're
going
to do in this particular video.
But for now, as we can see here, the variables being defined are things like WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
But for now, as we can see here, the variables being defined are things like
the SE Linux
policy.
In this case here, we set the value to targeted the SE Linux state set to
enforcing if you
want to change it to permissive, you could do so.
And there are a whole bunch of other configurations relating to SE Linux such
as Boolean values
as well as how we can specify particular SE Linux f context pretty much that is
very similar
to what we did in the previous video.
In the case here, we use the SE type to specify the label we want to be
applying.
And then we specify where about we want to target that label, i.e. which WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
And then we specify where about we want to target that label, i.e. which
directory or
file should we actually be applying the label to.
In the case here, we see a very similar syntax to what we saw before in the
previous video.
Whereas in this one, we're targeting everything inside of the test directory
and applying the
label user home dirty.
Now scrolling on down, we can see this as a super comprehensive role.
Honestly, so much of what we're seeing here is beyond the scope of the RHC
examination.
So really don't panic.
Definitely do not stress about it. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Definitely do not stress about it.
So with respect to the tasks of the playbook, we can see we have a whole bunch
of options.
But for now, all I'm going to do here is as opposed to going through absolutely
everything,
let me just show you how we can modify this role.
That's created a playbook called play2.yml and this will be much, much more
stripped down
than the example you just saw.
And I really mean much more stripped down.
So what's creating name would I say using the SEO Linux role and the host we're
going to
target will be the all group or set gather facts to be false.
And now I'll just define my vars.
Now you'll notice in the example, we have this option here for SEO Linux WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Now you'll notice in the example, we have this option here for SEO Linux
underscore state.
And now I can just specify the state that I want SEO Linux to be in.
Now right now, if you recall, SEO Linux is in the enforcing state.
If I just say SE status, as we can see the current mode is enforcing, meaning
that any
violations are going to be blocked.
What I'm going to do is change the state to permissive using the role.
So in this case here, all I'm going to do is change this to permissive.
And then I'm going to specify the roles I want to use is going to be the rail
hyphen
system, hyphen roles dot se lyrics and drum roll. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
system, hyphen roles dot se lyrics and drum roll.
That is it.
Really not joking.
This is how much more stripped down this playbook is going to get.
So let's save this and let's see if it actually works okay.
So let's run the playbook, hit enter, give it a moment.
And we actually have an error here.
So let's go back in for a moment open because I actually have this additional
colon here.
Let's just get rid of that.
Paul, geez about that.
Clear the screen.
Arrow up, try again and to enter now the playbook executes.
So the playbook completes it.
And as we can see, we have a change on both of our devices. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
And as we can see, we have a change on both of our devices.
Let's go back to the devices and confirm if I just arrow up and run the same
command again,
notice now that the state has been changed to permissive, meaning that se Linux
will allow
violations.
It's simply going to log those violations.
And again, over on the second device, on the yellow box, notice this is also in
permissive
mode.
And if I wanted to change things back, well, quite simply, I would just set the
state to
be enforcing.
Let's run the playbook again.
And again, we have a change.
Let's go to our device, arrow up again.
And now we can see the state is back in enforcing mode. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
And now we can see the state is back in enforcing mode.
So really with respect to our examples right here, pretty much just use this as
a general
template.
If I go back into my se Linux right here and I again look at the example, say
for example,
I wanted to maybe change my se Linux context labels.
Okay.
So what I could do is copy the f context right here.
And we also effectively want to run the restore con command.
Okay.
So let's just grab these two examples right here, copy here.
And all I will do is I'll copy play to and I'll create a file called play three WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
And all I will do is I'll copy play to and I'll create a file called play three
dot YML.
So let's go into this particular file.
And all I'll do is I'll delete this variable here.
And instead I will just paste in this information.
All I will do here is I'll just change some of the values.
So that's going to create a directory called pizza.
And as opposed to setting the type to user home dirty, I would just set it to
the same
one we saw before the HCDPD, sys content T.
And again, remember the syntax pretty much any sub directories or files we
create within
this pizza directory is also going to inherit this particular label. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
this pizza directory is also going to inherit this particular label.
And again, what's directory do we want to be restoring?
We want to restore the labels for the pizza directory.
So all I will do here, in fact, before I run this, let's just change this to
just be the
yellow box.
And I'll go and create the pizza directory on that yellow box.
So this is to the nk.
forward slash pizza.
And if I do an LS dash LZ on the right directory, we can see here right now the
pizza directory
actually has the tag of default underscore T. We want to change it so that it
looks the
same as what we see on my site. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
same as what we see on my site.
Okay.
So let's go back to the playbook and we'll just as well play book play three
dot YML and
to enter and we'll just give it a moment to let the playbook execute.
And we can see a change.
So let's now go back to our yellow box.
If I add a warp and run the same command and to enter check this out right here
.
The pizza directory now has the new label, the 80 DPD, SIS content T.
So really, like I said, do not be intimidated by all the commands and options
within the
example playbook.
Just pick and choose as you need and modify them to make your own playbook for WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
Just pick and choose as you need and modify them to make your own playbook for
your own