WEBVTT

1
00:00.000 --> 00:03.000
So friends, let's walk through the validation challenge.

2
00:03.000 --> 00:06.280
So the very first thing that we're going to have to do is to define a DNS

3
00:06.280 --> 00:08.360
server of 8.8.8.8.8

4
00:08.360 --> 00:12.000
and the host variable file for the first managed device in the inventory.

5
00:12.000 --> 00:15.880
So in my inventory right here, my first device is Blue Box.

6
00:15.880 --> 00:18.000
So I'll go into my blue box dot yml.

7
00:18.000 --> 00:21.480
And what I have to do is to go into insert mode, have my three hyphens at the

8
00:21.480 --> 00:21.680
top,

9
00:21.680 --> 00:23.880
and then define my DNS server.

10
00:23.880 --> 00:26.480
So I'm going to say is DNS hyphen servers.

11
00:26.480 --> 00:30.120
And I'm going to actually make this plural because even though I don't happen
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

11
00:26.480 --> 00:30.120
And I'm going to actually make this plural because even though I don't happen

12
00:30.120 --> 00:30.800
to have

13
00:30.800 --> 00:34.880
multiple DNS servers, but as a possibility for expansion in the future.

14
00:34.880 --> 00:39.050
And more importantly, the keys have to be consistent across the different files

15
00:39.050 --> 00:39.320
.

16
00:39.320 --> 00:42.080
That is if we're going to call the same key from the same template.

17
00:42.080 --> 00:44.600
So I'm just going to use DNS servers plural.

18
00:44.600 --> 00:48.520
Then I'll have my hyphen and specify 8.8.8.8.

19
00:48.520 --> 00:52.000
So like I say, there's only one value in this particular array at this moment

20
00:52.000 --> 00:52.520
in time.

21
00:52.520 --> 00:53.760
So let's write in quits.

22
00:53.760 --> 00:58.000
And now going to the second managed device now in this particular file here,

23
00:58.000 --> 01:03.920
we have to define two DNS servers of 8.8.8.8.8 and 8.8.4.4.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

23
00:58.000 --> 01:03.920
we have to define two DNS servers of 8.8.8.8.8 and 8.8.4.4.

24
01:03.920 --> 01:07.000
So we're going to insert mode once again, have our three hyphens at the top,

25
01:07.000 --> 01:10.600
use the same key, which is DNS underscore servers once again plural.

26
01:10.600 --> 01:13.870
And then we'll have an array object and specify all the aids for the first

27
01:13.870 --> 01:14.160
server.

28
01:14.160 --> 01:17.960
And then below we'll have 8.8.4.4.

29
01:17.960 --> 01:20.680
If I press escape colon, write and quits.

30
01:20.680 --> 01:23.160
That is the first portion of the validation done.

31
01:23.160 --> 01:26.520
The next thing we're going to have to do is to write a ginger two template

32
01:26.520 --> 01:30.840
called validation dot j2 that's going to render the DNS configuration
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

32
01:26.520 --> 01:30.840
called validation dot j2 that's going to render the DNS configuration

33
01:30.840 --> 01:34.160
for each device's etzer resolve dot conf configuration file.

34
01:34.160 --> 01:36.880
So if I go back and I go into my templates directory,

35
01:36.880 --> 01:40.480
I'm going to create one called validation dot j2.

36
01:40.480 --> 01:42.920
And let's just go in and modify this now.

37
01:42.920 --> 01:46.040
Now in this case here, what I want to do is to invoke a loop

38
01:46.040 --> 01:48.600
because we can have multiple DNS servers.

39
01:48.600 --> 01:50.120
So I'm going to insert mode.

40
01:50.120 --> 01:53.160
I'm not going to use my three hyphens at the top because we're not dealing

41
01:53.160 --> 01:54.560
with the yaml file now.

42
01:54.560 --> 01:57.480
What I will do is have my curly brace and then my percentage sign

43
01:57.480 --> 01:59.120
to indicate my control.

44
01:59.120 --> 02:02.600
And then I will just say four and create a name for a variable.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

44
01:59.120 --> 02:02.600
And then I will just say four and create a name for a variable.

45
02:02.600 --> 02:06.600
I should say server and then we specify the DNS servers key.

46
02:06.600 --> 02:10.320
Again, this is why we want to have the same key consistent across both files.

47
02:10.320 --> 02:12.840
And then I'll have my percentage sign and then curly brace.

48
02:12.840 --> 02:16.040
And all I'm going to do here is say name server.

49
02:16.040 --> 02:20.080
And then use my double curly braces here and populate the variable value.

50
02:20.080 --> 02:22.040
So I'll just have server in here.

51
02:22.040 --> 02:25.040
And then what I'm going to have to do, I'm going to have to close off this for

52
02:25.040 --> 02:25.280
loop

53
02:25.280 --> 02:27.480
by saying end for perfect.

54
02:27.480 --> 02:30.240
So if I just escape colon, write and quit.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

54
02:27.480 --> 02:30.240
So if I just escape colon, write and quit.

55
02:30.240 --> 02:33.280
The next thing I'm going to have to do is to write an answerable playbook

56
02:33.280 --> 02:36.200
that is going to target all the devices in the inventory.

57
02:36.200 --> 02:41.800
So let's go back a directory and I'll just say them validation dot yml.

58
02:41.800 --> 02:44.040
Again, call this playbook, enter new so wish.

59
02:44.040 --> 02:45.120
I'm going to insert mode.

60
02:45.120 --> 02:46.360
Now we'll have my three hyphens.

61
02:46.360 --> 02:48.160
We're back using yml once again.

62
02:48.160 --> 02:51.600
And at the very top, I'm going to have my hyphen and then specify a name for

63
02:51.600 --> 02:52.480
this play.

64
02:52.480 --> 02:55.400
I'll just say validation for templates.

65
02:55.400 --> 02:59.840
Okay, call this the important part here is that we target the hosts of the all

66
02:59.840 --> 03:00.280
group.
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

66
02:59.840 --> 03:00.280
group.

67
03:00.280 --> 03:02.680
And now I'm going to define my tasks.

68
03:02.680 --> 03:06.840
So hyphen name and the name of the task will just be render conflicts.

69
03:06.840 --> 03:10.560
And now I'm going to use the answerable built in template module.

70
03:10.560 --> 03:12.200
So what's the source going to be?

71
03:12.200 --> 03:16.120
Well, the actual file we're going to use this time is going to be validation J2

72
03:16.120 --> 03:16.640
and the

73
03:16.640 --> 03:17.640
destination.

74
03:17.640 --> 03:19.920
But what does it actually specify?

75
03:19.920 --> 03:23.920
As per the instruction, the destination file should be called it say resolve

76
03:23.920 --> 03:24.880
dot com dot

77
03:24.880 --> 03:29.320
backup or not actually wanting to modify the real configuration file.

78
03:29.320 --> 03:33.560
So in this case here, I will say forward slash it say forward slash resolve dot
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

78
03:29.320 --> 03:33.560
So in this case here, I will say forward slash it say forward slash resolve dot

79
03:33.560 --> 03:35.400
com dot backup

80
03:35.400 --> 03:36.400
here.

81
03:36.400 --> 03:37.400
Okay.

82
03:37.400 --> 03:40.510
So what that now done, all I will do is press escape colon wq write and quit

83
03:40.510 --> 03:40.720
and I will

84
03:40.720 --> 03:44.440
say answerable hyphen playbook validation and hit enter.

85
03:44.440 --> 03:48.240
Now because you the changes have been made, let's go to our devices to verify.

86
03:48.240 --> 03:52.920
So if I say cat, it say resolve dot com dot backup and I enter as we can see

87
03:52.920 --> 03:53.680
here, the

88
03:53.680 --> 03:57.370
yellow box has name server eight dot eight dot eight dot eight and name server

89
03:57.370 --> 03:58.160
eight dot

90
03:58.160 --> 03:59.560
eight dot four dot four.

91
03:59.560 --> 04:04.780
Now if we go to the blue box here, if we go into it say resolve dot com dot
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

91
03:59.560 --> 04:04.780
Now if we go to the blue box here, if we go into it say resolve dot com dot

92
04:04.780 --> 04:05.720
backup and to

93
04:05.720 --> 04:10.100
enter, as we can see here, the configuration has been rendered name server

94
04:10.100 --> 04:10.920
eight dot eight

95
04:10.920 --> 04:11.920
dot eight.

96
04:11.920 --> 04:15.320
So that is us for our validation challenge for gender templating.

97
04:15.320 --> 04:18.360
I hope it's been informative for you and I'd like to thank you for viewing.
