WEBVTT

1
00:00.000 --> 00:03.160
So friends here is the validation solution.

2
00:03.160 --> 00:06.800
So what I've done at the beginning is I have added two new disks to one of my

3
00:06.800 --> 00:07.320
devices

4
00:07.320 --> 00:11.280
and my case here, the blue box device and they are both of the same size.

5
00:11.280 --> 00:16.480
We can see here we have NVMe 0.0, as well as NVMe 0.3.

6
00:16.480 --> 00:19.080
So what I'm going to do is I'm going to have to create a playbook that is going

7
00:19.080 --> 00:19.680
to construct

8
00:19.680 --> 00:22.720
a straight read array using these hard drives.

9
00:22.720 --> 00:26.480
Recall, a straight array is going to be read level zero.

10
00:26.480 --> 00:28.920
It provides zero fault tolerance.

11
00:28.920 --> 00:30.280
So let's go and do that then.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

11
00:28.920 --> 00:30.280
So let's go and do that then.

12
00:30.280 --> 00:33.560
So let's create a playbook called validation1.yml.

13
00:33.560 --> 00:37.120
Going to insert mode, have our three hyphens at the top, give the playbook a

14
00:37.120 --> 00:37.560
name.

15
00:37.560 --> 00:39.800
And we'll just call this validation1.

16
00:39.800 --> 00:43.460
Now the host I'm going to target, I'll just target the blue box and I'll set

17
00:43.460 --> 00:44.120
gather facts

18
00:44.120 --> 00:45.280
to be false.

19
00:45.280 --> 00:47.000
Now I'll define my tasks.

20
00:47.000 --> 00:52.160
So I'll give the task a name and I'll just say create a straight array.

21
00:52.160 --> 00:55.240
So I'm going to use the Ansible built-in shell module right here.

22
00:55.240 --> 00:58.400
I'll have my pipe symbol and I'm just going to echo in yes.

23
00:58.400 --> 01:04.200
To the command MDADM dash dash creates forward slash dev MD zero.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

23
00:58.400 --> 01:04.200
To the command MDADM dash dash creates forward slash dev MD zero.

24
01:04.200 --> 01:07.800
And I'm going to say level is equal to zero that will create our straight to

25
01:07.800 --> 01:08.160
read.

26
01:08.160 --> 01:10.720
And then I'll specify that the read devices is equal to two.

27
01:10.720 --> 01:18.240
And those devices will be dev NVMe 0.0 and forward slash dev NVMe 0.3.

28
01:18.240 --> 01:22.280
Next I want to create a file system on the reader and that's going to be an XFS

29
01:22.280 --> 01:23.080
file system.

30
01:23.080 --> 01:27.730
So I'll use the Ansible built-in file system module and the file system type

31
01:27.730 --> 01:28.360
will be XFS

32
01:28.360 --> 01:33.400
and the device that I want to target is going to be forward slash dev MD zero.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

32
01:28.360 --> 01:33.400
and the device that I want to target is going to be forward slash dev MD zero.

33
01:33.400 --> 01:36.120
Now what I want to do is I want to create the mount point.

34
01:36.120 --> 01:38.800
So I'm going to use the Ansible built-in file module.

35
01:38.800 --> 01:43.960
Now the path is going to be forward slash mnt forward slash validate hyphen

36
01:43.960 --> 01:44.760
rate.

37
01:44.760 --> 01:47.400
And the state here is going to be a directory.

38
01:47.400 --> 01:49.680
Now I want to mount the array.

39
01:49.680 --> 01:53.780
So I'll use the Ansible POSIX mount module and the path is going to be in

40
01:53.780 --> 01:54.440
forward slash

41
01:54.440 --> 01:57.560
mnt forward slash validate hyphen rate.

42
01:57.560 --> 01:59.800
The source is going to be dev nd0.

43
01:59.800 --> 02:02.240
The file system type will be XFS.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

43
01:59.800 --> 02:02.240
The file system type will be XFS.

44
02:02.240 --> 02:03.600
And now we specify the state.

45
02:03.600 --> 02:08.540
Now remember we want the file system to mount immediately as well as to persist

46
02:08.540 --> 02:09.160
through

47
02:09.160 --> 02:10.160
reboots.

48
02:10.160 --> 02:13.250
Now this is a bit of a callback to a previous scale where we discussed the

49
02:13.250 --> 02:13.960
automation of

50
02:13.960 --> 02:14.960
file systems.

51
02:14.960 --> 02:18.990
But if you remember if we specify the mounted keyword this will actually mount

52
02:18.990 --> 02:19.760
the file system

53
02:19.760 --> 02:24.840
immediately and modify XFS tab to ensure there are auto mounts on reboot.

54
02:24.840 --> 02:26.440
So let's save these changes.

55
02:26.440 --> 02:27.800
And let's run the playbook.

56
02:27.800 --> 02:31.300
So we create the array, we create the file system and the mount point and then
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

56
02:27.800 --> 02:31.300
So we create the array, we create the file system and the mount point and then

57
02:31.300 --> 02:31.760
finally

58
02:31.760 --> 02:32.920
mount the array.

59
02:32.920 --> 02:36.010
So now what we're going to have to do is to create a playbook that is going to

60
02:36.010 --> 02:36.360
check

61
02:36.360 --> 02:39.850
that there are no failed devices in the raid array and the playbook should

62
02:39.850 --> 02:40.840
print it a message

63
02:40.840 --> 02:44.640
specifying whether the test passed or failed for each device.

64
02:44.640 --> 02:48.240
So let's create a new playbook let's just call this validation to .YML.

65
02:48.240 --> 02:52.440
We'll target the same device in my case here that we the blue box let's say

66
02:52.440 --> 02:52.960
gather facts

67
02:52.960 --> 02:55.720
is false and now let's define our tasks.

68
02:55.720 --> 02:59.230
So we're going to send the command and capture the output we use the Ansible

69
02:59.230 --> 03:00.120
built in command
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

69
02:59.230 --> 03:00.120
built in command

70
03:00.120 --> 03:05.870
module and the command I'm going to send is going to be MDADM dash dash detail

71
03:05.870 --> 03:07.680
on dev MD0

72
03:07.680 --> 03:11.880
and I want to register that output and I'll just save this as a raid underscore

73
03:11.880 --> 03:12.320
output.

74
03:12.320 --> 03:15.190
Now it'll create a task that is going to print any failures and I'll use the

75
03:15.190 --> 03:15.680
Ansible

76
03:15.680 --> 03:21.920
built in debug module and the message is going to be raid failure on MD0 for

77
03:21.920 --> 03:22.320
and I'm going

78
03:22.320 --> 03:26.600
to populate the name of the device within the inventory using my inventory host

79
03:26.600 --> 03:26.920
name

80
03:26.920 --> 03:28.000
magic variable.

81
03:28.000 --> 03:31.530
So we're going to have to use our when conditional statement to ensure that
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

81
03:28.000 --> 03:31.530
So we're going to have to use our when conditional statement to ensure that

82
03:31.530 --> 03:32.480
this message only

83
03:32.480 --> 03:34.920
ever prints when a failure is detected.

84
03:34.920 --> 03:41.940
So I'm going to specify that when I see failed devices colon zero when that is

85
03:41.940 --> 03:42.720
not in the

86
03:42.720 --> 03:45.200
raid output dot STD out.

87
03:45.200 --> 03:48.520
So here is the thing this is pretty similar to what we saw before earlier on

88
03:48.520 --> 03:49.160
within this

89
03:49.160 --> 03:50.160
skill.

90
03:50.160 --> 03:54.430
However in the validation test we don't just want to print out failures we want

91
03:54.430 --> 03:54.920
to also

92
03:54.920 --> 03:58.920
print out when the actual device happens to have a pass.

93
03:58.920 --> 04:02.180
So what I'm going to do here is I'm going to effectively create another task
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

93
03:58.920 --> 04:02.180
So what I'm going to do here is I'm going to effectively create another task

94
04:02.180 --> 04:02.640
but simply

95
04:02.640 --> 04:03.640
invert the logic.

96
04:03.640 --> 04:07.340
So I'll say name and this one can be print passes and I'll use the Ansible

97
04:07.340 --> 04:08.240
built in debug

98
04:08.240 --> 04:09.600
module once again.

99
04:09.600 --> 04:13.440
This thing the message will be something like say raid check has passed on and

100
04:13.440 --> 04:13.960
I'll pass

101
04:13.960 --> 04:17.000
in the inventory host name magic variable once again.

102
04:17.000 --> 04:21.110
And the difference is is that I only want to print this test when I'm going to

103
04:21.110 --> 04:21.680
copy this

104
04:21.680 --> 04:26.330
conditional statement once again to paste this in and all I'm going to do is I

105
04:26.330 --> 04:26.800
'm going

106
04:26.800 --> 04:31.990
to take out the not keyword so pretty much if we actually see failed devices
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

106
04:26.800 --> 04:31.990
to take out the not keyword so pretty much if we actually see failed devices

107
04:31.990 --> 04:32.720
equal zero

108
04:32.720 --> 04:36.360
in the raid output then we want to print out this pass message.

109
04:36.360 --> 04:39.360
So let's save this and let's run the test.

110
04:39.360 --> 04:43.280
So we hit enter and as we can see here we have skipped the failure because we

111
04:43.280 --> 04:43.880
don't have

112
04:43.880 --> 04:47.740
any failures for this device and we can see here it says the raid check has

113
04:47.740 --> 04:48.320
passed on

114
04:48.320 --> 04:52.830
the blue box and similar to what we saw before if the device happens to fail

115
04:52.830 --> 04:53.320
then the other

116
04:53.320 --> 04:57.330
logic will be activated and we will instead print out that the raid check has

117
04:57.330 --> 04:57.920
failed for

118
04:57.920 --> 04:59.400
that particular device.

119
04:59.400 --> 05:01.800
So that is us for our validation check.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

119
04:59.400 --> 05:01.800
So that is us for our validation check.

120
05:01.800 --> 05:04.880
I hope it's been informative for you and I'd like to thank you for viewing.
