WEBVTT

1
00:00.000 --> 00:04.320
So friends in the previous video we learned how we could use the NMC line

2
00:04.320 --> 00:06.000
module and then this

3
00:06.000 --> 00:09.920
particular video what I want to do is to talk to you about an older concept

4
00:09.920 --> 00:11.040
that we have visited

5
00:11.040 --> 00:15.190
before but it is going to pop up again because it actually is going to be quite

6
00:15.190 --> 00:16.000
useful for us.

7
00:16.000 --> 00:21.120
So what exactly am I talking about and talking about the use of Ansible Rose?

8
00:21.120 --> 00:25.150
So as a quick recap remember Rose allows us to write playbooks that are more

9
00:25.150 --> 00:25.680
modular

10
00:25.680 --> 00:32.080
which are ultimately more simple and are reusable. So in this particular video
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

10
00:25.680 --> 00:32.080
which are ultimately more simple and are reusable. So in this particular video

11
00:32.080 --> 00:32.960
the focus is going to

12
00:32.960 --> 00:38.770
be utilizing a particular networking role directly for Red Hat Enterprise Linux

13
00:38.770 --> 00:39.280
systems.

14
00:39.280 --> 00:42.880
Oh with that said let's just dive in. So check this out then.

15
00:42.880 --> 00:46.000
So the very first thing that we're going to have to ensure that we have

16
00:46.000 --> 00:47.360
installed are these

17
00:47.360 --> 00:51.870
rail system roles. Now if you happen to be following along throughout this

18
00:51.870 --> 00:52.880
course and you have done

19
00:52.880 --> 00:56.670
the role skill then this should already be installed on the system but just in

20
00:56.670 --> 00:57.600
case you have not

21
00:57.600 --> 01:00.470
let me just briefly go through the command it can get you up and running. We
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

21
00:57.600 --> 01:00.470
let me just briefly go through the command it can get you up and running. We

22
01:00.470 --> 01:01.200
simply say to the

23
01:01.200 --> 01:07.590
DNF install rail - system - rose and to enter and as we can see here it says

24
01:07.590 --> 01:08.320
nothing to do that

25
01:08.320 --> 01:12.060
is because I have previously installed them. So with that said we now should

26
01:12.060 --> 01:13.120
have access to this

27
01:13.120 --> 01:16.690
particular role within our system. So what I'm going to do is to search for

28
01:16.690 --> 01:17.920
rail system roles

29
01:17.920 --> 01:21.460
network and hit enter. Now if I just scroll down a little bit we'll come to

30
01:21.460 --> 01:22.400
this get top line

31
01:22.400 --> 01:26.310
right here. Let's click this okay. Perfect. So here we have the get top page

32
01:26.310 --> 01:27.600
where all the code for

33
01:27.600 --> 01:31.460
this particular role happens to reside if I just scroll all the way down to the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

33
01:27.600 --> 01:31.460
this particular role happens to reside if I just scroll all the way down to the

34
01:31.460 --> 01:32.400
read me as we can

35
01:32.400 --> 01:36.120
see here as per the documentation this role is going to allow us to do a whole

36
01:36.120 --> 01:36.800
bunch of things

37
01:36.800 --> 01:41.060
we can configure Ethernet interfaces, bridge interfaces, VLAN interfaces, do IP

38
01:41.060 --> 01:42.000
configurations

39
01:42.000 --> 01:45.840
so on so forth. A whole bunch of options are available to us. Now let me just

40
01:45.840 --> 01:46.720
scroll down a

41
01:46.720 --> 01:50.980
touch here. So this part here at the very top is very very important. What it

42
01:50.980 --> 01:51.920
says is that the

43
01:51.920 --> 01:57.140
network role supports two different providers. The first provider is simply

44
01:57.140 --> 01:58.800
called NM which is

45
01:58.800 --> 02:04.290
for network manager and the other provider is for in net scripts. Now the NM
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

45
01:58.800 --> 02:04.290
for network manager and the other provider is for in net scripts. Now the NM

46
02:04.290 --> 02:05.360
provider is going to

47
02:05.360 --> 02:10.160
be used by all rail systems from rail seven onwards so that will mean rail

48
02:10.160 --> 02:11.120
eight and the

49
02:11.120 --> 02:15.090
configuration that we have rail nine whereas if you happen to be managing an

50
02:15.090 --> 02:16.080
older system such

51
02:16.080 --> 02:20.960
as rail six you would have the init script provider so we do want to use that N

52
02:20.960 --> 02:22.640
M provider option okay.

53
02:22.640 --> 02:27.150
Notice in this case here init scripts is deprecated in rail eight and

54
02:27.150 --> 02:28.720
completely dropped for rail

55
02:28.720 --> 02:32.600
nine so we definitely don't want to be using init scripts okay. Now what it
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

55
02:28.720 --> 02:32.600
nine so we definitely don't want to be using init scripts okay. Now what it

56
02:32.600 --> 02:34.000
also says here is that

57
02:34.000 --> 02:39.020
for each host a list of networking profiles can be configured via the network_

58
02:39.020 --> 02:40.880
connections variable.

59
02:40.880 --> 02:44.150
This is going to be crucial when we go to writer playbooks. This is going to be

60
02:44.150 --> 02:44.720
one of the keys

61
02:44.720 --> 02:47.920
we have to use. Now if you suggest you can go through all of these options but

62
02:47.920 --> 02:48.800
another place whereby

63
02:48.800 --> 02:52.100
you can find that information relating to this particular role is via the

64
02:52.100 --> 02:53.040
command line itself.

65
02:53.040 --> 02:56.880
Let's go and explore that. So what I will do is I'm going to the user directory

66
02:56.880 --> 02:57.440
and then going to

67
02:57.440 --> 03:02.050
share and then into docs and if I just say rail system roles now we have all of
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

67
02:57.440 --> 03:02.050
share and then into docs and if I just say rail system roles now we have all of

68
03:02.050 --> 03:03.040
our system roles

69
03:03.040 --> 03:07.040
and as we can see here we actually have this network folder this is the one we

70
03:07.040 --> 03:08.160
want to go into.

71
03:08.160 --> 03:12.480
So if I cd into network into a listing we have all of these example playbooks

72
03:12.480 --> 03:13.440
but we also have

73
03:13.440 --> 03:20.000
this readme.md this markdown file. If I just go in and go save them readme.md

74
03:20.000 --> 03:20.880
and to enter.

75
03:20.880 --> 03:24.320
As we can see we have access to really similar information so if I just scroll

76
03:24.320 --> 03:25.360
all the way down

77
03:25.360 --> 03:29.090
we can see examples of setting particular variables here we have our network

78
03:29.090 --> 03:29.520
provider

79
03:29.520 --> 03:32.850
set to nm we can see the network connections with a particular ethernet
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

79
03:29.520 --> 03:32.850
set to nm we can see the network connections with a particular ethernet

80
03:32.850 --> 03:34.400
interface so on so forth.

81
03:34.400 --> 03:38.080
So scrolling on down we can see we have our ip option which is going to allow

82
03:38.080 --> 03:38.560
us to have

83
03:38.560 --> 03:42.320
you guessed it ip configuration and we see the following arguments are

84
03:42.320 --> 03:44.000
supported so we have the

85
03:44.000 --> 03:48.480
address argument within ip so that means address is going to be indented within

86
03:48.480 --> 03:49.280
ip

87
03:49.280 --> 03:54.740
similarly we can specify auto gateway specify DNS as well as a whole bunch of

88
03:54.740 --> 03:55.280
other options.

89
03:55.280 --> 03:58.400
So what I will do right now is I will just go and show you how we can actually

90
03:58.400 --> 03:59.120
utilize

91
03:59.120 --> 04:04.130
this particular role okay so let me just go in and we'll say play two dot yml I
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

91
03:59.120 --> 04:04.130
this particular role okay so let me just go in and we'll say play two dot yml I

92
04:04.130 --> 04:04.880
'm going to insert

93
04:04.880 --> 04:08.190
mode have our three hyphens at the top and this play it's just simply going to

94
04:08.190 --> 04:09.600
be called play two

95
04:09.600 --> 04:14.250
testing the network role. Who am I going to target I'm going to target the all

96
04:14.250 --> 04:14.320
group once again

97
04:14.320 --> 04:18.420
I'm going to say gather facts false as we did before. Now what I want to do is

98
04:18.420 --> 04:19.520
I want to define

99
04:19.520 --> 04:24.240
my variables so I will specify my vars and remember I'm going to have to

100
04:24.240 --> 04:25.920
specify what my network

101
04:25.920 --> 04:29.130
provider happens to be so what's the network provider I have to specify it's

102
04:29.130 --> 04:30.160
going to be nm
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

102
04:29.130 --> 04:30.160
going to be nm

103
04:30.160 --> 04:34.030
recall because it's going to be real nine I'm operating on and I'm also going

104
04:34.030 --> 04:34.400
to have to

105
04:34.400 --> 04:38.900
specify the network underscore connections. Now what I'm going to do here is

106
04:38.900 --> 04:40.080
specify a name that

107
04:40.080 --> 04:43.580
I'm going to target this is going to be the interface I want to modify so in my

108
04:43.580 --> 04:44.240
case here it's going

109
04:44.240 --> 04:48.620
to have to be an existing ethernet interface so I will say ens 160 what type of

110
04:48.620 --> 04:49.520
interface is it

111
04:49.520 --> 04:53.700
well it's an ethernet interface no surprises and as per the options we just saw

112
04:53.700 --> 04:54.720
we could do things

113
04:54.720 --> 04:59.500
like create an IP configuration so I can say IP and remember indented within we

114
04:59.500 --> 05:00.080
're going to have
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

114
04:59.500 --> 05:00.080
're going to have

115
05:00.080 --> 05:03.670
that address option that we just saw within the documentation now what I'm

116
05:03.670 --> 05:04.720
going to do here is

117
05:04.720 --> 05:08.500
I'm going to make a modification and change the IP address and by the way this

118
05:08.500 --> 05:09.760
is going to be assigned

119
05:09.760 --> 05:14.750
via a list object because we can effectively apply more than one IP address per

120
05:14.750 --> 05:15.760
the interface

121
05:15.760 --> 05:22.480
so let's just give the IP address of I don't know let's say 172 16 1 1 slash 16

122
05:22.480 --> 05:23.600
okay so right now we

123
05:23.600 --> 05:26.950
have provided the variables that we're going to use with our role and now what

124
05:26.950 --> 05:27.760
we want to do is

125
05:27.760 --> 05:31.630
we actually want to call the role itself okay so out dented at the same level
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

125
05:27.760 --> 05:31.630
we actually want to call the role itself okay so out dented at the same level

126
05:31.630 --> 05:32.800
of indentation as

127
05:32.800 --> 05:36.430
your variables we'll just use the roles keywords and now we just specify the

128
05:36.430 --> 05:37.360
role that we want to

129
05:37.360 --> 05:42.550
use now it's going to be rel hyphen system roles and then we specify the exact

130
05:42.550 --> 05:43.600
role we want to use

131
05:43.600 --> 05:48.120
within the rail system roles so we can just say dot network in this particular

132
05:48.120 --> 05:49.280
case so pretty much

133
05:49.280 --> 05:54.460
this is all we need to do wq to write and quit so if I run the playbook and hit

134
05:54.460 --> 05:55.520
enter to open it

135
05:55.520 --> 05:59.300
appears I happen to have some type of error let me go in here and I can see

136
05:59.300 --> 06:00.400
that the error is
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

136
05:59.300 --> 06:00.400
that the error is

137
06:00.400 --> 06:04.310
straight away I have written gather false equals false that is obviously not

138
06:04.310 --> 06:05.440
true that should be

139
06:05.440 --> 06:09.490
gather facts apologies about that so let's just try to write and say this one

140
06:09.490 --> 06:10.800
more time and if I

141
06:10.800 --> 06:14.750
rerun the playbook and hit enter and the playbook runs we can see we have a

142
06:14.750 --> 06:16.000
change if we scroll on

143
06:16.000 --> 06:19.840
up we can see all of the things that have happened within this particular role

144
06:19.840 --> 06:20.720
so we can see we are

145
06:20.720 --> 06:24.910
updating the network connection for a particular interface ens 160 and we can

146
06:24.910 --> 06:26.000
see here we have all

147
06:26.000 --> 06:29.150
of these other things happening we can see the roles attempting to do things

148
06:29.150 --> 06:29.920
such as enable the

149
06:29.920 --> 06:33.390
networking service in the case of the yellow and blue box that was skipped
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

149
06:29.920 --> 06:33.390
networking service in the case of the yellow and blue box that was skipped

150
06:33.390 --> 06:34.400
because they were

151
06:34.400 --> 06:38.840
already operational whereas the configuration of the networking profiles that

152
06:38.840 --> 06:39.600
had to be changed

153
06:39.600 --> 06:42.940
therefore they were changed on both of the devices like I say all of these

154
06:42.940 --> 06:44.560
individual tasks such as

155
06:44.560 --> 06:48.130
installing all the necessary Python libraries in order to operate whether they

156
06:48.130 --> 06:48.800
're going to be

157
06:48.800 --> 06:52.640
skipped or whether they have to be applied all of this is handled for us just

158
06:52.640 --> 06:53.920
by virtue of invoking

159
06:53.920 --> 06:57.920
that role really really simple so with that now done we actually want to see if

160
06:57.920 --> 06:58.960
the changes have

161
06:58.960 --> 07:03.770
been applied to the system itself so let's go to the blue box first so if I do
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

161
06:58.960 --> 07:03.770
been applied to the system itself so let's go to the blue box first so if I do

162
07:03.770 --> 07:05.200
an IP adder it seems

163
07:05.200 --> 07:10.540
here that the IP address on the interface right here has actually not changed

164
07:10.540 --> 07:11.360
at all now that

165
07:11.360 --> 07:15.080
doesn't seem right because if we look to our playbook it did tell us that the

166
07:15.080 --> 07:15.840
playbook was

167
07:15.840 --> 07:20.840
successful and a change was applied what exactly is going on here well let's

168
07:20.840 --> 07:21.600
leave that on a

169
07:21.600 --> 07:25.430
cliffhanger and I will see you in the very next video where we discuss the

170
07:25.430 --> 07:26.000
problem
