WEBVTT

1
00:00.000 --> 00:02.640
Okay friends, so let's walk through the solution.

2
00:02.640 --> 00:06.880
So the very first thing that I asked you to do was to define a variable in the

3
00:06.880 --> 00:13.920
all.yaml file called ntp_server, and this should have the value 5.6.7.8.

4
00:13.920 --> 00:17.920
So the all.yaml file as we know should be located in the group var directory,

5
00:17.920 --> 00:20.800
and inside here I will just say vim all.yaml,

6
00:20.800 --> 00:25.360
I'll go into insert mode, and I will add the key ntp_server,

7
00:25.360 --> 00:29.040
and I'll give it the corresponding value 5.6.7.8.

8
00:29.040 --> 00:33.680
So press escape wq to write and quit, and now what I need to do is to write an
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

8
00:29.040 --> 00:33.680
So press escape wq to write and quit, and now what I need to do is to write an

9
00:33.680 --> 00:36.880
answerable playbook to print this variable out for all hosts in the infant

10
00:36.880 --> 00:37.360
story.

11
00:37.360 --> 00:41.600
So let's go back and I'll just create a little variable called validation 2,

12
00:41.600 --> 00:45.200
and go in here, go into insert mode to have my three hyphens at the top,

13
00:45.200 --> 00:49.200
I'll give a name validation test, what we're going to target the scope is going

14
00:49.200 --> 00:49.840
to target

15
00:49.840 --> 00:54.480
all the devices, I will specify my tasks, and I'll just give this a name,

16
00:54.480 --> 00:59.040
I'll just say printing out the var value, and then I will use a debug module,

17
00:59.040 --> 01:02.560
and the message parameter, and I will just simply within quotation marks,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

17
00:59.040 --> 01:02.560
and the message parameter, and I will just simply within quotation marks,

18
01:02.560 --> 01:06.080
I will add my double curly braces, and then just call the name of the variable,

19
01:06.080 --> 01:10.990
which in this case here is going to be ntp_server, so I'll just press escape wq

20
01:10.990 --> 01:11.920
to write and quit.

21
01:11.920 --> 01:16.800
So if I say answerable playbook validation 2, and to enter, and as we can see

22
01:16.800 --> 01:17.120
here,

23
01:17.120 --> 01:22.400
we are successfully printing out 5.6.7.8 for both the blue box and yellow box

24
01:22.400 --> 01:23.040
devices.

25
01:23.040 --> 01:26.560
So the next thing I'm going to have to do is to select one device in the infant

26
01:26.560 --> 01:26.880
story,

27
01:26.880 --> 01:30.880
and override the ntp server value that it inherits from its group membership,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

27
01:26.880 --> 01:30.880
and override the ntp server value that it inherits from its group membership,

28
01:30.880 --> 01:34.880
and I'm going to give it the value 4.3.2.1, so basically pick any of these

29
01:34.880 --> 01:36.240
devices in your infant story,

30
01:36.240 --> 01:40.240
so I will go in to my host files this time, and I'm going to modify, let's say

31
01:40.240 --> 01:41.040
the blue box.

32
01:41.040 --> 01:44.480
So inside of this particular file, all I'll do is go to the end here,

33
01:44.480 --> 01:49.520
and I will say ntp_server, and I'm going to give it the value 4.3.2.1.

34
01:49.520 --> 01:52.640
So if I press escape, and then wq to write and quit.

35
01:52.640 --> 01:56.000
If I say answerable playbook on validation 2, hit enter.

36
01:56.000 --> 02:00.000
As we can see here, the blue box is now overriding its group membership,
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

37
02:00.000 --> 02:04.720
and it is printing out 4.3.2.1 whilst the yellow box still retains its original

38
02:04.720 --> 02:06.160
value from the group membership.

39
02:06.160 --> 02:09.920
Now the next thing we're going to have to do is to without modifying any host

40
02:09.920 --> 02:10.880
or group variable

41
02:10.880 --> 02:15.580
files, we want to rerun the playbook and ensure that the ntp_server value is 1.

42
02:15.580 --> 02:17.280
1.1 for all devices.

43
02:17.280 --> 02:21.680
We're not going to modify any host or group variable files, but what we can do

44
02:21.680 --> 02:22.560
is we can modify the

45
02:22.560 --> 02:26.080
playbook itself, so we're going to validation 2, and at the very top here I'm

46
02:26.080 --> 02:27.440
going to say vars,

47
02:27.440 --> 02:31.120
and I will just create the ntp_server variable right here, and give it the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

47
02:27.440 --> 02:31.120
and I will just create the ntp_server variable right here, and give it the

48
02:31.120 --> 02:32.960
value 1.1.1.1.1.

49
02:32.960 --> 02:37.630
If I press escape wq to write and quit, clear the screen, add a warp, and rerun

50
02:37.630 --> 02:38.320
again.

51
02:38.320 --> 02:43.240
Now we're printing out the value 1.1.1.1 for all devices overriding both group

52
02:43.240 --> 02:44.560
and host variable

53
02:44.560 --> 02:48.390
membership. So we could solve it that way, but just to be clear, if I go into

54
02:48.390 --> 02:49.680
validation 2 once again,

55
02:49.680 --> 02:54.210
and I delete this part of the solution, so just press dd and dd. Now we have

56
02:54.210 --> 02:54.800
not defined the

57
02:54.800 --> 02:58.320
variable directly within the playbook, what we also could do is I could just

58
02:58.320 --> 02:59.440
run Ansible playbook

59
02:59.440 --> 03:03.450
and say validation 2, and then say -e for extra variables, and then with the n
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

59
02:59.440 --> 03:03.450
and say validation 2, and then say -e for extra variables, and then with the n

60
03:03.450 --> 03:06.800
tp_server,

61
03:06.800 --> 03:12.560
is equal to 1.1.1.1, n my quotation marks and hit enter, and as we can see here

62
03:12.560 --> 03:13.680
, without modifying

63
03:13.680 --> 03:18.240
any host or group vars, we have successfully overwritten the value of the ntp_

64
03:18.240 --> 03:18.720
server.

65
03:18.720 --> 03:22.160
Now the next thing we're going to have to do is to create a brand new file with

66
03:22.160 --> 03:23.040
the key value

67
03:23.040 --> 03:27.660
password secret, and not just that, we want to ensure that this brand new file

68
03:27.660 --> 03:28.880
is encrypted.

69
03:28.880 --> 03:32.480
So that will say Ansible vault, and I want to create, because it's a brand new
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

69
03:28.880 --> 03:32.480
So that will say Ansible vault, and I want to create, because it's a brand new

70
03:32.480 --> 03:33.200
file not

71
03:33.200 --> 03:37.280
encrypt, which is what we use for an already existing file, and just call this

72
03:37.280 --> 03:37.520
file

73
03:37.520 --> 03:42.510
ntp_server, or just call this bla.yml, does that actually matter? If I hit

74
03:42.510 --> 03:43.200
enter, I'm going to

75
03:43.200 --> 03:47.240
create a password, let's just say the password is jiohgen for john, and I will

76
03:47.240 --> 03:48.080
confirm it.

77
03:48.080 --> 03:52.530
And inside of here, I now have my vencation, so I'll press i for insert mode,

78
03:52.530 --> 03:53.200
and then just type

79
03:53.200 --> 03:57.070
passwords colon to create it as a key, and then the corresponding value is

80
03:57.070 --> 03:58.320
going to be secret 1.

81
03:58.320 --> 04:03.800
Now if I press escape colon wq to write and quit, notice if I cat the file, it
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

81
03:58.320 --> 04:03.800
Now if I press escape colon wq to write and quit, notice if I cat the file, it

82
04:03.800 --> 04:04.720
is in an encrypted

83
04:04.720 --> 04:08.800
state. Now what I want to do is to view the unencrypted content of this file

84
04:08.800 --> 04:09.360
without

85
04:09.360 --> 04:13.140
actually decrypting the file on disk. So the way I can do this is by saying Ans

86
04:13.140 --> 04:14.160
ible vault,

87
04:14.160 --> 04:18.020
and then view, and then specify the name of the file, and then type in the

88
04:18.020 --> 04:18.480
password,

89
04:18.480 --> 04:22.670
which in my case here was jiohgen, if I hit enter, now we can actually see the

90
04:22.670 --> 04:23.040
contents

91
04:23.040 --> 04:26.970
without actually disturbing the unencrypted state of the file. The next thing I

92
04:26.970 --> 04:27.440
want to do

93
04:27.440 --> 04:31.100
is I want to change the password of this file once again without fully decrypt
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

93
04:27.440 --> 04:31.100
is I want to change the password of this file once again without fully decrypt

94
04:31.100 --> 04:32.000
ing it on disk.

95
04:32.000 --> 04:37.150
So I will say here is Ansible vault, and I want to rekey, blah dot yml if I hit

96
04:37.150 --> 04:37.760
enter,

97
04:37.760 --> 04:42.310
type in the vault password of jiohgen, I will type in the new password of Keith

98
04:42.310 --> 04:42.320
,

99
04:42.320 --> 04:46.400
hit enter, and confirm it as Keith, hit enter again. Now the rekey is

100
04:46.400 --> 04:47.600
successful and we can test

101
04:47.600 --> 04:51.840
this, but once again try to view the file, this time using the new password

102
04:51.840 --> 04:52.720
Keith. So if I type

103
04:52.720 --> 04:57.080
Keith then hit enter, as we can see, we have the contents of the file. So that

104
04:57.080 --> 04:58.560
is us for our validation

105
04:58.560 --> 05:01.460
challenge. I hope it's been informative for you and I'd like to thank you for
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

105
04:58.560 --> 05:01.460
challenge. I hope it's been informative for you and I'd like to thank you for
