WEBVTT

1
00:00.000 --> 00:04.630
So friends, throughout this course, one thing we have consistently referenced

2
00:04.630 --> 00:05.600
is the Ansible

3
00:05.600 --> 00:09.720
documentation. This is proven to be very, very useful. But one thing you may

4
00:09.720 --> 00:10.560
have noticed is

5
00:10.560 --> 00:14.240
that when we go to retrieve the documentation, we're always using the internet,

6
00:14.240 --> 00:14.720
we're opening

7
00:14.720 --> 00:18.710
up a browser, we're using the big Google machine and searching for whatever it

8
00:18.710 --> 00:19.520
is we want to see.

9
00:19.520 --> 00:24.780
What if I told you that we actually don't have to do that? Now, to be clear

10
00:24.780 --> 00:25.680
here, I haven't been

11
00:25.680 --> 00:29.800
misleading you. This is actually still my preferred way to inject the Ansible

12
00:29.800 --> 00:30.800
documentation that
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

12
00:29.800 --> 00:30.800
documentation that

13
00:30.800 --> 00:33.750
happened to light the way it is presented within the browser. But for the

14
00:33.750 --> 00:35.280
purposes of the examination,

15
00:35.280 --> 00:39.460
isn't it quite good and reassuring to know is that you can still consult the

16
00:39.460 --> 00:40.480
documentation

17
00:40.480 --> 00:44.760
directly via your terminal. So what is this? What's up, Jay? What is this magic

18
00:44.760 --> 00:45.040
? Well,

19
00:45.040 --> 00:49.700
what we're going to be looking at is a command known as Ansible hyphen dot. So

20
00:49.700 --> 00:50.480
in this short video,

21
00:50.480 --> 00:54.320
what we'll do is look at the browser version and compare it to what we actually

22
00:54.320 --> 00:54.720
see in

23
00:54.720 --> 00:59.970
Ansible documentation via the command line. So let's go and boot up our browser

24
00:59.970 --> 01:01.040
. So let's maybe say
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

24
00:59.970 --> 01:01.040
. So let's maybe say

25
01:01.040 --> 01:05.060
we want to look for the Ansible file module. Okay. So with issues, Google to

26
01:05.060 --> 01:06.480
search for it. And if

27
01:06.480 --> 01:10.050
I just click the link here, as we can see by scrolling on down, we get a basic

28
01:10.050 --> 01:10.880
overview about

29
01:10.880 --> 01:14.770
what this module is. It's part of Ansible core. We can see the fully qualified

30
01:14.770 --> 01:15.760
collection name

31
01:15.760 --> 01:19.680
Ansible built in file, which is what we would use within our playbook. And we

32
01:19.680 --> 01:20.480
get some basic

33
01:20.480 --> 01:25.660
information such as the synopsis. What exactly does this particular module do,

34
01:25.660 --> 01:26.000
but it allows

35
01:26.000 --> 01:29.670
us to set attributes for files, directory, sim links and the targets, we can

36
01:29.670 --> 01:30.400
remove files,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

36
01:29.670 --> 01:30.400
remove files,

37
01:30.400 --> 01:34.830
that type of thing. And we also see crucially, the parameters that this module

38
01:34.830 --> 01:35.680
takes, how do we

39
01:35.680 --> 01:39.570
actually use this particular module? Say, for example, you want to use the

40
01:39.570 --> 01:40.720
access time parameter,

41
01:40.720 --> 01:44.210
it tells us exactly how to use this and what it actually does. And very cru

42
01:44.210 --> 01:45.200
cially, if that happens

43
01:45.200 --> 01:48.900
to be a particular parameter that is required, we can actually see that

44
01:48.900 --> 01:50.240
directly via the outputs

45
01:50.240 --> 01:53.960
if I stroll on down, say, for example, this parameter right here, the path

46
01:53.960 --> 01:55.280
parameter, we can indeed

47
01:55.280 --> 01:59.300
see that this is required. So we know if we go to use this module, we have to

48
01:59.300 --> 02:00.400
supply this parameter
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

48
01:59.300 --> 02:00.400
supply this parameter

49
02:00.400 --> 02:05.210
and provide the value. This is how we see things on the browser. But check this

50
02:05.210 --> 02:06.480
out. If I go back

51
02:06.480 --> 02:11.410
to my terminal right here, if I say Ansible, hyphen, doc, dash dash help, and

52
02:11.410 --> 02:12.000
to enter,

53
02:12.000 --> 02:15.490
what we actually see here is all the ways in which we can utilize this

54
02:15.490 --> 02:16.560
documentation.

55
02:16.560 --> 02:21.120
So say, for example, we use the dash L option or alternatively dash dash list,

56
02:21.120 --> 02:21.840
this is going to

57
02:21.840 --> 02:27.140
allow us to list the available plugins. If I now just say Ansible hyphen, doc,

58
02:27.140 --> 02:28.080
dash dash list,

59
02:28.080 --> 02:33.040
or if I so wish to dash L and to enter, look at this right here, we have all of
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

59
02:28.080 --> 02:33.040
or if I so wish to dash L and to enter, look at this right here, we have all of

60
02:33.040 --> 02:33.440
these

61
02:33.440 --> 02:36.850
Ansible plugins right here. So if I just press spacebar, we can see everything

62
02:36.850 --> 02:37.600
that we can do

63
02:37.600 --> 02:41.630
here. We have a rail system roles, we have our built in Ansible modules, that

64
02:41.630 --> 02:42.400
type of thing.

65
02:42.400 --> 02:46.580
Say, for example, therefore, if I go up to the Ansible built in file module,

66
02:46.580 --> 02:46.880
which we were

67
02:46.880 --> 02:50.260
looking at online, here is what we see right here. You see that we can see it's

68
02:50.260 --> 02:51.040
going to allow us

69
02:51.040 --> 02:55.660
to manage files and file property. So what I'm going to do now is if I just

70
02:55.660 --> 02:56.640
want to look at this

71
02:56.640 --> 03:01.070
particular documentation for this particular module, I can just copy this here,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

71
02:56.640 --> 03:01.070
particular documentation for this particular module, I can just copy this here,

72
03:01.070 --> 03:01.760
then press

73
03:01.760 --> 03:06.210
Q to quit, clear the screen. And I just say Ansible hyphen, doc, and then paste

74
03:06.210 --> 03:07.200
in the actual module

75
03:07.200 --> 03:11.890
I want to inspect. If I hit enter, check this out. Does this look a little bit

76
03:11.890 --> 03:13.120
familiar? We see

77
03:13.120 --> 03:16.060
the same type of information that we saw before, this is going to allow us to

78
03:16.060 --> 03:16.800
say attributes of

79
03:16.800 --> 03:20.040
file directories and sim links, that type of thing, we get the basics and

80
03:20.040 --> 03:21.280
options. We can also see

81
03:21.280 --> 03:24.490
all of our parameters to see this access time, and we get the little

82
03:24.490 --> 03:25.840
description as to what it

83
03:25.840 --> 03:29.970
actually does. Notice if we happen to see the equal sign, this indicates that

84
03:29.970 --> 03:31.040
this is mandatory.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

84
03:29.970 --> 03:31.040
this is mandatory.

85
03:31.040 --> 03:36.410
So if I press spacebar and go all the way down, and I get to path, notice path

86
03:36.410 --> 03:37.040
doesn't have a

87
03:37.040 --> 03:42.320
hyphen, it has an equal sign indicating that this is indeed required. And it

88
03:42.320 --> 03:43.280
tells us this is the

89
03:43.280 --> 03:46.880
path to the Fairbeam managed. Now if I scroll on down a little bit further,

90
03:46.880 --> 03:47.680
look at this right

91
03:47.680 --> 03:51.910
here, this is super, super helpful. We actually get some examples that we can

92
03:51.910 --> 03:52.800
use. This is the

93
03:52.800 --> 03:56.420
same type of thing that we would expect to see in the browser version. Big

94
03:56.420 --> 03:56.880
difference here,

95
03:56.880 --> 04:00.580
though, is we have it directly available to us on the command line. So for
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

95
03:56.880 --> 04:00.580
though, is we have it directly available to us on the command line. So for

96
04:00.580 --> 04:01.920
example, this one right

97
04:01.920 --> 04:05.960
here, let's say we wanted to change the file ownership group and permissions we

98
04:05.960 --> 04:06.800
see we use the

99
04:06.800 --> 04:11.360
Ansible built in file module as supplied here. Then we have the path parameter

100
04:11.360 --> 04:12.400
to specify the path

101
04:12.400 --> 04:16.120
that we want to modify. Then we can use the owner parameter specify the owner

102
04:16.120 --> 04:17.360
as well as the group

103
04:17.360 --> 04:21.600
and the actual permissions in this case here, denoted in optomotation.

104
04:21.600 --> 04:23.360
Similarly, let's say we

105
04:23.360 --> 04:27.210
were curious as to how to create a symbolic link, well, this example here shows

106
04:27.210 --> 04:28.240
us exactly how to do

107
04:28.240 --> 04:31.890
that. Once again, we use the Ansible built in file module, we're going to
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

107
04:28.240 --> 04:31.890
that. Once again, we use the Ansible built in file module, we're going to

108
04:31.890 --> 04:33.120
specify a source,

109
04:33.120 --> 04:36.400
which is the path to that particular file. And then the destination, which is

110
04:36.400 --> 04:37.200
going to actually

111
04:37.200 --> 04:41.340
denote the sim link, once again, we can supply the owner, the group, and

112
04:41.340 --> 04:42.720
specify the state in this

113
04:42.720 --> 04:47.010
case here, it's not going to be a directory or file, it's going to be a link.

114
04:47.010 --> 04:47.920
Whereas below,

115
04:47.920 --> 04:51.580
we can see how we can create a hard link, we specify the file module once again

116
04:51.580 --> 04:51.840
,

117
04:51.840 --> 04:55.760
the source, the destination. This time, though, the state we specify is hard,

118
04:55.760 --> 04:56.400
that is going to give

119
04:56.400 --> 05:00.560
us the hard link as opposed to a sim link or a soft link. And the cool thing is
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

119
04:56.400 --> 05:00.560
us the hard link as opposed to a sim link or a soft link. And the cool thing is

120
05:00.560 --> 05:01.120
, this is true for

121
05:01.120 --> 05:05.040
the other modules too, let's say for example, we went into Ansible.org dash L,

122
05:05.040 --> 05:05.760
and let's maybe say

123
05:05.760 --> 05:09.970
we wanted to look at the, oh, let's go with the command module. Well, again,

124
05:09.970 --> 05:11.360
let's just copy this

125
05:11.360 --> 05:14.780
particular module here. And all we need to do once again is the exact same

126
05:14.780 --> 05:16.000
process, Ansible.org,

127
05:16.000 --> 05:19.610
and then paste in the particular module we want to inspect this time, we get

128
05:19.610 --> 05:20.640
this in Optus here,

129
05:20.640 --> 05:25.600
telling us it's going to allow us to take commands, follow back a list of space

130
05:25.600 --> 05:26.720
delimited arguments,

131
05:26.720 --> 05:30.770
and once again, if we scroll on down, we see our options, the equals sign den
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

131
05:26.720 --> 05:30.770
and once again, if we scroll on down, we see our options, the equals sign den

132
05:30.770 --> 05:31.680
oting any options,

133
05:31.680 --> 05:35.440
which are mandatory to be supplied. So again, we see options such as CMD, which

134
05:35.440 --> 05:36.080
is going to allow

135
05:36.080 --> 05:40.640
to specify the command to run. If I press space bar all the way down, once

136
05:40.640 --> 05:42.160
again, we come to our

137
05:42.160 --> 05:46.160
examples. If I want to register the message of the day to a registered var,

138
05:46.160 --> 05:46.640
this is how we

139
05:46.640 --> 05:49.940
do such a thing. Use the Ansible built in command module, we can cut the

140
05:49.940 --> 05:51.120
particular file and then

141
05:51.120 --> 05:55.700
register it. In this case here, my MOTD. So let's say for example, just go back

142
05:55.700 --> 05:56.640
into the file

143
05:56.640 --> 06:00.490
documentation here, and we'll just scroll on down to the examples. And let's
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

143
05:56.640 --> 06:00.490
documentation here, and we'll just scroll on down to the examples. And let's

144
06:00.490 --> 06:01.600
try to create this

145
06:01.600 --> 06:05.680
symbolic link. So all I will do here is I'll just actually copy this directly.

146
06:05.680 --> 06:06.320
Okay, so that's

147
06:06.320 --> 06:10.800
copied. And all I will do is I'll create a playbook called play three dot YML.

148
06:10.800 --> 06:11.600
So we have our three

149
06:11.600 --> 06:15.290
high-fins at the top, which is play three, create Simlink. The host I will

150
06:15.290 --> 06:16.480
target, I will just target

151
06:16.480 --> 06:21.290
the blue box this time. I'll set gather facts to false. And in this case here,

152
06:21.290 --> 06:22.000
all I'm going to do

153
06:22.000 --> 06:25.780
is I'm going to paste in that example. Now, one thing we may notice here is

154
06:25.780 --> 06:26.960
that the indentation

155
06:26.960 --> 06:31.020
is not exactly correct. So all I will do is indent everything two spaces. So
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

155
06:26.960 --> 06:31.020
is not exactly correct. So all I will do is indent everything two spaces. So

156
06:31.020 --> 06:32.400
there is correctly aligned.

157
06:32.400 --> 06:35.630
And now I have this nice little template that's going to allow to create Sim

158
06:35.630 --> 06:36.640
link. All I will do

159
06:36.640 --> 06:40.310
is modify some of these values here. So on the blue box here, let's create a

160
06:40.310 --> 06:41.840
file. So in my working

161
06:41.840 --> 06:45.610
directory here, let me just create a file called, or I don't know, let's just

162
06:45.610 --> 06:47.120
say link example dot

163
06:47.120 --> 06:50.680
Txt, okay, doesn't actually matter. And all I will do is I'll supply those

164
06:50.680 --> 06:52.000
values here. So I'll go in

165
06:52.000 --> 06:58.010
here, and I'll use the path of home nugget user, and I'll say link example dot

166
06:58.010 --> 06:59.840
Txt and the destination.

167
06:59.840 --> 07:04.380
Let me just put in the temp directory. And I'll just call this my link example.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

167
06:59.840 --> 07:04.380
Let me just put in the temp directory. And I'll just call this my link example.

168
07:04.380 --> 07:05.440
Okay. Now the owner

169
07:05.440 --> 07:10.040
can be nugget user. The group is also going to be the nugget user group, and

170
07:10.040 --> 07:11.120
the state is going to be

171
07:11.120 --> 07:14.720
a link. So it's going to be a Simlink. If I wanted a hard link, I would specify

172
07:14.720 --> 07:15.520
a hard link here. But

173
07:15.520 --> 07:19.130
in this case here, let's just keep it as a Simlink. And just before I actually

174
07:19.130 --> 07:20.160
run this, one thing I'm

175
07:20.160 --> 07:23.430
going to have to do, of course, is I'm going to have to use my task keyword to

176
07:23.430 --> 07:24.320
specify that I'm

177
07:24.320 --> 07:28.100
actually creating a task here. So let's write and quit. And let's then run the

178
07:28.100 --> 07:29.120
playbook. So we

179
07:29.120 --> 07:32.900
execute and it appears we have a change on the device. So we go into the blue
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

179
07:29.120 --> 07:32.900
execute and it appears we have a change on the device. So we go into the blue

180
07:32.900 --> 07:33.680
box, if I go into

181
07:33.680 --> 07:38.920
the temp directory, and I do an LS, we can see my link example. In fact, let's

182
07:38.920 --> 07:39.760
do a long last thing

183
07:39.760 --> 07:44.030
on that. If I scroll on up, check this out right here. This is my linked

184
07:44.030 --> 07:45.200
example. And what does it

185
07:45.200 --> 07:49.770
actually point to? It points to the home nugget user link example file. We did

186
07:49.770 --> 07:50.880
successfully create

187
07:50.880 --> 07:55.020
that Simlink. And how did we do that? Well, we just copied it directly from the

188
07:55.020 --> 07:55.520
Ansible

189
07:55.520 --> 07:59.440
documentation available to us directly within our terminal.
