WEBVTT

1
00:00.000 --> 00:02.800
So let's walk through the validation solution.

2
00:02.800 --> 00:06.000
So the very first thing that we're going to have to do is to take a copy of the

3
00:06.000 --> 00:08.000
play to dot yml file.

4
00:08.000 --> 00:10.700
If I do an ls, here is the file right here.

5
00:10.700 --> 00:15.860
If I just create a copy of it and I need to create a file called validation dot

6
00:15.860 --> 00:16.200
yml.

7
00:16.200 --> 00:20.120
Now I'm going to modify the contents of this playbook so that it uses the

8
00:20.120 --> 00:22.400
assert module instead of the debug module.

9
00:22.400 --> 00:24.600
So let's go into the validation dot yml.

10
00:24.600 --> 00:27.100
As we can see here, we're using the debug module.

11
00:27.100 --> 00:31.400
So right now I will just go down here, I'll create a new task and I'll just say
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

11
00:27.100 --> 00:31.400
So right now I will just go down here, I'll create a new task and I'll just say

12
00:31.400 --> 00:37.000
this task will be called assert the value of free memory is above 100.

13
00:37.000 --> 00:40.100
So in this case here, I will use the Ansible built in assert module.

14
00:40.100 --> 00:42.600
The require parameter is the that keyword.

15
00:42.600 --> 00:46.400
And now what I want to do is basically take this test here that we were using

16
00:46.400 --> 00:47.400
in the when statement.

17
00:47.400 --> 00:51.600
Okay, so let's copy this and paste it in and what I now want to do to specify

18
00:51.600 --> 00:53.900
what my success message is going to be.

19
00:53.900 --> 00:59.730
So right now I will say the free memory is above 100 make and then I'll add in

20
00:59.730 --> 01:00.800
the value as well.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

20
00:59.730 --> 01:00.800
the value as well.

21
01:00.800 --> 01:04.860
So I'll have my double color braces and the value is going to be the free

22
01:04.860 --> 01:05.900
memory variable.

23
01:05.900 --> 01:09.480
So I'll say free underscore memory and to get the actual output, I will say dot

24
01:09.480 --> 01:10.300
STD out.

25
01:10.300 --> 01:15.160
Now very similar, I also want to have a fail message or say fail underscore MSG

26
01:15.160 --> 01:15.200
.

27
01:15.200 --> 01:16.800
In fact, it's not a typo there.

28
01:16.800 --> 01:17.800
Let me just fix that.

29
01:17.800 --> 01:18.800
Okay.

30
01:18.800 --> 01:23.000
And this time I'll say the free memory is below 100 M.

31
01:23.000 --> 01:27.390
And then once again, I will specify the value and just for posterity, all I

32
01:27.390 --> 01:29.600
will do is I'll go up and change the name of the playbook.

33
01:29.600 --> 01:31.100
So it says validation.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

33
01:29.600 --> 01:31.100
So it says validation.

34
01:31.100 --> 01:34.610
And then the last thing I will do is just get read of this debug module

35
01:34.610 --> 01:35.500
information.

36
01:35.500 --> 01:39.880
And in fact, before I run this, because I'm accepting that the value is above

37
01:39.880 --> 01:40.800
100,

38
01:40.800 --> 01:45.270
what I'm going to have to do is just make sure that this value here is not less

39
01:45.270 --> 01:47.800
than 100, but rather greater than 100.

40
01:47.800 --> 01:50.740
So if it is greater and it is deemed successful, we'll print out this

41
01:50.740 --> 01:53.200
particular message that it is greater than 100.

42
01:53.200 --> 01:57.590
And if we are failing this particular test, we can adjust that the memory is

43
01:57.590 --> 01:58.700
below 100.

44
01:58.700 --> 02:00.300
So let's actually save this right here.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

44
01:58.700 --> 02:00.300
So let's actually save this right here.

45
02:00.300 --> 02:01.700
And let's just try to run the playbook.

46
02:01.700 --> 02:05.100
We'll say answer my playbook validation that YML answer.

47
02:05.100 --> 02:08.930
And as we can see here, now we're actually using the asset module to run this

48
02:08.930 --> 02:10.000
particular test.

49
02:10.000 --> 02:14.100
Both tests have passed because both tests are over 100.

50
02:14.100 --> 02:18.160
Now, if I just go to my blue box once again, and if I just run the same test as

51
02:18.160 --> 02:23.200
I ran before my stress and G dash dash VM two dash dash VM bytes one G and I

52
02:23.200 --> 02:24.100
answer,

53
02:24.100 --> 02:27.400
I'm now beginning to stress the memory on the system.

54
02:27.400 --> 02:31.000
So that if I happen to go back to my playbook and I clear the screen and rerun
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

54
02:27.400 --> 02:31.000
So that if I happen to go back to my playbook and I clear the screen and rerun

55
02:31.000 --> 02:31.600
the test,

56
02:31.600 --> 02:35.300
we should have a different output with respect to our blue box.

57
02:35.300 --> 02:38.660
So let's hit enter now as we can see here now when it comes to the assertion of

58
02:38.660 --> 02:39.400
the blue box,

59
02:39.400 --> 02:42.600
we actually get a failure in the case here in our custom message.

60
02:42.600 --> 02:47.620
We see that we only have 29 meg, whereas our yellow box still has plenty memory

61
02:47.620 --> 02:50.800
over the 100 meg specification.

62
02:50.800 --> 02:55.120
And very crucially, like I say in the play recap, we actually see a failure

63
02:55.120 --> 02:55.600
update.

64
02:55.600 --> 03:00.390
So that is us for our validation challenge on testing and monitoring using Ans
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

64
02:55.600 --> 03:00.390
So that is us for our validation challenge on testing and monitoring using Ans

65
03:00.390 --> 03:00.800
ible.

66
03:00.800 --> 03:03.800
I hope it's been informative for you and I'd like to thank you for viewing.
