WEBVTT

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

2
00:03.080 --> 00:06.040
So the very first thing that I'm going to have to do is I'm going to have to

3
00:06.040 --> 00:09.120
create a playbook called validation.yml

4
00:09.120 --> 00:13.020
that is going to install the system tools group package on one of my managed

5
00:13.020 --> 00:13.440
nodes.

6
00:13.440 --> 00:15.360
So with that said, let's go and do that.

7
00:15.360 --> 00:20.420
So we create playbook called validation.yml and I'm going to insert mode, have

8
00:20.420 --> 00:21.680
my three hyphens at the top

9
00:21.680 --> 00:25.200
and I'll give this playbook a name and I'll just call this one validation one.

10
00:25.200 --> 00:27.360
Again, super original, you know me.

11
00:27.360 --> 00:31.690
And my host, I'm going to target in my topology, I will target the blue box,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

11
00:27.360 --> 00:31.690
And my host, I'm going to target in my topology, I will target the blue box,

12
00:31.690 --> 00:33.760
but choose anyone you so wish.

13
00:33.760 --> 00:36.900
So now I'm going to do here as I'm going to specify that I'm going to gather

14
00:36.900 --> 00:37.200
facts,

15
00:37.200 --> 00:40.080
what we said to false, we don't actually need those facts for this particular

16
00:40.080 --> 00:40.560
play.

17
00:40.560 --> 00:42.960
And now I'm going to define my tasks.

18
00:42.960 --> 00:46.960
So in the case here, I will give this task a name and I'll just say install

19
00:46.960 --> 00:49.120
group package with DNF.

20
00:49.120 --> 00:54.970
So I'll use my Ansible built in DNF module and I'll specify the name is going

21
00:54.970 --> 00:55.440
to be

22
00:55.440 --> 00:59.600
and what am I going to use? I'm going to have my at symbol and then I will say

23
00:59.600 --> 01:01.520
system space tools.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

23
00:59.600 --> 01:01.520
system space tools.

24
01:01.520 --> 01:05.840
And then all I will do here is specify that the state should be present.

25
01:05.840 --> 01:09.210
So really simple. If I just write and collect, let's say answer will playbook

26
01:09.210 --> 01:10.560
validation.yml

27
01:10.560 --> 01:14.800
and to enter and just give it some time because as it stands, we should be

28
01:14.800 --> 01:15.840
installing multiple

29
01:15.840 --> 01:19.720
different packages. Perfect. So if I go over to my blue box right here and I

30
01:19.720 --> 01:21.680
now say DNF group list

31
01:21.680 --> 01:26.230
and to enter as we can see within my installed groups, top of the list, we can

32
01:26.230 --> 01:27.360
see the system

33
01:27.360 --> 01:31.210
tools group. Perfect. So that's the first task and now complete. What I'm now
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

33
01:27.360 --> 01:31.210
tools group. Perfect. So that's the first task and now complete. What I'm now

34
01:31.210 --> 01:32.080
going to do is to go

35
01:32.080 --> 01:35.770
back to my terminal here. I'm now going to write the second playbook to

36
01:35.770 --> 01:37.040
configure my server.

37
01:37.040 --> 01:41.120
So this playbook here should be called validation to yml and it's going to

38
01:41.120 --> 01:42.400
configure this Ansible

39
01:42.400 --> 01:48.580
control node to act as that local repository. So I'll just say them validation

40
01:48.580 --> 01:49.120
to yml,

41
01:49.120 --> 01:52.360
going to insert mode, have our three hyphens at the top. And the name of this

42
01:52.360 --> 01:52.720
playbook,

43
01:52.720 --> 01:56.750
you guessed it, it's going to be validation to now for the host. I'm going to

44
01:56.750 --> 01:58.000
target the local host

45
01:58.000 --> 02:02.410
because it's going to be applied to the local server and now specify gather
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

45
01:58.000 --> 02:02.410
because it's going to be applied to the local server and now specify gather

46
02:02.410 --> 02:03.520
facts should be the

47
02:03.520 --> 02:08.160
value false. Now I'll define my tasks and the name of the first task or just

48
02:08.160 --> 02:09.120
simply be install

49
02:09.120 --> 02:13.740
packages. Then I'll use Ansible built in DNF and now I specify the list of

50
02:13.740 --> 02:14.960
names of the packages

51
02:14.960 --> 02:18.650
that I need to install. So remember, we're going to be installing an ftpd

52
02:18.650 --> 02:19.920
server. So we need to have

53
02:19.920 --> 02:23.800
that daemon as well as an order to be able to create the necessary metadata for

54
02:23.800 --> 02:25.280
the repo to operate.

55
02:25.280 --> 02:29.520
We want to have access to the create repo command. So I'll specify that I want

56
02:29.520 --> 02:30.800
to install the create
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

56
02:29.520 --> 02:30.800
to install the create

57
02:30.800 --> 02:34.690
repo C library, then I'll specify the state should be present. And now I'm

58
02:34.690 --> 02:36.880
going to start my ftp server.

59
02:36.880 --> 02:40.550
So you guessed I'm going to use the Ansible built in service module. The name

60
02:40.550 --> 02:41.520
of the service I want

61
02:41.520 --> 02:46.860
to start will be vs ftpd. And the state is going to be started and enabled will

62
02:46.860 --> 02:47.920
be set to yes.

63
02:47.920 --> 02:52.120
So now I'm going to configure my firewall here. So I'll use the Ansible POSIX

64
02:52.120 --> 02:53.760
firewall D module

65
02:53.760 --> 02:58.140
now. The service will be ftp. The state is going to be enabled and I'll set the

66
02:58.140 --> 02:59.440
value permanent to be

67
02:59.440 --> 03:03.870
yes, so that these rows are persistent. Now recall what I want to do here is
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

67
02:59.440 --> 03:03.870
yes, so that these rows are persistent. Now recall what I want to do here is

68
03:03.870 --> 03:04.800
because I've made a

69
03:04.800 --> 03:10.220
change onto my firewall, I want to notify a handler so that any changes are

70
03:10.220 --> 03:11.280
reloaded. So I'll

71
03:11.280 --> 03:15.040
have a handler called reload firewall, I'll get to that later on. Now I'm going

72
03:15.040 --> 03:16.240
to create my repo

73
03:16.240 --> 03:21.400
directory. So I will use the Ansible built in file module. And the path here is

74
03:21.400 --> 03:22.480
going to be within

75
03:22.480 --> 03:27.460
the var directory and then ftp. And the directory is going to be called valid

76
03:27.460 --> 03:28.800
repo. Now I want to

77
03:28.800 --> 03:32.300
specify that this is going to be a directory. So I'll use the state parameter.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

77
03:28.800 --> 03:32.300
specify that this is going to be a directory. So I'll use the state parameter.

78
03:32.300 --> 03:33.360
And now I'm going to

79
03:33.360 --> 03:38.340
download the HTTP package that I can actually serve. So once again, I'm going

80
03:38.340 --> 03:39.520
to use the Ansible

81
03:39.520 --> 03:44.240
built in DNF module, the name of the package is going to be 80 dpd. The

82
03:44.240 --> 03:45.760
download directory is

83
03:45.760 --> 03:49.830
going to be your guest that's going to be forward slash var forward slash ftp

84
03:49.830 --> 03:51.200
forward slash valid

85
03:51.200 --> 03:54.880
repo. And now I specify that I only want to download the package but not

86
03:54.880 --> 03:55.760
install it. So I'll

87
03:55.760 --> 04:00.210
set download only to the Boolean value of true. Now I'm going to issue the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

87
03:55.760 --> 04:00.210
set download only to the Boolean value of true. Now I'm going to issue the

88
04:00.210 --> 04:01.680
create repo command.

89
04:01.680 --> 04:05.920
So I'll use the Ansible built in command module. And I'll use the cmd parameter

90
04:05.920 --> 04:07.120
to run the command

91
04:07.120 --> 04:14.160
create repo on var ftp forward slash valid repo. And now I have to define my

92
04:14.160 --> 04:15.040
handlers. So at the

93
04:15.040 --> 04:18.940
same level of indentation as I define my tasks, I must specify the name and I'm

94
04:18.940 --> 04:20.080
going to sync it up

95
04:20.080 --> 04:24.600
with the name of the notify keyword, which is going to be reload firewall. And

96
04:24.600 --> 04:25.200
now I'm going to use

97
04:25.200 --> 04:29.060
the Ansible built in service module. And the name of the service I want to

98
04:29.060 --> 04:30.480
reload will be firewall
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

98
04:29.060 --> 04:30.480
reload will be firewall

99
04:30.480 --> 04:35.310
D and the state is going to be reloaded. So let's just save this for the moment

100
04:35.310 --> 04:36.640
. And I'll now run

101
04:36.640 --> 04:40.790
this new playbook validation to dot y mail. And to enter so the playbook

102
04:40.790 --> 04:42.720
executes, we begin installing

103
04:42.720 --> 04:48.060
the packages and now we begin to start up the ftp server and the playbook now

104
04:48.060 --> 04:49.200
completes. So what

105
04:49.200 --> 04:54.530
I want to do here is I want to go in to my configuration file so it's a vs ftpd

106
04:54.530 --> 04:56.960
and vs ftpd.conf. And all

107
04:56.960 --> 05:01.280
I'm going to do here is comment out anonymous enable. And in fact, actually,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

107
04:56.960 --> 05:01.280
I'm going to do here is comment out anonymous enable. And in fact, actually,

108
05:01.280 --> 05:02.240
for bonus points,

109
05:02.240 --> 05:06.580
what you could have done is actually manipulate this file directly with Ansible

110
05:06.580 --> 05:07.680
by using the line

111
05:07.680 --> 05:11.200
and file module. But nevertheless, you don't have to do that if you did very,

112
05:11.200 --> 05:12.800
very impressed. So

113
05:12.800 --> 05:16.440
let's continue on. So now we're going to have our FTP directory. And then we're

114
05:16.440 --> 05:17.520
going to have the

115
05:17.520 --> 05:22.150
valid repo directory right here. And inside of here, we should have this repo

116
05:22.150 --> 05:23.440
data directory,

117
05:23.440 --> 05:27.890
as well as by the way, all of this 80dpd package information. Okay, now we're

118
05:27.890 --> 05:28.800
going to write the

119
05:28.800 --> 05:33.110
third playbook. So let's go back to our main directory. And I'll say them
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

119
05:28.800 --> 05:33.110
third playbook. So let's go back to our main directory. And I'll say them

120
05:33.110 --> 05:34.960
validation three dot y mail.

121
05:34.960 --> 05:38.560
So let's go into this again, let's get this simple heading. This will just be

122
05:38.560 --> 05:39.520
validation three,

123
05:39.520 --> 05:42.140
whom I'm going to target this time. Well, in this case, here, I'm going to

124
05:42.140 --> 05:43.120
target the blue box

125
05:43.120 --> 05:47.850
once again, I'll set gather facts to be false. And now I'll define my tasks.

126
05:47.850 --> 05:48.560
Now, previously,

127
05:48.560 --> 05:52.580
if you recall what I did was I actually configured DNS mapping for the repo

128
05:52.580 --> 05:53.920
server. This is a more

129
05:53.920 --> 05:58.000
elegant solution. But like I said, you do not actually have to do it. So if you

130
05:58.000 --> 05:58.640
did add in this

131
05:58.640 --> 06:01.850
particular task, then very, very good. But ultimately, you don't have to. And
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

131
05:58.640 --> 06:01.850
particular task, then very, very good. But ultimately, you don't have to. And

132
06:01.850 --> 06:02.480
in fact, to

133
06:02.480 --> 06:05.910
demonstrate that I'm just going to leave it out right here. So all I will do

134
06:05.910 --> 06:06.960
here is instead just

135
06:06.960 --> 06:10.770
move directly into installing the FTP clients. So what we're going to use, I'm

136
06:10.770 --> 06:11.440
going to say

137
06:11.440 --> 06:16.680
Ansible, built in DNF. And the name of the service I want to install is going

138
06:16.680 --> 06:17.360
to be FTP.

139
06:17.360 --> 06:22.450
And the states is going to be present. The next task is going to be configure

140
06:22.450 --> 06:22.800
the local

141
06:22.800 --> 06:26.660
repository. And this time, I'm going to use the Ansible built in young

142
06:26.660 --> 06:28.880
underscore repository

143
06:28.880 --> 06:33.360
module. Now the name of the repository, as per instructions should actually be
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

143
06:28.880 --> 06:33.360
module. Now the name of the repository, as per instructions should actually be

144
06:33.360 --> 06:33.840
called

145
06:33.840 --> 06:38.080
my local repo here. So that's what we'll do give this a description of anything

146
06:38.080 --> 06:39.040
you so wish,

147
06:39.040 --> 06:44.910
just say validation repo. And now specify the base URL. So I'm going to specify

148
06:44.910 --> 06:45.920
FTP colon

149
06:45.920 --> 06:50.140
forward slash forward slash. And because I don't have my DNS mapping, what I'm

150
06:50.140 --> 06:50.800
going to do is I'm

151
06:50.800 --> 06:54.400
going to specify the IP address of the server. So in my case, here on my

152
06:54.400 --> 06:56.080
control node, if I say IP

153
06:56.080 --> 06:59.490
adder, we can see this as the IP address that I can be reached on. So I'm going

154
06:59.490 --> 07:00.640
to copy this here,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

154
06:59.490 --> 07:00.640
to copy this here,

155
07:00.640 --> 07:05.160
and I'll just paste this in, and then I'll specify forward slash and then the

156
07:05.160 --> 07:06.000
name of the actual

157
07:06.000 --> 07:10.650
repository that we created. So the repository is going to be valid repo. And we

158
07:10.650 --> 07:11.600
should also be

159
07:11.600 --> 07:16.150
ensuring that we have disabled gpg checking. So I'll say gpg check is at the

160
07:16.150 --> 07:17.600
value, no. And with

161
07:17.600 --> 07:22.400
our repository now configured, what we have to do is we want to install the 80

162
07:22.400 --> 07:23.520
DPD package from

163
07:23.520 --> 07:27.830
this repository. So I'll use the answerable built in dnf module. The name of

164
07:27.830 --> 07:29.040
the package I want to

165
07:29.040 --> 07:34.160
install is hdpd. And the state is going to be present. Okay, so moment of truth
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

165
07:29.040 --> 07:34.160
install is hdpd. And the state is going to be present. Okay, so moment of truth

166
07:34.160 --> 07:34.880
, let's go and

167
07:34.880 --> 07:39.840
try to run this particular playbook will say validation three dot yml and hit

168
07:39.840 --> 07:41.280
enter. Open appears I

169
07:41.280 --> 07:45.660
happen to have an error here. It says we can't resolve the module answerable

170
07:45.660 --> 07:46.880
built in yum rest

171
07:46.880 --> 07:50.390
positori. That's obviously a typo. So let's go back in again. This is why it's

172
07:50.390 --> 07:51.280
very important

173
07:51.280 --> 07:56.000
to actually read the output of the error messages. So let's go back in here

174
07:56.000 --> 07:57.120
going to insert mode and

175
07:57.120 --> 08:00.240
just delete this here. That looks a little bit better. So now just before I run
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

175
07:57.120 --> 08:00.240
just delete this here. That looks a little bit better. So now just before I run

176
08:00.240 --> 08:00.880
this playbook,

177
08:00.880 --> 08:05.830
I'm going to run systemctl restart vs ftpd to ensure that my anonymous login is

178
08:05.830 --> 08:06.640
going to be

179
08:06.640 --> 08:10.520
allowed. And the configuration changes are applied with that now done. I will

180
08:10.520 --> 08:10.880
just say

181
08:10.880 --> 08:15.400
answerable playbook validation three dot yml and hit enter. So now we begin to

182
08:15.400 --> 08:16.960
install the ftb client

183
08:16.960 --> 08:22.190
configure the local repo and now we begin to download at dpd from the local

184
08:22.190 --> 08:23.040
server or rather

185
08:23.040 --> 08:28.120
the local repository. If I now do dnf repo list on my target device, we can see

186
08:28.120 --> 08:29.440
here my local repo

187
08:29.440 --> 08:35.530
is now configured. And if I do dnf repo query and I check the location for hdpd
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

187
08:29.440 --> 08:35.530
is now configured. And if I do dnf repo query and I check the location for hdpd

188
08:35.530 --> 08:36.160
, we can actually

189
08:36.160 --> 08:40.430
see here a multi configuration we actually have our ftp server with the IP

190
08:40.430 --> 08:44.960
address 192.168.160.133.

191
08:44.960 --> 08:48.800
So that is us for our validation challenge. I hope it's been informative for

192
08:48.800 --> 08:49.520
you and I'd like to

193
08:49.520 --> 08:50.720
thank you for viewing.
