WEBVTT

1
00:00.000 --> 00:02.640
So friends, let's walk through the solution then.

2
00:02.640 --> 00:06.400
So the very first thing that I asked you to do was to add a new disk to one of

3
00:06.400 --> 00:10.200
your managed virtual machines and select a disk size of your own choosing.

4
00:10.200 --> 00:14.000
So in my case here, I'm going to go to my yellow box this time.

5
00:14.000 --> 00:16.600
I'm just going to make sure that the system is powered off first.

6
00:16.600 --> 00:20.410
Perfect and now it's powered off. I'm going to go to my settings, go to hard

7
00:20.410 --> 00:20.720
disk.

8
00:20.720 --> 00:25.980
I will add a device, select new hard disk, then add, and I'm going to choose a

9
00:25.980 --> 00:29.120
disk size of, let's just say, 1 gig and choose apply.

10
00:29.120 --> 00:33.320
Now I've done that. I will press exit and begin to put the machine.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

10
00:29.120 --> 00:33.320
Now I've done that. I will press exit and begin to put the machine.

11
00:33.320 --> 00:37.600
So the second part of the task is I have to use the part model to create the

12
00:37.600 --> 00:43.000
first partition on this disk and use 75% of the available disk space.

13
00:43.000 --> 00:47.840
So what I will do is I will create a playbook. Let's call this validation1.YML.

14
00:47.840 --> 00:51.610
Going to insert mode, have my three hyphens at the top. Give it a name, let's

15
00:51.610 --> 00:53.000
just say validation1.

16
00:53.000 --> 00:56.520
The host I'm going to target, I will just target my yellow box right here.

17
00:56.520 --> 00:59.770
And in my case here, I will just say gather facts is equal to false because I'm

18
00:59.770 --> 01:01.320
just targeting the one device.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

18
00:59.770 --> 01:01.320
just targeting the one device.

19
01:01.320 --> 01:05.760
So now I will define my task or give it a task a name and I'll just say create

20
01:05.760 --> 01:07.640
a partition, the target.

21
01:07.640 --> 01:12.720
So I'm going to have to use as the community dot general dot parted module.

22
01:12.720 --> 01:15.640
And I'm going to have to specify the device that I've just created.

23
01:15.640 --> 01:20.640
So over on my target machine, if I just say pseudo parted dash L, type in my

24
01:20.640 --> 01:22.360
password, we can see here,

25
01:22.360 --> 01:26.430
the name of the disk is this one right here again on your system, it might be

26
01:26.430 --> 01:27.320
different.

27
01:27.320 --> 01:31.720
So over on the control mode, I will type in the device I'm targeting is dev NVM
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

27
01:27.320 --> 01:31.720
So over on the control mode, I will type in the device I'm targeting is dev NVM

28
01:31.720 --> 01:33.000
E 0.0.

29
01:33.000 --> 01:36.040
I will specify the partition number will be number one.

30
01:36.040 --> 01:40.440
The state is going to be present and the part end, I will specify that I want

31
01:40.440 --> 01:43.480
to use 75% of the disk space.

32
01:43.480 --> 01:48.520
So all I will do here is say I'm going to use 75% and if I just save this right

33
01:48.520 --> 01:49.000
here

34
01:49.000 --> 01:53.240
and I run the playbook and to enter as we can see here, we now have a change.

35
01:53.240 --> 01:58.120
If I go to my device and I know arrow up and say pseudo parted dash L as we can

36
01:58.120 --> 01:58.360
see here,

37
01:58.360 --> 02:03.410
we have created my partition there is the full size and I am using 75% of that
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

37
01:58.360 --> 02:03.410
we have created my partition there is the full size and I am using 75% of that

38
02:03.410 --> 02:04.520
available size.

39
02:04.520 --> 02:07.240
Now I'm going to have to do it to delete the content of the partitions.

40
02:07.240 --> 02:12.680
I'll just say pseudo parted and I'll just say dev NVME 0.0.

41
02:12.680 --> 02:17.000
Now just say RM one which will remove partition number one right here and then

42
02:17.000 --> 02:17.960
I'll say quits

43
02:17.960 --> 02:22.760
and now we should be back to as we saw before an empty partition right here.

44
02:22.760 --> 02:26.120
So now I'm going to have to add a second disk of my own choosing.

45
02:26.120 --> 02:29.000
So all I will do right now is I'll shut down the machine once again.

46
02:29.000 --> 02:31.560
Oh, that appears the answer will use it as logged on of course.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

46
02:29.000 --> 02:31.560
Oh, that appears the answer will use it as logged on of course.

47
02:31.560 --> 02:34.840
So I just did know that and forced to shut down and if I go back to my yellow

48
02:34.840 --> 02:35.160
box,

49
02:35.160 --> 02:36.520
I'll add a new device again.

50
02:36.520 --> 02:40.920
So I'll go to hard disk once again choose add device new hard disk.

51
02:40.920 --> 02:43.640
So this time I'll just choose let's maybe go with 5 gig.

52
02:43.640 --> 02:47.480
It doesn't actually matter the size and let's close this and start up the

53
02:47.480 --> 02:48.520
device once again.

54
02:48.520 --> 02:51.740
So what I'm now going to have to do is I'm going to have to use the relevant L

55
02:51.740 --> 02:52.840
VM modules

56
02:52.840 --> 02:57.580
to create a volume group called validation hyphen vg that uses the two new

57
02:57.580 --> 02:59.160
disks as pvs.

58
02:59.160 --> 03:03.080
So I will just go in and create a new playbook save validation to dot yml.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

58
02:59.160 --> 03:03.080
So I will just go in and create a new playbook save validation to dot yml.

59
03:03.080 --> 03:06.230
Again, let's follow the same format three hyphens just to the name is

60
03:06.230 --> 03:07.640
validation to the host

61
03:07.640 --> 03:10.040
our target will just be the yellow box once again.

62
03:10.040 --> 03:13.720
I'll set gather facts to false even though it's not necessary and I'll specify

63
03:13.720 --> 03:14.360
my tasks.

64
03:14.360 --> 03:18.120
So the task here is going to be create a volume group.

65
03:18.120 --> 03:23.240
So the module to create a volume group will be community dot general dot lvg.

66
03:23.240 --> 03:27.240
I'm going to specify that the state will be presence and I specify that the vg

67
03:27.240 --> 03:27.800
name

68
03:27.800 --> 03:31.160
is going to be validation hyphen vg.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

68
03:27.800 --> 03:31.160
is going to be validation hyphen vg.

69
03:31.160 --> 03:35.320
Now specify my physical volumes are going to be part of this particular volume

70
03:35.320 --> 03:35.640
group

71
03:35.640 --> 03:40.360
in the form of a list and the first this will be dev nvm e zero enter and the

72
03:40.360 --> 03:41.320
second one will be

73
03:41.320 --> 03:44.520
dev nvm e zero n three.

74
03:44.520 --> 03:47.160
So that will create my volume group called validation vg.

75
03:47.160 --> 03:49.640
Now I want to create a logical volume from that group.

76
03:49.640 --> 03:55.480
So let's get this new task and name just to create a lv from vg the module this

77
03:55.480 --> 03:55.960
time will be

78
03:55.960 --> 03:57.560
community general lv.

79
03:57.560 --> 04:02.310
And I specify the vg I want to be carving out will be the validation hyphen vg
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

79
03:57.560 --> 04:02.310
And I specify the vg I want to be carving out will be the validation hyphen vg

80
04:02.310 --> 04:02.840
group

81
04:02.840 --> 04:08.520
and the lv as per the direction is going to be called validation hyphen lv

82
04:08.520 --> 04:12.440
and the size is going to be 60% of the free space.

83
04:12.440 --> 04:14.360
So let's just write and quit.

84
04:14.360 --> 04:19.320
Let's try to run the playbook right here and to enter we create the vg as well

85
04:19.320 --> 04:19.720
as the

86
04:19.720 --> 04:24.920
lv now if I go to my device right here if I say pseudo vgs type in my password

87
04:24.920 --> 04:25.800
we can see I have

88
04:25.800 --> 04:30.880
my validation vg group and if I say pseudo lvs we can indeed see here we have
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

88
04:25.800 --> 04:30.880
my validation vg group and if I say pseudo lvs we can indeed see here we have

89
04:30.880 --> 04:31.640
my validation

90
04:31.640 --> 04:37.240
lv car from that validation vg group and I am using 60% of the size.

91
04:37.240 --> 04:41.160
So that is us for our challenge on automating storage with Ansible.

92
04:41.160 --> 04:44.440
I hope it's been informative for you and I'd like to thank you for viewing.
