So let's walk through the answers then. So the very first time we're going to
do it is to create
a playbook that is going to print the message saying validation check and this
message should
only be printed when the play because run with the particular options dash tre
ble v or dash quadruple
v. So let's just create this playbook called validation one dot yml. That's
going to insert
mode have our three hyphens at the top give the play become name. Let's just
call this validation
one. Now you can specify whatever hosts use a wish because I'm not actually
reaching out to any
my devices. I will just choose local host and I will set my gather facts to be WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
my devices. I will just choose local host and I will set my gather facts to be
false and now I'll
define my tasks. So the task here is simply print a message with a specified
verbosity. All we're
going to do is use the Ansible built in a debug module and the message I'm
going to print is going
to be validation check and I'm going to specify that this only runs at a verb
osity of three or above.
So we need to specify effectively dash vvv or dash vvvv. Okay, so let's just
write this out.
And if we try to run the validation playbook on its own without any options, WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
And if we try to run the validation playbook on its own without any options,
nothing is going to
print and if I run it with say for example, two V's still nothing is going to
print. We have not
met the threshold that is correct. However, once we get to three V's and I
enter now the playbook
is going to print the message and again, if I go with dash four V's again, we
're going to see
the same message as printed. So that's the first playbook. Let's create another
one called validation
two dot yml. Let's just give this a name of validation to this time target any
host you so
wish I will target the blue box device here as gain I will set my gather facts WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
wish I will target the blue box device here as gain I will set my gather facts
to be false.
And now specify my tasks give this one a name. And I'll just say install the 80
DPD package.
Perfect. So I'm going to use the Ansible built in DNF module and the name is
going to be 80 DPD
and the state should be present. Now, all we do is save this. And now the next
part of this particular
challenge is specifying that we have to run this playbook, but ensure that no
changes are made to
the live device by invoking a simulation run. So if I run this playbook, but I
just specified dash
dash check and to enter and whilst it might appear that the installation is WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
dash check and to enter and whilst it might appear that the installation is
going to happen,
all Ansible is doing is effectively checking the status of the 80 DB package.
So it simulates that
a change was made. But like I say, this is a pure simulation. If we go to the
device itself,
if I check the status of 80 DPD, notice this service is not on the system. The
change was not
actually applied just and merely simulated. Now the last time we're going to do
it to check the
syntax of both playbooks. And we want to check them at the same time and
neither should actually WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
neither should actually
execute. So I'm going to do here as I will say Ansible playbook. And I'm going
to use validation
and then a wild card to specify either validation one or validation to dot yml.
And then I'm just
going to say dash dash syntax dash check and to enter. And as we can see here,
both files have passed
the validation check alternative what you also could have done is just specify
each playbook,
name by name. And then once again, specified syntax check, if I enter notice we
get the same
results. So that is us for our validation challenge on troubleshooting Ansible. WEBVTT X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000
results. So that is us for our validation challenge on troubleshooting Ansible.
I hope it's been
of the Enrollment Authority, and I'd like to thank you for viewing.