WEBVTT

1
00:00.000 --> 00:04.520
So friends now that we've been able to devise our inventory as well as our

2
00:04.520 --> 00:05.600
login credentials

3
00:05.600 --> 00:09.960
What we've done so far is effectively just run some ad hoc commands, okay?

4
00:09.960 --> 00:13.780
So we're not really actually running playbooks as such or rather not even as

5
00:13.780 --> 00:15.120
such playbooks at all

6
00:15.120 --> 00:18.980
What we want to do now is to learn how we can actually run those playbooks

7
00:18.980 --> 00:22.930
Utilizing this automation controller so now what I want to do is to look at

8
00:22.930 --> 00:26.040
something known as projects as well as templates

9
00:26.520 --> 00:30.790
Basically these projects is where we can define our playbooks and we can
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

9
00:26.520 --> 00:30.790
Basically these projects is where we can define our playbooks and we can

10
00:30.790 --> 00:32.720
essentially run these playbooks

11
00:32.720 --> 00:35.680
Utilizing our templates kind of strange terminology

12
00:35.680 --> 00:39.580
I do admit because it isn't very clear that a template would run a playbook as

13
00:39.580 --> 00:40.440
such but nevertheless

14
00:40.440 --> 00:43.680
This is what the nomenclature is so we're going to stick with it

15
00:43.680 --> 00:48.640
So let's go and check out our projects them. So let's click this link on the

16
00:48.640 --> 00:50.120
left right here now again

17
00:50.120 --> 00:53.840
That is a demo project. That's not what we want to do. Let's create our own one

18
00:53.840 --> 00:57.500
So let's just add this and let's just call this I don't know. Let's just say n

19
00:57.500 --> 00:58.400
ugget project one

20
00:58.400 --> 01:01.400
Okay, call it anything used to wish now what is the organization?
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

20
00:58.400 --> 01:01.400
Okay, call it anything used to wish now what is the organization?

21
01:01.400 --> 01:05.610
Well, it's going to be the nugget tech organization after all and then we can

22
01:05.610 --> 01:07.440
specify our execution environment

23
01:07.440 --> 01:10.160
Now again, just going to use the default execution environment

24
01:10.160 --> 01:15.610
Just choose select and now I'm going to specify my source control type pretty

25
01:15.610 --> 01:15.920
much

26
01:15.920 --> 01:19.470
This is effectively how we're going to source whereabouts or playbooks come

27
01:19.470 --> 01:20.200
from now

28
01:20.200 --> 01:23.850
What you actually can do is you can actually define the playbooks on the

29
01:23.850 --> 01:25.040
controller itself

30
01:25.040 --> 01:28.310
And I'll show you how to do that if we just go to the drop down menu here and

31
01:28.310 --> 01:29.840
you happen to select manual

32
01:29.840 --> 01:34.220
Let's scroll on down now right here. It says there is a warning there are no
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

32
01:29.840 --> 01:34.220
Let's scroll on down now right here. It says there is a warning there are no

33
01:34.220 --> 01:36.520
playbooks within the particular directory

34
01:36.520 --> 01:41.440
This is the directory that it's going to look into var lib a wx and projects

35
01:41.440 --> 01:45.770
So it says either that directory is empty or all the contents are already

36
01:45.770 --> 01:47.480
assigned to other projects

37
01:47.480 --> 01:51.880
So basically if you want to have your playbooks held on your own system

38
01:51.880 --> 01:54.160
You can define the actual path which in this case here

39
01:54.160 --> 01:57.150
This is the default path and any playbooks stored within here will be

40
01:57.150 --> 01:59.560
accessible to this particular project now

41
01:59.560 --> 02:03.360
I would just say this is generally not how things are done at all
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

41
01:59.560 --> 02:03.360
I would just say this is generally not how things are done at all

42
02:03.360 --> 02:07.550
Typically in the real world which is what this particular skill is all about

43
02:07.550 --> 02:08.080
after all

44
02:08.080 --> 02:12.230
It's about more real world application of Ansible you are much more likely to

45
02:12.230 --> 02:13.720
use a source control system

46
02:13.720 --> 02:16.840
The most commonly one known as get tub now

47
02:16.840 --> 02:19.930
I'm not going to go through all the details about what get hub is that as an

48
02:19.930 --> 02:21.520
entire different course after all

49
02:21.520 --> 02:26.240
But the quick overview is basically that get tub is an online website

50
02:26.240 --> 02:30.380
That is used for the collaboration of many different code based projects with
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

50
02:26.240 --> 02:30.380
That is used for the collaboration of many different code based projects with

51
02:30.380 --> 02:33.140
things like configuration files or Python code or

52
02:33.140 --> 02:37.560
Ansible playbooks that type of thing can all be shared and stored on get hub

53
02:37.560 --> 02:38.220
online

54
02:38.220 --> 02:41.890
So what I want to do is I want to actually go and create what is known as a get

55
02:41.890 --> 02:43.080
hub repository

56
02:43.080 --> 02:45.420
And that's going to have my Ansible playbooks with thinnets

57
02:45.420 --> 02:49.680
So let me go to a browser here and if I just search for get tub and I click

58
02:49.680 --> 02:50.540
this link here

59
02:50.540 --> 02:54.020
Now what you want to do here if you don't have an account is to click sign up

60
02:54.020 --> 02:57.700
They're going to ask you for some particular details such as your email address

61
02:57.700 --> 02:59.260
and the password that type of thing

62
02:59.260 --> 03:01.520
But in my case here, I already have an account
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

62
02:59.260 --> 03:01.520
But in my case here, I already have an account

63
03:01.520 --> 03:04.780
So I'm just going to sign into it. So just type in the username and password

64
03:04.780 --> 03:08.660
Okay, so I have logged into my personal get tub account and all I will do here

65
03:08.660 --> 03:10.300
is I will create a new repository

66
03:10.300 --> 03:14.280
So if I go up to the top here and then go to your repositories all I will do

67
03:14.280 --> 03:15.640
now is I will create a new one

68
03:15.640 --> 03:19.720
Okay, so I'll give this repository a name. Let's just call this or don't know a

69
03:19.720 --> 03:20.160
AP

70
03:20.160 --> 03:25.100
Test and I'll just say this is a test repository for Ansible automation

71
03:25.100 --> 03:28.020
platform cool now very very important points

72
03:28.020 --> 03:32.950
You can make this repository public which effectively means that anyone on the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

72
03:28.020 --> 03:32.950
You can make this repository public which effectively means that anyone on the

73
03:32.950 --> 03:34.540
internet can see this repository

74
03:34.540 --> 03:38.250
Which means that you don't have to have any type of credentials to get the code

75
03:38.250 --> 03:39.220
on this repo

76
03:39.220 --> 03:42.220
But to be aware if you happen to be working on sensitive data

77
03:42.220 --> 03:44.980
That is internal within your own enterprise

78
03:44.980 --> 03:49.120
You would probably want to create a private repository and in which case you

79
03:49.120 --> 03:51.500
would actually have to generate some type of API token

80
03:51.500 --> 03:55.680
So that you can actually authenticate remotely with this report and access its

81
03:55.680 --> 03:59.400
contents after you generated this API token on get tub itself

82
03:59.400 --> 04:03.060
You would actually have to go and create some new credentials within the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

82
03:59.400 --> 04:03.060
You would actually have to go and create some new credentials within the

83
04:03.060 --> 04:04.300
automation controller

84
04:04.300 --> 04:06.980
In fact, you know what let's just go through the entire process

85
04:06.980 --> 04:10.810
So it's clear because ultimately this is a real world skill and it is going to

86
04:10.810 --> 04:11.620
be helpful for you

87
04:11.620 --> 04:13.540
So let's create a private repository here

88
04:13.540 --> 04:16.660
So no one can see it and I'll just say I'll add a read me file care now

89
04:16.660 --> 04:20.860
If I just choose create repository here it is right here now if I just go and

90
04:20.860 --> 04:22.660
click the plus sign right here

91
04:22.660 --> 04:26.280
I can create a new file so I can do here is effectively create my Ansible

92
04:26.280 --> 04:27.100
playbook now

93
04:27.100 --> 04:30.790
Traditionally what you wouldn't do is actually create the playbook directly on
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

93
04:27.100 --> 04:30.790
Traditionally what you wouldn't do is actually create the playbook directly on

94
04:30.790 --> 04:31.460
github itself

95
04:31.580 --> 04:35.800
You would more likely create this locally on your system and then push the

96
04:35.800 --> 04:37.460
changes to github again

97
04:37.460 --> 04:40.760
This is not a github course. So we're not going to go into too much detail. Let

98
04:40.760 --> 04:42.140
's keep it as simple as possible

99
04:42.140 --> 04:43.540
So let's just get this playbook a name

100
04:43.540 --> 04:46.940
We'll just say play one test playbook the host I will target

101
04:46.940 --> 04:50.840
Let's maybe just go with the yellow box and now I'll define my task and just

102
04:50.840 --> 04:52.580
say install engine X

103
04:52.580 --> 04:54.900
And I'll use the Ansible built-in

104
04:55.300 --> 04:59.770
DNF module and I'll say the name I want to install is engine X the state should

105
04:59.770 --> 05:01.660
be present and now I'll have an
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

105
04:59.770 --> 05:01.660
be present and now I'll have an

106
05:01.660 --> 05:04.940
Another task which would just be to start the engine X server so this time

107
05:04.940 --> 05:08.300
I'll use the built-in service module and I say the name of the service

108
05:08.300 --> 05:12.480
We're targeting as the engine X server was just installed and the state should

109
05:12.480 --> 05:14.120
be in the started state

110
05:14.120 --> 05:16.700
Kill so all I will do here is name my playbook

111
05:16.700 --> 05:20.890
Let's just call this engine X test dot yml and all I will do is I'll choose

112
05:20.890 --> 05:22.540
commit these changes

113
05:22.540 --> 05:25.900
And they'll just come at the changes again and now we can see here within the

114
05:25.900 --> 05:26.460
repository

115
05:26.460 --> 05:29.940
I have this actual playbook so pretty much what I want to do is I want to allow

116
05:29.940 --> 05:31.940
access to this particular repository
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

116
05:29.940 --> 05:31.940
access to this particular repository

117
05:31.940 --> 05:36.780
So people within my team who should have access can get access to this playbook

118
05:36.780 --> 05:39.700
So what I will do here is I'll go to my settings here

119
05:39.700 --> 05:44.300
Let's get into settings and if I scroll on down if I go to developer settings

120
05:44.300 --> 05:47.060
and then go to personal access tokens

121
05:47.060 --> 05:51.380
And now I specify the tokens classic okay, and all I will do is I will click

122
05:51.380 --> 05:54.620
generate a new token and again generate new token classic

123
05:54.620 --> 05:58.740
And let's give this a token a name just call a AP demo token now

124
05:58.740 --> 06:01.890
How long should this token last for you can specify how long I would just give
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

124
05:58.740 --> 06:01.890
How long should this token last for you can specify how long I would just give

125
06:01.890 --> 06:04.420
it a custom time and I'll pretty much specify

126
06:04.420 --> 06:09.500
That it should expire by the 15th of April, which is about two days time

127
06:09.500 --> 06:12.700
Then I specify the scope of what this token should be allowed to do

128
06:12.700 --> 06:15.260
So should I have full control of the private repositories?

129
06:15.260 --> 06:19.610
Let's say yes, should I have the ability to delete repositories perhaps be able

130
06:19.610 --> 06:22.340
to have right access to our discussions that type of thing

131
06:22.340 --> 06:26.130
Define the rules as you so wish but from now all I will do here is I will go

132
06:26.130 --> 06:27.980
down and I'll choose generate token

133
06:27.980 --> 06:31.750
So right here I have this particular token and all I'm going to do is I'm going
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

133
06:27.980 --> 06:31.750
So right here I have this particular token and all I'm going to do is I'm going

134
06:31.750 --> 06:32.580
to copy it

135
06:32.580 --> 06:35.860
Okay, now check this out. Why I want to do is to go back to answerable

136
06:35.860 --> 06:39.500
Okay, so now that we have created our token over on the github website

137
06:39.580 --> 06:43.150
Why do I want to do is I want to go to my credentials here on answerable the

138
06:43.150 --> 06:46.180
automation platform and I will just add the new credential

139
06:46.180 --> 06:51.260
So let's just call this github creds just a creds for github the organization

140
06:51.260 --> 06:52.500
is going to be nugget tick

141
06:52.500 --> 06:56.460
Just choose select and the credential type this time. It's not going to be

142
06:56.460 --> 06:56.840
machine

143
06:56.840 --> 07:00.740
It's going to be source control. So let's just select this and now go to my
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

143
06:56.840 --> 07:00.740
It's going to be source control. So let's just select this and now go to my

144
07:00.740 --> 07:01.580
details now

145
07:01.580 --> 07:06.050
What I want to do is I want to specify my github login username, which is just

146
07:06.050 --> 07:08.980
simply IPV0 and it's at gmail.com

147
07:08.980 --> 07:12.750
And now for the password what I'm going to do is I'm actually going to just

148
07:12.750 --> 07:14.860
paste in that token that I just generated here

149
07:14.860 --> 07:17.100
Okay, so if I just paste this in right here

150
07:17.100 --> 07:21.060
We can see this as the very very large token and all I will do is I'll scroll

151
07:21.060 --> 07:23.060
on down and I will choose save

152
07:23.060 --> 07:27.540
So now I have this new token here called github creds with that now done

153
07:27.540 --> 07:30.940
If I go to my projects here and I choose to add the project
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

153
07:27.540 --> 07:30.940
If I go to my projects here and I choose to add the project

154
07:30.940 --> 07:35.970
I'll just call this my projects one or whatever just a test project was the

155
07:35.970 --> 07:36.860
organization

156
07:36.860 --> 07:41.500
That's nugget tick execution environment as default and now choose the source

157
07:41.500 --> 07:42.300
control type

158
07:42.300 --> 07:46.100
Now the type here is going to be get and now what I will do specify the source

159
07:46.100 --> 07:47.100
control URL

160
07:47.100 --> 07:51.820
So I'll go back to my repository to here if I go to code and I just copy this

161
07:51.820 --> 07:52.820
link right here

162
07:52.820 --> 07:56.740
And now I paste in the source control URL and now if I scroll on down

163
07:56.740 --> 08:00.880
I'm going to have to specify my source control credential that I just created
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

163
07:56.740 --> 08:00.880
I'm going to have to specify my source control credential that I just created

164
08:00.880 --> 08:00.980
there

165
08:00.980 --> 08:02.620
So if I go to my magnifying class

166
08:02.620 --> 08:06.490
We should have these github creds that's going to associate and just choose

167
08:06.490 --> 08:08.340
select and now if I scroll on down

168
08:08.340 --> 08:12.180
I can choose save and now I have effectively created this project

169
08:12.180 --> 08:16.410
That is going to pull any playbooks from within this repository if I want to

170
08:16.410 --> 08:18.980
execute one what you can now do is go to my templates

171
08:18.980 --> 08:21.780
So all I will do now is choose add to add the templates

172
08:21.780 --> 08:25.620
And I'll just say add a job template and I'll give the name of the template

173
08:25.620 --> 08:28.300
I'll just call this maybe engine X template

174
08:28.300 --> 08:32.630
I'll just call this test job the job type is it to run or is it to check we
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

174
08:28.300 --> 08:32.630
I'll just call this test job the job type is it to run or is it to check we

175
08:32.630 --> 08:34.400
talked about this earlier on within

176
08:34.400 --> 08:37.860
Ansible remember we had answerable check mode if you want to just check you can

177
08:37.860 --> 08:39.420
specify check in this case here

178
08:39.420 --> 08:41.980
I really wanted to run now. What is the infant today?

179
08:41.980 --> 08:45.990
I want to use I want to target my Linux infant or a and now specify the actual

180
08:45.990 --> 08:46.940
project with a project

181
08:46.940 --> 08:50.980
I just created was my project one choose select here and now we can see here

182
08:50.980 --> 08:54.710
I actually have this drop down menu of all of the playbooks within that

183
08:54.710 --> 08:56.900
repository now right now that is only one

184
08:56.900 --> 09:00.140
So the only one available is engine X - test yml
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

184
08:56.900 --> 09:00.140
So the only one available is engine X - test yml

185
09:00.140 --> 09:04.630
But if I added more to that repository then more would be available for me to

186
09:04.630 --> 09:04.980
select

187
09:04.980 --> 09:08.800
So let me choose this playbook here and for credentials for the actual

188
09:08.800 --> 09:09.300
execution

189
09:09.300 --> 09:12.460
It's going to be the rail credentials that will allow me to log into my devices

190
09:12.460 --> 09:16.520
And if I scroll on down we have some additional options such as privilege

191
09:16.520 --> 09:17.820
escalation do we want to do that?

192
09:17.820 --> 09:22.310
But for now all I will do for the moment is just choose save now recall the

193
09:22.310 --> 09:24.300
actual engine X test playbook is going to

194
09:24.300 --> 09:28.300
Specifically target the yellow box and attempt to install engine X now

195
09:28.300 --> 09:32.260
What I want to do here is over on the yellow box as I just want to say system c
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

195
09:28.300 --> 09:32.260
What I want to do here is over on the yellow box as I just want to say system c

196
09:32.260 --> 09:32.580
ta

197
09:32.580 --> 09:37.320
Status on engine X and we can see here engine X indeed is not installed on this

198
09:37.320 --> 09:39.180
system after we run the playbook

199
09:39.180 --> 09:42.980
This should now be present and running so if I go to my templates here

200
09:42.980 --> 09:47.000
What I can now do is I can just choose to launch the template with this icon

201
09:47.000 --> 09:47.540
now

202
09:47.540 --> 09:50.700
It's going to begin to run and we can see the playbook begins to execute

203
09:50.700 --> 09:51.420
however

204
09:51.420 --> 09:55.620
It appears we happen to have a failure if we go to details and again go back to

205
09:55.620 --> 09:55.940
output

206
09:55.940 --> 09:58.980
Let's actually look at the output here if I scroll on down

207
09:58.980 --> 10:03.340
We can actually see this command has to be run by the root user and that is DNF
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

207
09:58.980 --> 10:03.340
We can actually see this command has to be run by the root user and that is DNF

208
10:03.340 --> 10:08.070
Now that is because if we go back to our templates here and we go back in if I

209
10:08.070 --> 10:09.420
go into edit modes

210
10:09.420 --> 10:11.900
And I scroll all the way down notice

211
10:11.900 --> 10:14.580
I actually want to select privilege escalation

212
10:14.580 --> 10:17.820
So we actually become the root user to install a particular package

213
10:17.820 --> 10:22.870
So we're effective with the sudo DNF. So if I save this now with the change and

214
10:22.870 --> 10:24.700
I now go back to my templates

215
10:24.700 --> 10:26.620
And I attempt to launch it this time

216
10:26.620 --> 10:30.180
Let's see how we go on the second attempt and this time
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

216
10:26.620 --> 10:30.180
Let's see how we go on the second attempt and this time

217
10:30.180 --> 10:33.640
It says that output is successful so if we go back to our details and then go

218
10:33.640 --> 10:34.540
back to our outputs

219
10:34.540 --> 10:35.500
Scrolling on down

220
10:35.500 --> 10:36.900
We can actually see the play recap

221
10:36.900 --> 10:41.140
And if I go back to the yellow box and I add a lot and to enter notice now

222
10:41.140 --> 10:43.140
engine X is running on the system
