WEBVTT

1
00:00.000 --> 00:04.120
So friends, why don't we talk about the real big dog in time when it comes to

2
00:04.120 --> 00:05.120
network automation

3
00:05.120 --> 00:06.720
and this is Ansible.

4
00:06.720 --> 00:11.600
Now Ansible is by far at least at this point in time as of this recording.

5
00:11.600 --> 00:16.960
It is by far the most popular network automation utility on the planet.

6
00:16.960 --> 00:21.360
Now you may be thinking, well if it's so popular there must be a good reason

7
00:21.360 --> 00:22.400
why it's so popular

8
00:22.400 --> 00:27.530
and this is basically true. Let's talk a little bit about it. So first thing to

9
00:27.530 --> 00:29.120
state about Ansible

10
00:29.120 --> 00:33.860
is that when it comes to automation it is an agentless solution. So this is
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

10
00:29.120 --> 00:33.860
is that when it comes to automation it is an agentless solution. So this is

11
00:33.860 --> 00:35.120
very good when it comes

12
00:35.120 --> 00:39.950
to managing older devices. So these Cisco devices which I have in this little

13
00:39.950 --> 00:41.280
diagram right here

14
00:41.280 --> 00:47.240
these are all running Cisco iOS and this is a rather old operating system. It

15
00:47.240 --> 00:48.000
was not designed

16
00:48.000 --> 00:53.400
with automation in mind and they do not have the ability to install an agent.

17
00:53.400 --> 00:54.000
Now if you happen

18
00:54.000 --> 00:58.350
to have some real world experience in the world of network engineering then you

19
00:58.350 --> 00:58.800
know

20
00:58.800 --> 01:02.560
you don't just get to go and replace an entire infrastructure just because a
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

20
00:58.800 --> 01:02.560
you don't just get to go and replace an entire infrastructure just because a

21
01:02.560 --> 01:03.680
new model of device

22
01:03.680 --> 01:07.910
has came out. You very often may walk into a network where by most of the

23
01:07.910 --> 01:09.360
devices are 10 years old

24
01:09.360 --> 01:15.050
or 15 years old or maybe even 20 years old or more. Network engineering can

25
01:15.050 --> 01:16.560
really be kind of a

26
01:16.560 --> 01:20.730
dire circumstance at times. So this is just the nature of the networks that we

27
01:20.730 --> 01:22.080
have to administer.

28
01:22.080 --> 01:26.480
Now we don't want to have to be hamstrung by these old technologies and be told

29
01:26.480 --> 01:26.800
that you know

30
01:26.800 --> 01:30.460
what there is no automation available for you. If you've got an old machine, if
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

30
01:26.800 --> 01:30.460
what there is no automation available for you. If you've got an old machine, if

31
01:30.460 --> 01:31.200
you've got an old

32
01:31.200 --> 01:35.650
network, well you're just stuck with doing old copy paste stuff and just doing

33
01:35.650 --> 01:37.120
some regular CLI

34
01:37.120 --> 01:41.250
jockeying on the command line. Now here is the important part with respect to

35
01:41.250 --> 01:42.320
Ansible. It does not

36
01:42.320 --> 01:47.310
matter how old these devices are because essentially Ansible is just going to

37
01:47.310 --> 01:48.560
be installed on the

38
01:48.560 --> 01:53.180
machine that is going to manage these devices. This is going to be our Ansible

39
01:53.180 --> 01:54.400
Control node okay.

40
01:54.400 --> 01:58.800
So the Ansible Control node will be installed here and so long as that device

41
01:58.800 --> 02:00.160
can actually connect
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

41
01:58.800 --> 02:00.160
can actually connect

42
02:00.160 --> 02:04.410
to the devices that we want to manage, then we can use Ansible to ultimately

43
02:04.410 --> 02:05.200
push out these

44
02:05.200 --> 02:10.440
automated configurations to the target devices. So this simple fact of Ansible

45
02:10.440 --> 02:11.520
being agentless and

46
02:11.520 --> 02:15.820
not requiring these new fancy modern devices in order to use Ansible. This is

47
02:15.820 --> 02:16.960
one of the reasons why

48
02:16.960 --> 02:20.620
it's so popular within network automation. Like I said, we do have many of

49
02:20.620 --> 02:22.160
these old devices still

50
02:22.160 --> 02:27.880
in play but that is not all. When it comes to automation generally, well it

51
02:27.880 --> 02:29.360
kind of has a bit of an

52
02:29.360 --> 02:32.720
intimidation factor. If you're told you know you have to really be good at the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

52
02:29.360 --> 02:32.720
intimidation factor. If you're told you know you have to really be good at the

53
02:32.720 --> 02:33.600
Python program in

54
02:33.600 --> 02:38.790
language in order to do any type of automation, it kind of puts people off and

55
02:38.790 --> 02:40.160
this is just natural.

56
02:40.160 --> 02:44.940
If you're just used to working with OSPF and BGP and creating VLANs that type

57
02:44.940 --> 02:46.400
of thing and then suddenly

58
02:46.400 --> 02:51.040
you have to go out and learn a programming language. This is not so enticing to

59
02:51.040 --> 02:52.480
say the least. Now here

60
02:52.480 --> 02:57.240
is the trick. Ansible is actually written in Python. However, the cool thing is

61
02:57.240 --> 02:58.640
is that in order to

62
02:58.640 --> 03:03.280
use Ansible, you actually do not need to know how to write any Python. Quite
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

62
02:58.640 --> 03:03.280
use Ansible, you actually do not need to know how to write any Python. Quite

63
03:03.280 --> 03:04.320
simply, you just

64
03:04.320 --> 03:08.960
utilize what is known as YAML files, which is just a file format that has a

65
03:08.960 --> 03:10.720
great emphasis on human

66
03:10.720 --> 03:16.360
readability and USEN user, you just write your instructions, utilizing YAML and

67
03:16.360 --> 03:17.440
under the hood,

68
03:17.440 --> 03:22.160
Ansible will translate those commands into Python and then begin connecting to

69
03:22.160 --> 03:23.200
all of our devices

70
03:23.200 --> 03:27.200
and assuring out all of the automation. So let's just briefly describe some of

71
03:27.200 --> 03:28.160
the components

72
03:28.160 --> 03:32.350
that make up Ansible. So the very first component is one known as the inventory
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

72
03:28.160 --> 03:32.350
that make up Ansible. So the very first component is one known as the inventory

73
03:32.350 --> 03:33.840
. This is so, so

74
03:33.840 --> 03:37.760
crucial to how Ansible actually operates. Think about it like this. When you

75
03:37.760 --> 03:38.880
want to automate a

76
03:38.880 --> 03:43.150
network in order to be able to connect to the devices in that network, you

77
03:43.150 --> 03:44.480
essentially have to

78
03:44.480 --> 03:49.800
describe the network. You want to tell the automation system which devices you

79
03:49.800 --> 03:50.800
have. So say, for

80
03:50.800 --> 03:55.290
example, take these four devices here. This could be my little network. I would

81
03:55.290 --> 03:56.480
want Ansible to know

82
03:56.480 --> 04:00.200
about them. And the way I do this is by specifying their details within my Ans
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

82
03:56.480 --> 04:00.200
about them. And the way I do this is by specifying their details within my Ans

83
04:00.200 --> 04:01.840
ible inventory. So Ansible

84
04:01.840 --> 04:06.180
has this one little file that looks into and reads in all the information. So

85
04:06.180 --> 04:07.360
what kind of information

86
04:07.360 --> 04:12.100
am I talking about? Well, what about the login username for each device, as

87
04:12.100 --> 04:13.200
well as the login

88
04:13.200 --> 04:17.410
password? What about the connection details of that device? What is its actual

89
04:17.410 --> 04:18.160
IP address or

90
04:18.160 --> 04:22.250
what's its domain name? How do I reach this particular device in the network?

91
04:22.250 --> 04:23.680
Which type of device

92
04:23.680 --> 04:28.490
are we actually talking to? Is this a Cisco iOS device? Or maybe this is a Jun

93
04:28.490 --> 04:29.680
iper device? Because

94
04:29.680 --> 04:33.500
ultimately, the different devices actually have a different way of being
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

94
04:29.680 --> 04:33.500
ultimately, the different devices actually have a different way of being

95
04:33.500 --> 04:34.560
managed. Because these

96
04:34.560 --> 04:37.210
devices are managed in different ways. They've got different modes. They've got

97
04:37.210 --> 04:38.160
different syntax,

98
04:38.160 --> 04:42.280
so on, so forth. If we're going to automate these devices, we need to be very

99
04:42.280 --> 04:43.760
explicit about what

100
04:43.760 --> 04:48.800
the device actually is. So all this information here is going to be written in

101
04:48.800 --> 04:49.600
our inventory

102
04:49.600 --> 04:54.880
file. And once again, this can be specified in YAML format, but it can also be

103
04:54.880 --> 04:55.920
specified in a

104
04:55.920 --> 05:00.880
format known as INI, as we get to see. Basically, you can select the file
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

104
04:55.920 --> 05:00.880
format known as INI, as we get to see. Basically, you can select the file

105
05:00.880 --> 05:02.320
format that you want for

106
05:02.320 --> 05:06.380
this particular component of Ansible. And just choose which one you find

107
05:06.380 --> 05:07.600
easiest depending on the

108
05:07.600 --> 05:12.560
situation. You might prefer one over the other. For small and simple networks,

109
05:12.560 --> 05:13.440
I prefer to use the

110
05:13.440 --> 05:18.160
INI format, but for inventories whereby the topology is a little bit more

111
05:18.160 --> 05:19.840
complex, I then choose

112
05:19.840 --> 05:24.290
to switch to the YAML format, but it's entirely up to you. Now, the cool thing

113
05:24.290 --> 05:25.600
about our inventory is

114
05:25.600 --> 05:29.670
that we can actually have this logical segmentation of our devices. What on

115
05:29.670 --> 05:30.960
earth am I talking about
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

115
05:29.670 --> 05:30.960
earth am I talking about

116
05:30.960 --> 05:34.980
here? So once again, let's look at this four node network. Now, let's just

117
05:34.980 --> 05:36.080
imagine that, say, for

118
05:36.080 --> 05:41.260
example, the top two devices, they happen to be in the United States. This is

119
05:41.260 --> 05:42.880
the physical location,

120
05:42.880 --> 05:47.770
okay? So these are in the USA. And let's just say the bottom two devices are in

121
05:47.770 --> 05:48.880
the UK. Now, let's

122
05:48.880 --> 05:53.580
suppose we wanted Ansible to automate out a very particular configuration for a

123
05:53.580 --> 05:54.640
very particular

124
05:54.640 --> 05:59.550
subset of devices. By virtue of us having these groups within our inventories,

125
05:59.550 --> 06:00.720
we can target those
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

125
05:59.550 --> 06:00.720
we can target those

126
06:00.720 --> 06:04.780
groups based on that group membership or rather target those devices based on

127
06:04.780 --> 06:06.080
their group membership.

128
06:06.080 --> 06:09.520
Let me give you a more concrete example. Let's imagine we wanted to configure

129
06:09.520 --> 06:10.160
some type of

130
06:10.160 --> 06:15.490
NTP server. Now, we didn't want every device in our network to have the exact

131
06:15.490 --> 06:16.960
same configuration.

132
06:16.960 --> 06:23.030
Instead, we wanted people in the USA to get a very particular NTP configuration

133
06:23.030 --> 06:23.680
. And people in the

134
06:23.680 --> 06:29.200
UK to get a very different NTP configuration. But because this inventory allows

135
06:29.200 --> 06:30.400
for this logical
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

135
06:29.200 --> 06:30.400
for this logical

136
06:30.400 --> 06:35.830
grouping of our devices, we can just say, hey, Ansible, connect all devices in

137
06:35.830 --> 06:37.040
the USA and give it an

138
06:37.040 --> 06:42.740
NTP server of 1.1.1.1.1.1, for example. So now Ansible goes, hey, devices in

139
06:42.740 --> 06:44.800
the USA group are S1 and S2.

140
06:44.800 --> 06:49.430
So I will just connect to those devices only and configure them with this

141
06:49.430 --> 06:50.640
particular server.

142
06:50.640 --> 06:53.710
And then similarly, we could say, hey, you know what, we would like also to

143
06:53.710 --> 06:54.880
have an NTP server

144
06:54.880 --> 07:00.180
configuration this time of let's go with 2.2.2.2. And this should be applied to
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

144
06:54.880 --> 07:00.180
configuration this time of let's go with 2.2.2.2. And this should be applied to

145
07:00.180 --> 07:01.680
every single device that we

146
07:01.680 --> 07:07.980
have in the UK. So then Ansible can say, hey, in the UK, devices S3 and S4 are

147
07:07.980 --> 07:09.360
a member of that group.

148
07:09.360 --> 07:13.310
So I will now connect to these two devices and give them the configuration of 2

149
07:13.310 --> 07:16.000
.2.2.2 for NTP. Now,

150
07:16.000 --> 07:20.280
obviously, and a network is smaller this. This might be a little bit trivial.

151
07:20.280 --> 07:21.360
But you can imagine

152
07:21.360 --> 07:26.800
if in the USA group, what if we happen to have 1000 devices? We wouldn't want

153
07:26.800 --> 07:27.280
to continue

154
07:27.280 --> 07:31.810
the login and login and login for every device to make that change instead. If
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

154
07:27.280 --> 07:31.810
the login and login and login for every device to make that change instead. If

155
07:31.810 --> 07:32.640
we can just place

156
07:32.640 --> 07:37.140
all devices in the USA group, all 1000 of them, then we can just tell Ansible

157
07:37.140 --> 07:38.320
to go, hey, you know what,

158
07:38.320 --> 07:42.000
go and make that change to that group and all those devices will be targeted

159
07:42.000 --> 07:43.040
precisely no matter

160
07:43.040 --> 07:46.960
how many of them there are. So this really makes configuration management way,

161
07:46.960 --> 07:48.160
way, way easier.

162
07:48.160 --> 07:51.960
And this is just one of the benefits we get with Ansible. So pretty much the

163
07:51.960 --> 07:53.760
inventory specifies

164
07:53.760 --> 07:57.280
which devices we have under our control, how to connect to them and how to

165
07:57.280 --> 07:58.080
essentially group

166
07:58.080 --> 08:01.820
them together. Now, in the example that I just specified before, say, for
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

166
07:58.080 --> 08:01.820
them together. Now, in the example that I just specified before, say, for

167
08:01.820 --> 08:03.200
example, we want to push

168
08:03.200 --> 08:07.460
out some type of NTP configuration. This is actually the task that we want Ans

169
08:07.460 --> 08:08.400
ible to do. Now,

170
08:08.400 --> 08:12.480
this is specified in what is known as an Ansible Playbook. Now, first thing to

171
08:12.480 --> 08:13.360
state about Ansible

172
08:13.360 --> 08:17.770
Playbooks, these are always written in Yamal. Okay, so we do not have an

173
08:17.770 --> 08:19.120
alternative file format.

174
08:19.120 --> 08:24.160
We can't write these in I and I always, always, always going to be Yamal style.

175
08:24.160 --> 08:25.120
Now, quite simply,

176
08:25.120 --> 08:30.350
these playbooks are used in conjunction with our inventory. The playbook allows
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

176
08:25.120 --> 08:30.350
these playbooks are used in conjunction with our inventory. The playbook allows

177
08:30.350 --> 08:31.440
us to specify

178
08:31.440 --> 08:36.560
what to be want to happen such as an NTP configuration or maybe an OSPF update.

179
08:36.560 --> 08:37.680
That type of thing.

180
08:37.680 --> 08:42.320
All of this specifies within the playbook. And then within the actual playbook

181
08:42.320 --> 08:42.880
itself,

182
08:42.880 --> 08:46.930
we specify which part of the inventory do we want to target with this

183
08:46.930 --> 08:48.400
particular task. So,

184
08:48.400 --> 08:52.350
quite simply, if we imagine we have two file right here, okay, this one can be

185
08:52.350 --> 08:53.760
our inventory file,

186
08:53.760 --> 08:57.790
this one can be our playbook file. Let's imagine in the inventory, we've got a

187
08:57.790 --> 08:58.640
little group called

188
08:58.640 --> 09:04.180
USA and it's got devices S1 and S2 and we've got a group called UK, which compr
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

188
08:58.640 --> 09:04.180
USA and it's got devices S1 and S2 and we've got a group called UK, which compr

189
09:04.180 --> 09:05.600
ises of devices S3

190
09:05.600 --> 09:09.600
and S4. Well, inside the playbook, we can say, hey, we want to target the USA

191
09:09.600 --> 09:10.160
group within the

192
09:10.160 --> 09:16.110
inventory and then we want to do some NTP stuff such as configure 1.1.1.1.1. So

193
09:16.110 --> 09:17.280
, Ansible reads this

194
09:17.280 --> 09:21.760
information, configures NTP, the target the USA group, looks into the inventory

195
09:21.760 --> 09:22.480
and say, hey, I should

196
09:22.480 --> 09:26.390
be connecting to devices S1 and S2 and now those configs go to those two

197
09:26.390 --> 09:28.480
devices. Now, obviously,

198
09:28.480 --> 09:31.920
these two drawings are greatly simplified. Examples of a playbook as well as an
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

198
09:28.480 --> 09:31.920
these two drawings are greatly simplified. Examples of a playbook as well as an

199
09:31.920 --> 09:32.880
inventory file will get

200
09:32.880 --> 09:36.900
to see what both of those look like very, very shortly, but ultimately, this is

201
09:36.900 --> 09:37.760
what we're talking

202
09:37.760 --> 09:41.940
about. Now, there are some more components with respect to Ansible things such

203
09:41.940 --> 09:42.640
as templates,

204
09:42.640 --> 09:45.820
things such as variables, but for the moment, just remember that Ansible is

205
09:45.820 --> 09:47.280
going to be utilising

206
09:47.280 --> 09:50.500
an agentless solution whereby the targets do not have to have anything

207
09:50.500 --> 09:51.520
installed on them to be

208
09:51.520 --> 09:55.460
managed by Ansible. And because of this, Ansible is going to utilise the push

209
09:55.460 --> 09:56.320
model, it's going to

210
09:56.320 --> 10:01.000
make great use of YAML files very particularly with respect to playbooks and
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

210
09:56.320 --> 10:01.000
make great use of YAML files very particularly with respect to playbooks and

211
10:01.000 --> 10:02.720
ultimately, playbooks allow us

212
10:02.720 --> 10:07.380
to specify what we want to happen in the network and the inventory file allows

213
10:07.380 --> 10:08.560
us to specify which

214
10:08.560 --> 10:12.660
devices we want the automation to happen to. So now we have some of the basic

215
10:12.660 --> 10:13.920
components of Ansible

216
10:13.920 --> 10:17.830
under our belt. Let's then talk about that inventory file in a little bit more

217
10:17.830 --> 10:19.040
detail as well as

218
10:19.040 --> 10:21.440
Ansible's main configuration file.
