WEBVTT

1
00:00.000 --> 00:04.880
So now let's go and take a look at this NMCLI module and you know the best

2
00:04.880 --> 00:06.000
place to go is

3
00:06.000 --> 00:10.440
to the actual documentation. So with that said let's bring up a browser window.

4
00:10.440 --> 00:10.880
So if you just

5
00:10.880 --> 00:15.350
happen to search for Ansible NMCLI module at the very top here we see this

6
00:15.350 --> 00:16.480
particular link,

7
00:16.480 --> 00:20.320
let's click on it. Now as it says at the very top here this module is part of

8
00:20.320 --> 00:21.360
the community

9
00:21.360 --> 00:25.830
general collection meaning that it is not going to be automatically on your

10
00:25.830 --> 00:26.320
system.

11
00:26.320 --> 00:31.080
As you can see right here not included in Ansible Core. However we know as we
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

11
00:26.320 --> 00:31.080
As you can see right here not included in Ansible Core. However we know as we

12
00:31.080 --> 00:31.920
saw before when we

13
00:31.920 --> 00:36.410
want to install a particular collection we can just simply use Ansible Galaxy

14
00:36.410 --> 00:37.280
and it is this

15
00:37.280 --> 00:41.170
particular command here which is going to give us access to the community

16
00:41.170 --> 00:42.320
general collection

17
00:42.320 --> 00:46.450
and access to the NMCLI module. So if we just go down here let's see what it

18
00:46.450 --> 00:47.920
actually does then.

19
00:47.920 --> 00:51.740
Well as we can see it's going to allow us to manage network devices no

20
00:51.740 --> 00:52.880
surprises there that is

21
00:52.880 --> 00:57.150
exactly what we would expect but more specifically it's going to allow us to

22
00:57.150 --> 00:58.880
create modify manage

23
00:58.880 --> 01:02.810
various connections and device types so that would include things like Ethernet
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

23
00:58.880 --> 01:02.810
various connections and device types so that would include things like Ethernet

24
01:02.810 --> 01:03.360
, it would include

25
01:03.360 --> 01:07.700
things like bonds which is using multiple links together as well as some more

26
01:07.700 --> 01:08.720
slightly advanced

27
01:08.720 --> 01:12.880
networking concepts that we don't have to worry about things such as VLANs

28
01:12.880 --> 01:14.000
virtual LANs.

29
01:14.000 --> 01:16.680
Now as we can see here as per the requirements we're going to have to ensure

30
01:16.680 --> 01:17.680
that network manager

31
01:17.680 --> 01:22.080
is installed on any system we want to use the NMCLI module but as we happen to

32
01:22.080 --> 01:23.600
have a rail system

33
01:23.600 --> 01:27.520
this will automatically be installed. So if we go to the actual parameters here

34
01:27.520 --> 01:28.480
we can see exactly

35
01:28.480 --> 01:32.780
what this particular utility can do. Now scrolling on down this one is very
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

35
01:28.480 --> 01:32.780
what this particular utility can do. Now scrolling on down this one is very

36
01:32.780 --> 01:33.680
very important.

37
01:33.680 --> 01:38.390
Con underscore name we can see here it's going to allow us to supply a string

38
01:38.390 --> 01:38.880
value

39
01:38.880 --> 01:43.150
and this should be the name used to call the connection. Now the important part

40
01:43.150 --> 01:43.600
here is that

41
01:43.600 --> 01:48.740
this is a required option meaning that if we want to happen to use the NMCLI

42
01:48.740 --> 01:50.160
module this particular

43
01:50.160 --> 01:55.110
option absolutely has to be provided. If we want to specify some type of DNS

44
01:55.110 --> 01:56.160
servers well we can

45
01:56.160 --> 02:01.270
supply the DNS for option the for option it's actually going to correlate to
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

45
01:56.160 --> 02:01.270
supply the DNS for option the for option it's actually going to correlate to

46
02:01.270 --> 02:03.040
IPv4 based configurations

47
02:03.040 --> 02:07.610
so that could be things such as you know GIGO's public DNS server like 8.8.8.8

48
02:07.610 --> 02:10.000
and 8.8.8.4.4

49
02:10.000 --> 02:14.090
that type of thing or perhaps even maybe a private IP address that you have on

50
02:14.090 --> 02:15.520
your own local network

51
02:15.520 --> 02:19.620
just be aware as that if you want to specify some type of DNS configuration it

52
02:19.620 --> 02:20.640
's going to take a

53
02:20.640 --> 02:25.640
list as a value and the constituent values are going to be made up of strings.

54
02:25.640 --> 02:26.400
As you can see we

55
02:26.400 --> 02:32.800
also have DNS 6 allowing us to specify IPv6 addresses for the DNS servers.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

55
02:26.400 --> 02:32.800
also have DNS 6 allowing us to specify IPv6 addresses for the DNS servers.

56
02:32.800 --> 02:33.760
Similarly when we happen

57
02:33.760 --> 02:38.150
to define a particular network connection on an interface we can use the IPv4

58
02:38.150 --> 02:38.640
option

59
02:38.640 --> 02:43.420
allowing us to once again specify a list of IPv4 addresses that we want to

60
02:43.420 --> 02:44.000
assign

61
02:44.000 --> 02:48.770
to this particular interface. Same thing is true here when it comes to IPv6 we

62
02:48.770 --> 02:50.560
simply use the IPv6

63
02:50.560 --> 02:55.060
parameter. Now if you want to add some type of static routes in your interface

64
02:55.060 --> 02:56.080
configuration

65
02:56.080 --> 03:00.800
well for IPv4 based routes you would simply use the keyword routes for once
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

65
02:56.080 --> 03:00.800
well for IPv4 based routes you would simply use the keyword routes for once

66
03:00.800 --> 03:02.320
again specifying a list

67
03:02.320 --> 03:06.590
of options and the elements are going to be in string format so in this case

68
03:06.590 --> 03:07.360
here look at this

69
03:07.360 --> 03:11.800
particular example. In the case here we have what is known as side annotation

70
03:11.800 --> 03:12.880
this part here is the

71
03:12.880 --> 03:17.690
actual network we're trying to reach so we can actually see the network ID of

72
03:17.690 --> 03:19.840
192.0.3.0

73
03:19.840 --> 03:25.520
with its network mask of a /24 and what we're effectively seeing here is that

74
03:25.520 --> 03:26.640
if you want to get

75
03:26.640 --> 03:30.770
to this particular network you should actually send the packet to this
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

75
03:26.640 --> 03:30.770
to this particular network you should actually send the packet to this

76
03:30.770 --> 03:32.880
particular destination here

77
03:32.880 --> 03:39.320
the IP address of 192.0.2.1 so quite simply we define the network we want to go

78
03:39.320 --> 03:40.560
to with its mask

79
03:40.560 --> 03:45.680
and then immediately after we specify what our next hop should be towards that

80
03:45.680 --> 03:47.120
particular destination

81
03:47.120 --> 03:51.520
this here constitutes the static routes which is what we're going to define

82
03:51.520 --> 03:52.560
right here so really

83
03:52.560 --> 03:55.960
whether it's if you're configuring static routes or if you're configuring Wi-Fi

84
03:55.960 --> 03:57.360
whatever it may be

85
03:57.360 --> 04:02.040
if you want to learn how to utilize this via nmcli via answerable all of the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

85
03:57.360 --> 04:02.040
if you want to learn how to utilize this via nmcli via answerable all of the

86
04:02.040 --> 04:03.120
details are going to

87
04:03.120 --> 04:07.580
be found within this documentation now if we just scroll down a little bit

88
04:07.580 --> 04:08.560
further we're actually

89
04:08.560 --> 04:12.560
going to see some examples so as per the documentation we have this example

90
04:12.560 --> 04:13.760
right here take this part

91
04:13.760 --> 04:17.290
okay what is going on here well as we can see here we're targeting particular

92
04:17.290 --> 04:18.080
hosts within the

93
04:18.080 --> 04:22.450
inventory and then we define our task now this part here is really just

94
04:22.450 --> 04:23.840
ensuring that the device

95
04:23.840 --> 04:28.030
we're trying to manage has all of the necessary libraries that are needed in

96
04:28.030 --> 04:29.040
order to operate

97
04:29.040 --> 04:33.440
we as Red Hat Enterprise Linux users don't have to worry about such a thing
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

97
04:29.040 --> 04:33.440
we as Red Hat Enterprise Linux users don't have to worry about such a thing

98
04:33.440 --> 04:34.560
okay so let's just move

99
04:34.560 --> 04:39.580
on to this part here we'll begin actually using the module itself so in this

100
04:39.580 --> 04:40.480
part here all we're

101
04:40.480 --> 04:44.890
doing is defining a task name and then we can see the actual use of the modules

102
04:44.890 --> 04:45.840
here as we can see

103
04:45.840 --> 04:49.680
here we have the fully qualified collection name and then intended within we

104
04:49.680 --> 04:51.200
have particular values

105
04:51.200 --> 04:55.540
so notice straight away we're always going to see this con underscore name why

106
04:55.540 --> 04:56.400
is that because as

107
04:56.400 --> 05:00.580
we saw as per the documentation this is going to be required in order for the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

107
04:56.400 --> 05:00.580
we saw as per the documentation this is going to be required in order for the

108
05:00.580 --> 05:01.760
module to operate

109
05:01.760 --> 05:05.280
now in this case here it's just being populated with some variable values but

110
05:05.280 --> 05:06.000
you can hardcode

111
05:06.000 --> 05:10.130
them if you so wish and then we have some other values we have that ip4 value

112
05:10.130 --> 05:11.600
we just looked at

113
05:11.600 --> 05:15.320
again this is going to be populated with some type of variable value in the

114
05:15.320 --> 05:16.480
example and then we have

115
05:16.480 --> 05:20.800
the gw4 value if you happen to check the documentation this is going to be the

116
05:20.800 --> 05:22.000
configuration for the

117
05:22.000 --> 05:25.970
default gateway pretty much the place you want to send packets to when we're

118
05:25.970 --> 05:26.800
trying to reach a

119
05:26.800 --> 05:30.810
remote network so this is going to be some type of routing device okay and
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

119
05:26.800 --> 05:30.810
remote network so this is going to be some type of routing device okay and

120
05:30.810 --> 05:32.720
again because it's gw4

121
05:32.720 --> 05:37.540
as you can expect the configuration supplied here is going to be an ipv4

122
05:37.540 --> 05:38.720
address once again the

123
05:38.720 --> 05:42.500
example provides a variable value but it can be hardcoded then we get to this

124
05:42.500 --> 05:43.440
part here or with

125
05:43.440 --> 05:48.240
items now if you recall when we discussed the concept of looping this here was

126
05:48.240 --> 05:48.640
an older

127
05:48.640 --> 05:53.270
convention in order to invoke a loop nowadays it's just recommended you just

128
05:53.270 --> 05:54.480
use the loop keyword

129
05:54.480 --> 05:58.360
so that's one thing i just want to highlight in this documentation you may see

130
05:58.360 --> 05:59.600
many many examples

131
05:59.600 --> 06:04.360
using with underscore items in your mind just conceptualize that as using the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

131
05:59.600 --> 06:04.360
using with underscore items in your mind just conceptualize that as using the

132
06:04.360 --> 06:05.440
loop keywords

133
06:05.440 --> 06:09.750
so really scrolling through the documentation we're going to see a wide variety

134
06:09.750 --> 06:10.480
of examples

135
06:10.480 --> 06:15.310
the very last thing i want to do is to ensure that we have the nncli module

136
06:15.310 --> 06:16.320
available to us

137
06:16.320 --> 06:20.090
so how do we get that let's scroll up to the very top once again as we can see

138
06:20.090 --> 06:20.560
as per the

139
06:20.560 --> 06:25.060
documentation we simply use this particular command so let's just copy this

140
06:25.060 --> 06:25.920
right here okay

141
06:25.920 --> 06:30.330
to copy you and then on the answerable control nodes we can just simply paste
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

141
06:25.920 --> 06:30.330
to copy you and then on the answerable control nodes we can just simply paste

142
06:30.330 --> 06:31.440
in the command

143
06:31.440 --> 06:36.000
and then hit enter now in my case here i have already installed this particular

144
06:36.000 --> 06:36.880
collection but

145
06:36.880 --> 06:40.430
if you have not the installation will begin and if you give it a few moments

146
06:40.430 --> 06:41.440
you will also have

147
06:41.440 --> 06:44.640
access to the answerable community general collection
