WEBVTT

1
00:00.000 --> 00:03.120
So let's walk through the answers then. So the very first time we're going to

2
00:03.120 --> 00:03.760
do it is to create

3
00:03.760 --> 00:07.870
a playbook that is going to print the message saying validation check and this

4
00:07.870 --> 00:08.400
message should

5
00:08.400 --> 00:12.710
only be printed when the play because run with the particular options dash tre

6
00:12.710 --> 00:14.240
ble v or dash quadruple

7
00:14.240 --> 00:17.890
v. So let's just create this playbook called validation one dot yml. That's

8
00:17.890 --> 00:18.400
going to insert

9
00:18.400 --> 00:21.470
mode have our three hyphens at the top give the play become name. Let's just

10
00:21.470 --> 00:22.480
call this validation

11
00:22.480 --> 00:26.310
one. Now you can specify whatever hosts use a wish because I'm not actually

12
00:26.310 --> 00:27.280
reaching out to any

13
00:27.280 --> 00:31.430
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

13
00:27.280 --> 00:31.430
my devices. I will just choose local host and I will set my gather facts to be

14
00:31.430 --> 00:32.320
false and now I'll

15
00:32.320 --> 00:37.500
define my tasks. So the task here is simply print a message with a specified

16
00:37.500 --> 00:38.640
verbosity. All we're

17
00:38.640 --> 00:42.530
going to do is use the Ansible built in a debug module and the message I'm

18
00:42.530 --> 00:43.760
going to print is going

19
00:43.760 --> 00:48.130
to be validation check and I'm going to specify that this only runs at a verb

20
00:48.130 --> 00:50.400
osity of three or above.

21
00:50.400 --> 00:56.960
So we need to specify effectively dash vvv or dash vvvv. Okay, so let's just

22
00:56.960 --> 00:57.840
write this out.

23
00:57.840 --> 01:02.070
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

23
00:57.840 --> 01:02.070
And if we try to run the validation playbook on its own without any options,

24
01:02.070 --> 01:02.640
nothing is going to

25
01:02.640 --> 01:07.020
print and if I run it with say for example, two V's still nothing is going to

26
01:07.020 --> 01:08.160
print. We have not

27
01:08.160 --> 01:12.440
met the threshold that is correct. However, once we get to three V's and I

28
01:12.440 --> 01:13.680
enter now the playbook

29
01:13.680 --> 01:17.000
is going to print the message and again, if I go with dash four V's again, we

30
01:17.000 --> 01:17.520
're going to see

31
01:17.520 --> 01:21.200
the same message as printed. So that's the first playbook. Let's create another

32
01:21.200 --> 01:22.240
one called validation

33
01:22.240 --> 01:26.150
two dot yml. Let's just give this a name of validation to this time target any

34
01:26.150 --> 01:26.960
host you so

35
01:26.960 --> 01:30.970
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

35
01:26.960 --> 01:30.970
wish I will target the blue box device here as gain I will set my gather facts

36
01:30.970 --> 01:31.840
to be false.

37
01:31.840 --> 01:36.600
And now specify my tasks give this one a name. And I'll just say install the 80

38
01:36.600 --> 01:38.160
DPD package.

39
01:38.160 --> 01:42.440
Perfect. So I'm going to use the Ansible built in DNF module and the name is

40
01:42.440 --> 01:44.160
going to be 80 DPD

41
01:44.160 --> 01:48.620
and the state should be present. Now, all we do is save this. And now the next

42
01:48.620 --> 01:49.760
part of this particular

43
01:49.760 --> 01:53.450
challenge is specifying that we have to run this playbook, but ensure that no

44
01:53.450 --> 01:54.400
changes are made to

45
01:54.400 --> 01:58.360
the live device by invoking a simulation run. So if I run this playbook, but I

46
01:58.360 --> 01:59.520
just specified dash

47
01:59.520 --> 02:03.340
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

47
01:59.520 --> 02:03.340
dash check and to enter and whilst it might appear that the installation is

48
02:03.340 --> 02:04.240
going to happen,

49
02:04.240 --> 02:09.130
all Ansible is doing is effectively checking the status of the 80 DB package.

50
02:09.130 --> 02:10.320
So it simulates that

51
02:10.320 --> 02:14.940
a change was made. But like I say, this is a pure simulation. If we go to the

52
02:14.940 --> 02:16.000
device itself,

53
02:16.000 --> 02:21.570
if I check the status of 80 DPD, notice this service is not on the system. The

54
02:21.570 --> 02:22.320
change was not

55
02:22.320 --> 02:25.500
actually applied just and merely simulated. Now the last time we're going to do

56
02:25.500 --> 02:26.080
it to check the

57
02:26.080 --> 02:29.850
syntax of both playbooks. And we want to check them at the same time and

58
02:29.850 --> 02:31.040
neither should actually
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

58
02:29.850 --> 02:31.040
neither should actually

59
02:31.040 --> 02:35.100
execute. So I'm going to do here as I will say Ansible playbook. And I'm going

60
02:35.100 --> 02:36.160
to use validation

61
02:36.160 --> 02:41.350
and then a wild card to specify either validation one or validation to dot yml.

62
02:41.350 --> 02:41.760
And then I'm just

63
02:41.760 --> 02:46.800
going to say dash dash syntax dash check and to enter. And as we can see here,

64
02:46.800 --> 02:48.480
both files have passed

65
02:48.480 --> 02:52.120
the validation check alternative what you also could have done is just specify

66
02:52.120 --> 02:52.960
each playbook,

67
02:52.960 --> 02:58.110
name by name. And then once again, specified syntax check, if I enter notice we

68
02:58.110 --> 02:58.800
get the same

69
02:58.800 --> 03:03.440
results. So that is us for our validation challenge on troubleshooting Ansible.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

69
02:58.800 --> 03:03.440
results. So that is us for our validation challenge on troubleshooting Ansible.

70
03:03.440 --> 03:04.000
I hope it's been

71
03:04.000 --> 03:06.480
of the Enrollment Authority, and I'd like to thank you for viewing.
