WEBVTT

1
00:00.000 --> 00:03.240
So friends to kick off the very first thing that I want to talk to you about is

2
00:03.240 --> 00:03.760
the concept

3
00:03.760 --> 00:08.400
of packages on lyrics. Now packages are really just a way for us to manage and

4
00:08.400 --> 00:09.600
deliver software.

5
00:09.600 --> 00:14.560
Pretty much as a user or a client wanting to install some type of software,

6
00:14.560 --> 00:18.950
we can just use a package manager which is really going to simplify the entire

7
00:18.950 --> 00:19.520
process.

8
00:19.520 --> 00:24.060
Now basically the package manager is going to have all these packages in a

9
00:24.060 --> 00:25.360
place known as a

10
00:25.360 --> 00:30.070
repository. Now we'll talk about repositories in more detail in the upcoming
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

10
00:25.360 --> 00:30.070
repository. Now we'll talk about repositories in more detail in the upcoming

11
00:30.070 --> 00:31.120
video. But for now,

12
00:31.120 --> 00:34.980
just conceptualize this as a type of central storage, a place where we can go

13
00:34.980 --> 00:35.680
to to get all

14
00:35.680 --> 00:39.230
the software that we want. Now depending on the actual platform that we happen

15
00:39.230 --> 00:39.760
to be using,

16
00:39.760 --> 00:43.280
there are different package managers who can use something called DNF, which is

17
00:43.280 --> 00:44.000
one we've seen

18
00:44.000 --> 00:47.990
already within this course. But one thing to note, and I just want to point out

19
00:47.990 --> 00:49.360
is that the predecessor

20
00:49.360 --> 00:53.310
to DNF was something called YUM. Now the good thing is, is that there is

21
00:53.310 --> 00:54.880
basically compatibility

22
00:54.880 --> 00:59.160
between these two package managers. So if you happen to use one, you can still

23
00:59.160 --> 00:59.840
use the other

24
00:59.840 --> 01:03.430
and you're basically going to get the same result. The reason why I want to
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

24
00:59.840 --> 01:03.430
and you're basically going to get the same result. The reason why I want to

25
01:03.430 --> 01:04.080
point out YUM

26
01:04.080 --> 01:08.670
is that when it comes to actually managing our repositories, we actually have a

27
01:08.670 --> 01:09.520
YUM specific

28
01:09.520 --> 01:14.160
module that we want to look at. And the reason is this, when we happen to go to

29
01:14.160 --> 01:14.880
our repositories,

30
01:14.880 --> 01:19.160
in fact, if I go into my Etsy, and then this repository directory called YUM

31
01:19.160 --> 01:20.480
repo's dot D,

32
01:20.480 --> 01:25.450
if I do an LS, we see this dot repo file. So even though this particular system

33
01:25.450 --> 01:26.160
is the modern

34
01:26.160 --> 01:31.130
system utilizing DNF, we notice these directories are still present. So whilst
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

34
01:26.160 --> 01:31.130
system utilizing DNF, we notice these directories are still present. So whilst

35
01:31.130 --> 01:32.000
you may have seen

36
01:32.000 --> 01:35.660
me throughout this course using the DNF module, and that would be the Ansible

37
01:35.660 --> 01:37.120
built in DNF module,

38
01:37.120 --> 01:41.880
just be aware that you can also pretty much do the same tasks utilizing the YUM

39
01:41.880 --> 01:42.320
modules.

40
01:42.320 --> 01:45.520
Let me just go and show you that briefly for the moment. So if you just search

41
01:45.520 --> 01:46.240
for the Ansible

42
01:46.240 --> 01:50.230
YUM module right here, once again, just like with the DNF module, we can see

43
01:50.230 --> 01:51.200
here that this happens

44
01:51.200 --> 01:55.750
to be a built in part of Ansible course. So you don't have to install anything

45
01:55.750 --> 01:56.880
extra. Now,

46
01:56.880 --> 02:00.400
if we scroll on down, you're going to see that it does the same type of thing
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

46
01:56.880 --> 02:00.400
if we scroll on down, you're going to see that it does the same type of thing

47
02:00.400 --> 02:00.960
that you'd expect

48
02:00.960 --> 02:04.520
from DNF. It's going to allow us to install upgrade, downgrade, remove, and

49
02:04.520 --> 02:06.240
less packages and groups

50
02:06.240 --> 02:11.040
with the YUM package manager. Now, scrolling on down all the way to the bottom,

51
02:11.040 --> 02:11.840
we can see all

52
02:11.840 --> 02:15.260
of these different options. It's very, very similar to what we see with DNF.

53
02:15.260 --> 02:16.000
And if you want to see

54
02:16.000 --> 02:19.680
some examples and just go all the way to the bottom, and you can see how to use

55
02:19.680 --> 02:21.360
this particular utility.

56
02:21.360 --> 02:25.560
Now, when we're talking about using DNF or YUM, we are really just talking

57
02:25.560 --> 02:26.720
about systems that

58
02:26.720 --> 02:30.820
happen to be rail based or red hat based, since this is the package manager
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

58
02:26.720 --> 02:30.820
happen to be rail based or red hat based, since this is the package manager

59
02:30.820 --> 02:31.840
that the red hat

60
02:31.840 --> 02:36.070
based systems happen to use. However, I would be remiss to pretend that we

61
02:36.070 --> 02:36.800
always work

62
02:36.800 --> 02:41.290
any homogenous environments. We know right here, in my case, I have my little

63
02:41.290 --> 02:42.640
Ansible control modes,

64
02:42.640 --> 02:47.780
and then I have my blue box as well as my yellow box. Now, if I wanted to

65
02:47.780 --> 02:49.120
perhaps make an update

66
02:49.120 --> 02:53.410
to the packages on these particular devices, then I could just use either the D

67
02:53.410 --> 02:54.400
NF or the YUM module,

68
02:54.400 --> 02:58.060
whatever it may be, and ultimately deploy these particular changes. Maybe I

69
02:58.060 --> 02:59.440
wanted to install

70
02:59.440 --> 03:03.490
a web server onto both of these devices using the package manager, either YUM
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

70
02:59.440 --> 03:03.490
a web server onto both of these devices using the package manager, either YUM

71
03:03.490 --> 03:04.560
or DNF. That

72
03:04.560 --> 03:09.240
would be fine. However, let's imagine we added another device into the mix. Let

73
03:09.240 --> 03:10.000
's have this

74
03:10.000 --> 03:14.490
brown box over here, and let's maybe say this was a Debian based distribution,

75
03:14.490 --> 03:15.680
such as Ubuntu.

76
03:15.680 --> 03:20.170
Well, these modules that we see here, the YUM module or DNF, are not going to

77
03:20.170 --> 03:20.880
work on this

78
03:20.880 --> 03:25.430
particular device. Indeed, instead, the Debian based systems happen to use the

79
03:25.430 --> 03:26.960
apt package manager.

80
03:26.960 --> 03:30.640
So it is important that we are aware that we can also use this particular
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

80
03:26.960 --> 03:30.640
So it is important that we are aware that we can also use this particular

81
03:30.640 --> 03:31.680
module when we want

82
03:31.680 --> 03:36.890
to automate this process via Ansible. So let's just go back to Google. If you

83
03:36.890 --> 03:37.360
search for an

84
03:37.360 --> 03:41.680
Ansible app, let's click this link here. Again, this is part of Ansible Core,

85
03:41.680 --> 03:42.480
and we can see here

86
03:42.480 --> 03:46.900
via the synopsis that this is going to allow us to manage apt packages for

87
03:46.900 --> 03:48.240
Debian or Ubuntu.

88
03:48.240 --> 03:51.450
Now, again, if you want to learn how to use this particular module, you know

89
03:51.450 --> 03:51.840
what to do,

90
03:51.840 --> 03:55.680
you can go through all of the available options. And if you so wish, going down

91
03:55.680 --> 03:56.560
to the very bottom,

92
03:56.560 --> 03:59.990
you're going to see some examples that you can effectively copy paste and

93
03:59.990 --> 04:02.000
modify all very good.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

93
03:59.990 --> 04:02.000
modify all very good.

94
04:02.000 --> 04:07.880
Now, very, very important point. Ansible also has something known as a package

95
04:07.880 --> 04:08.560
module.

96
04:08.560 --> 04:11.800
Now, this might seem a little bit strange, I'm thinking, well, we have a DNF

97
04:11.800 --> 04:13.040
module as well as

98
04:13.040 --> 04:17.300
a YUM module and an apt module. Why on earth would we ever need a package

99
04:17.300 --> 04:19.120
module? Now, the purpose here

100
04:19.120 --> 04:24.780
is for this module to be generic. Pretty much this particular module here doesn

101
04:24.780 --> 04:25.440
't actually care

102
04:25.440 --> 04:29.060
about the underlying operating system of the device that you're having to be

103
04:29.060 --> 04:29.760
managing.

104
04:29.760 --> 04:34.480
It can be a Red Hat based system. It can be a Debian based system. It can even
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

104
04:29.760 --> 04:34.480
It can be a Red Hat based system. It can be a Debian based system. It can even

105
04:34.480 --> 04:35.440
perhaps be an open

106
04:35.440 --> 04:39.280
SUSA based system which uses the zipper package manager. Now, let me just

107
04:39.280 --> 04:40.240
briefly show you this

108
04:40.240 --> 04:43.800
particular module so you are whether it does exist. If you research for Ansible

109
04:43.800 --> 04:44.640
Package Module,

110
04:44.640 --> 04:48.390
click this link here. Again, this is part of the built-in Ansible Core. Notice

111
04:48.390 --> 04:49.120
what it says here.

112
04:49.120 --> 04:53.560
This module manages packages on a target without specifying a package manager

113
04:53.560 --> 04:54.880
module like YUM or

114
04:54.880 --> 05:00.490
AT. Now, it says here, this is convenient to use any heterogeneous environment.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

114
04:54.880 --> 05:00.490
AT. Now, it says here, this is convenient to use any heterogeneous environment.

115
05:00.490 --> 05:01.200
Pretty much a fancy

116
05:01.200 --> 05:04.470
word to say a mixed environment whereby we have different platforms that we

117
05:04.470 --> 05:05.360
have to control.

118
05:05.360 --> 05:08.700
However, if you happen to scroll through this particular module, you will

119
05:08.700 --> 05:09.680
notice it is pretty

120
05:09.680 --> 05:14.250
bare. We have the name parameter here, which is required, as well as the state,

121
05:14.250 --> 05:14.720
which is also

122
05:14.720 --> 05:19.330
required. And then we have the use parameter again scrolling on down. We can

123
05:19.330 --> 05:20.080
see some very,

124
05:20.080 --> 05:25.570
very simple examples. Now, the temptation might be to think, hey, we have a

125
05:25.570 --> 05:26.880
package module which

126
05:26.880 --> 05:30.790
is going to be able to be used on whatever device I have in the target. I'm
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

126
05:26.880 --> 05:30.790
is going to be able to be used on whatever device I have in the target. I'm

127
05:30.790 --> 05:31.760
just going to use this

128
05:31.760 --> 05:35.790
one regardless. Why would I bother having DNF and have to worry about if my end

129
05:35.790 --> 05:36.880
device is Red Hat

130
05:36.880 --> 05:41.110
based? Now, I want to just dissuade you from trying to do this. And instead, my

131
05:41.110 --> 05:42.320
recommendation would

132
05:42.320 --> 05:46.170
be to use the package or rather the module that is tailored towards the

133
05:46.170 --> 05:47.360
platform that you happen

134
05:47.360 --> 05:52.350
to be managing. The reason why is that the tailored modules happen to be much

135
05:52.350 --> 05:53.440
more feature rich and

136
05:53.440 --> 05:57.200
stable or better to manage your system with. So really, the better play if you

137
05:57.200 --> 05:58.000
use the pun for a

138
05:58.000 --> 06:02.660
playbook is to just use your conditional statement, use that when keyword. You
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

138
05:58.000 --> 06:02.660
playbook is to just use your conditional statement, use that when keyword. You

139
06:02.660 --> 06:03.840
can have a task that

140
06:03.840 --> 06:07.930
is going to use the DNF package manager or perhaps the young package manager,

141
06:07.930 --> 06:08.240
perform a

142
06:08.240 --> 06:12.190
particular task, and then we just have the conditional when and then specify

143
06:12.190 --> 06:13.840
that the operating system

144
06:13.840 --> 06:18.730
is equal to a Red Hat based system, and then have an entirely different task, a

145
06:18.730 --> 06:20.080
second task whereby

146
06:20.080 --> 06:23.860
we utilize the out package manager and again have that conditional statement

147
06:23.860 --> 06:25.040
saying that the task

148
06:25.040 --> 06:29.170
is only going to execute when the device comes from the Debian family of

149
06:29.170 --> 06:30.560
operating systems.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

149
06:29.170 --> 06:30.560
operating systems.

150
06:30.560 --> 06:33.590
This is what we're talking about. This is going to allow us to effectively

151
06:33.590 --> 06:34.800
execute and manage

152
06:34.800 --> 06:39.360
your devices any nice, elegant way, while still maintaining the ability to have

153
06:39.360 --> 06:40.400
all of these rich

154
06:40.400 --> 06:44.000
features. In fact, one last point that I should even point out is that whilst

155
06:44.000 --> 06:45.280
you can use this

156
06:45.280 --> 06:48.790
particular module, if you happen to be in a pickle, just understand as even

157
06:48.790 --> 06:50.320
though you can use the

158
06:50.320 --> 06:54.530
same module for all devices effectively, understand that you might still have

159
06:54.530 --> 06:56.160
to use these when keywords

160
06:56.160 --> 07:00.470
because depending on the actual device that you happen to be managing, some
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

160
06:56.160 --> 07:00.470
because depending on the actual device that you happen to be managing, some

161
07:00.470 --> 07:01.680
packages can actually

162
07:01.680 --> 07:05.400
have entirely different names depending on the platform that you happen to be

163
07:05.400 --> 07:06.320
using. So really,

164
07:06.320 --> 07:10.080
all I want to do here is to clean up some confusion. There are so many options,

165
07:10.080 --> 07:10.240
it can

166
07:10.240 --> 07:14.280
be easy to just be suggesting to thinking, hey, this is a nice, easy one. Let's

167
07:14.280 --> 07:15.200
go with that.

168
07:15.200 --> 07:18.800
Just understand the pitfalls here. Okay. So it is an option, but it really is

169
07:18.800 --> 07:19.760
not optimal in my

170
07:19.760 --> 07:22.960
opinion. Now, the next thing I want to talk to you about with respect to our

171
07:22.960 --> 07:23.920
package management

172
07:23.920 --> 07:28.560
is something known as package groups. Now, think about this. Say, for example,

173
07:28.560 --> 07:29.600
you wanted to be able

174
07:29.600 --> 07:34.150
to manage a whole bunch of networking on servers. As opposed to you having to
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

174
07:29.600 --> 07:34.150
to manage a whole bunch of networking on servers. As opposed to you having to

175
07:34.150 --> 07:35.360
go and identify all

176
07:35.360 --> 07:39.370
these different packages that could be useful in performing this particular

177
07:39.370 --> 07:40.560
task, i.e. managing

178
07:40.560 --> 07:44.340
networks on servers, wouldn't it be better if you could just collect all of

179
07:44.340 --> 07:45.680
these disparate packages

180
07:45.680 --> 07:49.810
that have a common purpose, generally speaking, and just install them as a big

181
07:49.810 --> 07:50.960
blob of packages.

182
07:50.960 --> 07:55.460
Quite simply, this is what a package group is going to allow us to do. And the

183
07:55.460 --> 07:56.080
good news is,

184
07:56.080 --> 08:00.240
is that you can actually do this on Ansible. Let me show you how. So if I go to
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

184
07:56.080 --> 08:00.240
is that you can actually do this on Ansible. Let me show you how. So if I go to

185
08:00.240 --> 08:01.120
my device and I

186
08:01.120 --> 08:04.280
just say DNF group list, look at what we see here. We can see our installed

187
08:04.280 --> 08:05.360
groups, which is the

188
08:05.360 --> 08:08.630
container management group and the headless management group. This is obviously

189
08:08.630 --> 08:09.840
a whole bunch of packages

190
08:09.840 --> 08:13.640
related to container management. And if I want to install some additional

191
08:13.640 --> 08:14.560
groups, well, I could

192
08:14.560 --> 08:18.420
look at, say, for example, the development tools. So say, for example, I was a

193
08:18.420 --> 08:19.520
software engineer or

194
08:19.520 --> 08:24.140
a programmer, and I wanted to basically develop on my Ubuntu machine or rather

195
08:24.140 --> 08:25.120
my Red Hat Linux

196
08:25.120 --> 08:28.250
machine, should I say, that as opposed to me having to identify, hey, what

197
08:28.250 --> 08:29.680
would actually be a useful

198
08:29.680 --> 08:34.140
utility for me to have as a software engineer, what I could do is I could just
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

198
08:29.680 --> 08:34.140
utility for me to have as a software engineer, what I could do is I could just

199
08:34.140 --> 08:34.960
download the

200
08:34.960 --> 08:38.830
development tools package or rather the development tools group package. And

201
08:38.830 --> 08:39.360
that would give me a

202
08:39.360 --> 08:42.700
whole bunch of related packages for the type of tasks that I would like to

203
08:42.700 --> 08:44.320
perform. Really, really

204
08:44.320 --> 08:48.540
handy. So check it out. Let's see how we can actually install this using Ans

205
08:48.540 --> 08:49.680
ible on our device.

206
08:49.680 --> 08:53.920
So let's go back to our little control nodes. And I'll create a playbook called

207
08:53.920 --> 08:54.960
play one dot

208
08:54.960 --> 08:58.720
yml gun to insert mode. So let's have our three hyphens at the top, give a

209
08:58.720 --> 08:59.840
playbook a name or

210
08:59.840 --> 09:04.500
say play one, and we'll just say installing package groups. So the host I will
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

210
08:59.840 --> 09:04.500
say play one, and we'll just say installing package groups. So the host I will

211
09:04.500 --> 09:05.440
target in this case

212
09:05.440 --> 09:08.640
here, let's just go with the yellow box to keep things nice and simple. And

213
09:08.640 --> 09:09.840
then I'll set my gather

214
09:09.840 --> 09:13.660
facts to be false. Now what I'll do is define my tasks. Now the very first task

215
09:13.660 --> 09:14.400
I'm going to

216
09:14.400 --> 09:19.620
define is going to be install a package group with dnf. So I will use the Ans

217
09:19.620 --> 09:21.200
ible built in dnf

218
09:21.200 --> 09:24.030
module. And in fact, do you know what I will do? Let me delete this for a

219
09:24.030 --> 09:25.680
second. Let me use the

220
09:25.680 --> 09:29.310
young package manager. And I'll just change this to young. The reason being is

221
09:29.310 --> 09:30.080
that I just want to
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

221
09:29.310 --> 09:30.080
that I just want to

222
09:30.080 --> 09:34.170
show you that even though we have been using dnf, yum is still acceptable to

223
09:34.170 --> 09:35.360
use to basically use

224
09:35.360 --> 09:39.280
either or Azure so wish. Now what I want to do is I want to specify a water

225
09:39.280 --> 09:40.480
test that I want to

226
09:40.480 --> 09:44.530
install. So if I happen to say development tools, right now we're going to run

227
09:44.530 --> 09:45.200
into a little bit

228
09:45.200 --> 09:48.300
of a problem, we'll get to see what that looks like in a moment. So if I say

229
09:48.300 --> 09:49.680
the state is present,

230
09:49.680 --> 09:52.870
and then what I want to do is I want to have another task. And then I'll just

231
09:52.870 --> 09:54.480
say send command

232
09:54.480 --> 10:00.240
to verify my groups. So I'll use the Ansible built in command module this time.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

232
09:54.480 --> 10:00.240
to verify my groups. So I'll use the Ansible built in command module this time.

233
10:00.240 --> 10:00.880
And the command

234
10:00.880 --> 10:05.420
is going to be I'll just say dnf group list. And by the way, if I so wish I

235
10:05.420 --> 10:06.880
could change this to

236
10:06.880 --> 10:09.820
yum group list that's going to effectively do the same type of thing. And then

237
10:09.820 --> 10:10.640
I'm going to use the

238
10:10.640 --> 10:14.010
register keyword to capture the output. I'll just call it the variable output.

239
10:14.010 --> 10:14.880
Now I'll have a new

240
10:14.880 --> 10:19.340
task which is going to effectively print the output. And I'll use the Ansible

241
10:19.340 --> 10:20.320
built in debug

242
10:20.320 --> 10:23.620
module. And I'm going to print out the output variable. I'm going to get the

243
10:23.620 --> 10:24.320
STD out and I'll

244
10:24.320 --> 10:28.080
actually get the lines because it's going to be multiple lines here. Now watch

245
10:28.080 --> 10:28.800
this for going to

246
10:28.800 --> 10:32.860
have a little bit of a problem here. If I just say Ansible playbook play one
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

246
10:28.800 --> 10:32.860
have a little bit of a problem here. If I just say Ansible playbook play one

247
10:32.860 --> 10:34.240
dot yml and hit enter.

248
10:34.240 --> 10:38.760
Here we can see the problem check this out. It says failed. And it says here in

249
10:38.760 --> 10:39.360
the message

250
10:39.360 --> 10:44.140
it appears that a space separated string of packages was passed in as an

251
10:44.140 --> 10:46.480
argument. Now what we can do

252
10:46.480 --> 10:50.020
here is if we go back in the way we handle this when we want to install the

253
10:50.020 --> 10:51.600
group is at the beginning

254
10:51.600 --> 10:55.400
if we use the ad symbol just like if you're going to email someone this is

255
10:55.400 --> 10:56.320
going to make

256
10:56.320 --> 11:00.130
all the difference. So let's just save this and then we'll try to install these
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

256
10:56.320 --> 11:00.130
all the difference. So let's just save this and then we'll try to install these

257
11:00.130 --> 11:00.960
groups. So let's hit

258
11:00.960 --> 11:05.240
enter and bear in mind this will take a little bit of time because as we know

259
11:05.240 --> 11:06.480
we are installing a

260
11:06.480 --> 11:10.580
group of packages. So that is a lot of things to download. And look at this

261
11:10.580 --> 11:11.600
right here. This looks

262
11:11.600 --> 11:15.320
a way way better if we scroll on up at the outputs. Look at what we actually

263
11:15.320 --> 11:16.400
see here now in the

264
11:16.400 --> 11:21.100
installed groups. See this the installed groups right here. Now we also have

265
11:21.100 --> 11:22.400
development tools.

266
11:22.400 --> 11:26.290
And the cool thing is, is if I happen to go to my device and I just say dnf

267
11:26.290 --> 11:27.120
group info on

268
11:27.120 --> 11:31.330
development tools, what we actually see here is a list of all of the packages
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

268
11:27.120 --> 11:31.330
development tools, what we actually see here is a list of all of the packages

269
11:31.330 --> 11:32.080
that are actually

270
11:32.080 --> 11:36.100
compiled within that particular group. So we get access to all this good stuff

271
11:36.100 --> 11:37.120
right here without

272
11:37.120 --> 11:40.640
having to specify them individually really really handy. So really if you want

273
11:40.640 --> 11:41.520
to install a group

274
11:41.520 --> 11:45.780
of packages with Ansible just remember to use that ad symbol. Okay. Now one

275
11:45.780 --> 11:46.800
last thing before we

276
11:46.800 --> 11:50.460
begin to talk about repos, recall when we happen to use the Ansible setup

277
11:50.460 --> 11:51.760
module, we can effectively

278
11:51.760 --> 11:55.770
gather facts about your targeted devices. Now that is actually a little bit

279
11:55.770 --> 11:57.120
over a mission with respect

280
11:57.120 --> 12:01.020
to our facts. We do not get any information, any factual information about the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

280
11:57.120 --> 12:01.020
to our facts. We do not get any information, any factual information about the

281
12:01.020 --> 12:01.920
packages on the

282
12:01.920 --> 12:05.710
system. Now suppose we want to have access to that particular data. But the

283
12:05.710 --> 12:06.400
good news is that

284
12:06.400 --> 12:10.600
Ansible actually has a dedicated module for package facts. So let's just

285
12:10.600 --> 12:11.920
briefly go and have a look

286
12:11.920 --> 12:15.640
at that then. So if you search for Ansible package facts, let's go to this top

287
12:15.640 --> 12:17.040
link right here again.

288
12:17.040 --> 12:21.120
As we can see this is a part of Ansible course, or it is built in. No need to

289
12:21.120 --> 12:21.920
install anything

290
12:21.920 --> 12:26.400
via Ansible Galaxy. If we scroll on down, we can see the synops is specifying

291
12:26.400 --> 12:27.040
that this is going

292
12:27.040 --> 12:31.520
to return information about installed packages as facts. We can see we have
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

292
12:27.040 --> 12:31.520
to return information about installed packages as facts. We can see we have

293
12:31.520 --> 12:32.480
some different options.

294
12:32.480 --> 12:36.170
We have the manager parameter, which is going to take a list of objects. This

295
12:36.170 --> 12:37.280
is where we specify

296
12:37.280 --> 12:41.030
the actual package manager that is going to be used on the system by default.

297
12:41.030 --> 12:41.680
It's going to be

298
12:41.680 --> 12:46.090
auto detected. However, if we're on Red Hat, we can specify RPM or effort on a

299
12:46.090 --> 12:46.720
Debian based

300
12:46.720 --> 12:51.040
system, we can specify apt again, scrolling on down a little bit further.

301
12:51.040 --> 12:51.920
Notice this is a very,

302
12:51.920 --> 12:55.920
very simple module. And we can see an example of how to actual utilize it. So

303
12:55.920 --> 12:56.960
in the case here,

304
12:56.960 --> 13:00.600
we can actually gather facts via the package facts module. And then once we
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

304
12:56.960 --> 13:00.600
we can actually gather facts via the package facts module. And then once we

305
13:00.600 --> 13:01.680
have done that,

306
13:01.680 --> 13:06.160
when we happen to use the debug module, we can print out our Ansible facts and

307
13:06.160 --> 13:06.800
now we'll also

308
13:06.800 --> 13:11.450
have an associated packages attribute, which if we so wished we can effectively

309
13:11.450 --> 13:12.000
utilize

310
13:12.000 --> 13:14.910
four conditional statements. See that in the bottom there? Let me just show you

311
13:14.910 --> 13:16.000
how this operates then.

312
13:16.000 --> 13:18.880
If I just happened to copy some of this right here, and I'll create a new

313
13:18.880 --> 13:21.120
playbook called play2.yml.

314
13:21.120 --> 13:24.260
Let's go into insert mode half of our free hyphens at the top, give the

315
13:24.260 --> 13:25.040
playback a name,

316
13:25.040 --> 13:30.240
and we just say play to testing module facts. In the case of the host, let's
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

316
13:25.040 --> 13:30.240
and we just say play to testing module facts. In the case of the host, let's

317
13:30.240 --> 13:30.960
just target the

318
13:30.960 --> 13:34.730
yellow box once again, and now we'll specify our tasks. So I'll just paste in

319
13:34.730 --> 13:35.760
this information,

320
13:35.760 --> 13:39.500
and all I want to do is to fix the indentation here. So we just basically move

321
13:39.500 --> 13:40.080
everything

322
13:40.080 --> 13:44.600
indented for spaces. Now, if I just save this, and I run the playbook of

323
13:44.600 --> 13:46.160
playbook to.yml and to

324
13:46.160 --> 13:50.070
enter, so check this out right here. Look at the output. Look at this scrolling

325
13:50.070 --> 13:50.400
on up,

326
13:50.400 --> 13:54.100
tons and tons and tons of information that you can parse out if you so wish.

327
13:54.100 --> 13:54.720
Look what we have here,

328
13:54.720 --> 13:59.090
we can see on this particular system, the yellow box, we actually have 80 DPD

329
13:59.090 --> 14:00.160
installed. We can
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

329
13:59.090 --> 14:00.160
installed. We can

330
14:00.160 --> 14:05.580
see the architecture as the arts 64. We can get the actual release. We can see

331
14:05.580 --> 14:07.040
the source of the

332
14:07.040 --> 14:10.900
package, which is RPM, because it's a red hat based system, and we actually get

333
14:10.900 --> 14:11.600
the versioning

334
14:11.600 --> 14:15.310
number. So again, if you perhaps want to use this information for your

335
14:15.310 --> 14:16.720
conditional statements,

336
14:16.720 --> 14:20.800
test of a device has a particular package, and if it does have that package,

337
14:20.800 --> 14:22.160
then you can or cannot

338
14:22.160 --> 14:25.800
perform a particular action at your will. So I know that was a lot to get to

339
14:25.800 --> 14:26.400
within this

340
14:26.400 --> 14:30.730
scale packages after all are deceptively complex. That is a lot to them, but
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

340
14:26.400 --> 14:30.730
scale packages after all are deceptively complex. That is a lot to them, but

341
14:30.730 --> 14:31.360
just understand that

342
14:31.360 --> 14:35.220
we have different package managers for different platforms. Remember that DNF

343
14:35.220 --> 14:36.560
and YUM are effectively

344
14:36.560 --> 14:41.570
interchangeable on railbase systems. Whilst DNF is newer, YUM still has certain

345
14:41.570 --> 14:42.320
fingerprints on

346
14:42.320 --> 14:45.640
the system. And if you want to install multiple related packages, we can

347
14:45.640 --> 14:46.960
utilize groups. And to

348
14:46.960 --> 14:50.830
do that with Ansible, we use the at symbol. And also, of course, as we just saw

349
14:50.830 --> 14:51.680
, if you want to

350
14:51.680 --> 14:55.660
gather facts about the packages on your system, then Ansible provides a

351
14:55.660 --> 14:58.480
dedicated package facts module.
