WEBVTT

1
00:00.000 --> 00:04.000
So friends in the previous video we learned how we could use the archive module

2
00:04.000 --> 00:04.800
to effectively

3
00:04.800 --> 00:09.360
archive and compress files. Now in this particular video what I want to do is

4
00:09.360 --> 00:10.000
to highlight to

5
00:10.000 --> 00:14.140
you how we can effectively unarchive files. So over on my blue box machine I

6
00:14.140 --> 00:14.960
had deleted all

7
00:14.960 --> 00:18.890
the individual files all I have right here is the archive file which is being

8
00:18.890 --> 00:19.600
compressed

9
00:19.600 --> 00:24.800
with BZ2. Now what I'm going to do here is I will go to my browser once again

10
00:24.800 --> 00:25.920
and if I happen to search

11
00:25.920 --> 00:30.900
for Ansible unarchive notice what we actually have here we have an Ansible
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

11
00:25.920 --> 00:30.900
for Ansible unarchive notice what we actually have here we have an Ansible

12
00:30.900 --> 00:32.240
built in unarchive

13
00:32.240 --> 00:35.960
modules. This is actually going to be within the Ansible core collection so we

14
00:35.960 --> 00:36.800
don't have to do

15
00:36.800 --> 00:41.240
any type of additional installs. Notice the synopsis actually tells us here

16
00:41.240 --> 00:42.880
directly that this particular

17
00:42.880 --> 00:48.510
module is going to unpack an archive it's not going to unpack a compress file

18
00:48.510 --> 00:49.360
that doesn't contain

19
00:49.360 --> 00:54.730
an archive okay. Now be aware here this one by default is going to copy the

20
00:54.730 --> 00:56.000
source file from the

21
00:56.000 --> 00:59.380
local system to the target before unpacking so that is going to act very

22
00:59.380 --> 01:00.480
differently from the
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

22
00:59.380 --> 01:00.480
differently from the

23
01:00.480 --> 01:04.060
previous module we're actually talking about copying from the local system that

24
01:04.060 --> 01:04.800
is the Ansible

25
01:04.800 --> 01:11.040
control node unless if we look below we can specify this parameter here remote_

26
01:11.040 --> 01:12.080
src which is remote

27
01:12.080 --> 01:16.700
source we can specify that to the value yes to unpack an archive which already

28
01:16.700 --> 01:18.240
exists on the target

29
01:18.240 --> 01:22.800
so if we want to unpack that file that already exists on the blue box we indeed

30
01:22.800 --> 01:23.600
want to specify

31
01:23.600 --> 01:28.060
this particular parameter and configure it to have the value of yes. So we can

32
01:28.060 --> 01:28.560
see a whole

33
01:28.560 --> 01:32.280
bunch of parameters we have this copy parameter notice though that this
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

33
01:28.560 --> 01:32.280
bunch of parameters we have this copy parameter notice though that this

34
01:32.280 --> 01:33.760
particular parameter has

35
01:33.760 --> 01:37.660
been deprecated and we instead should use the remote_src we just talked about

36
01:37.660 --> 01:38.720
so just be aware of that

37
01:38.720 --> 01:43.840
in documentation okay. Again notice we happen to have our desk parameter this

38
01:43.840 --> 01:45.280
is required this is the

39
01:45.280 --> 01:48.960
remote absolute path where the archive is going to be unpacked so where do you

40
01:48.960 --> 01:50.000
want the actual

41
01:50.000 --> 01:53.790
contents to reside after the unpacking has happened. Scrolling on down once

42
01:53.790 --> 01:54.320
again we can

43
01:54.320 --> 01:57.680
specify the mode to configure particular permissions whether that is opton

44
01:57.680 --> 01:58.880
notation or some ballot

45
01:58.880 --> 02:02.520
notation and again we can specify the owner just like the previous module and
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

45
01:58.880 --> 02:02.520
notation and again we can specify the owner just like the previous module and

46
02:02.520 --> 02:03.360
this time as we can

47
02:03.360 --> 02:07.930
see here we have remote source with a billion value either set to the value

48
02:07.930 --> 02:09.360
true or by default as we

49
02:09.360 --> 02:13.730
can see here the value false. Now notice as well we also have this particular

50
02:13.730 --> 02:14.640
option here the

51
02:14.640 --> 02:19.760
src parameter this also is a required parameter and this is where we specify

52
02:19.760 --> 02:21.120
the value of the

53
02:21.120 --> 02:24.370
source file pretty much where is the file we want to unpack so again let's go

54
02:24.370 --> 02:25.040
and take this

55
02:25.040 --> 02:30.620
information and begin writing our playbook. So back on the Ansible Control mode
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

55
02:25.040 --> 02:30.620
information and begin writing our playbook. So back on the Ansible Control mode

56
02:30.620 --> 02:31.200
let's try to play

57
02:31.200 --> 02:35.400
bit called play2.ymlgreens insert have our three hyphens at the top give this a

58
02:35.400 --> 02:36.000
name and we'll

59
02:36.000 --> 02:40.440
just say play2 testing the un-archive module. Next we will specify the hosts

60
02:40.440 --> 02:42.000
that we want to target

61
02:42.000 --> 02:45.630
in this case here it's just going to be the blue box once again gather facts

62
02:45.630 --> 02:46.320
also set to the

63
02:46.320 --> 02:51.140
billion value of false. Now let's define our tasks and this task can have a

64
02:51.140 --> 02:52.720
name simply specifying

65
02:52.720 --> 02:58.000
targeting the archive file to unpack. Now we have a few things that we want to

66
02:58.000 --> 02:59.040
specify a source

67
02:59.040 --> 03:04.090
a destination as well as to determine if the source is going to be remote or
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

67
02:59.040 --> 03:04.090
a destination as well as to determine if the source is going to be remote or

68
03:04.090 --> 03:05.120
not. Now think

69
03:05.120 --> 03:08.120
about it what are we trying to unpack well over on the blue box within this

70
03:08.120 --> 03:09.520
particular directory

71
03:09.520 --> 03:14.550
we want to unpack this particular file so that is going to be our source. So

72
03:14.550 --> 03:15.440
let's define that

73
03:15.440 --> 03:20.400
accordingly via the SRC parameter so it's going to be in home nuggetuser and

74
03:20.400 --> 03:21.760
the file is called my

75
03:21.760 --> 03:26.610
archive dot tar dot bz2. Now once again Ansible is going to look for this

76
03:26.610 --> 03:28.240
particular file on the

77
03:28.240 --> 03:31.920
control mode we don't want that to happen we want to ensure that it's searching
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

77
03:28.240 --> 03:31.920
control mode we don't want that to happen we want to ensure that it's searching

78
03:31.920 --> 03:33.360
for this path on the

79
03:33.360 --> 03:38.160
remote host okay which is the blue box. So I'm going to set the remote

80
03:38.160 --> 03:40.240
underscore SRC to the value

81
03:40.240 --> 03:45.030
of true and now let me specify where it is exactly I want this to be extracted

82
03:45.030 --> 03:46.320
so let's specify the

83
03:46.320 --> 03:50.730
desk parameter and this time let's say we're going to target the home nugget

84
03:50.730 --> 03:51.680
user and let's just try

85
03:51.680 --> 03:55.410
to put this in let's go with the download directory okay in fact let's actually

86
03:55.410 --> 03:56.320
change that to the

87
03:56.320 --> 03:59.600
documents directory that makes a little bit more sense so let's just save this

88
03:59.600 --> 04:00.400
for now and if
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

88
03:59.600 --> 04:00.400
for now and if

89
04:00.400 --> 04:04.240
we just go into the documents directory right now notice we actually don't have

90
04:04.240 --> 04:04.960
anything inside of

91
04:04.960 --> 04:09.430
it when we actually extract this particular file into this directory though we

92
04:09.430 --> 04:10.400
should actually see

93
04:10.400 --> 04:13.760
the contents of the archive inside of here so let's go and run the playbook and

94
04:13.760 --> 04:15.040
see if that happens

95
04:15.040 --> 04:18.760
so let's try to run the playbook hit enter and we haven't have an error let's

96
04:18.760 --> 04:19.680
go back in and check

97
04:19.680 --> 04:23.960
and that's because I didn't even attempt to use the module so why didn't you

98
04:23.960 --> 04:24.960
tell me that okay

99
04:25.840 --> 04:29.690
you were just letting me be silly there so let's try that entire again this

100
04:29.690 --> 04:30.400
should be the answer
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

100
04:29.690 --> 04:30.400
should be the answer

101
04:30.400 --> 04:35.050
will build in on archive module and I'm just going to end then all this stuff

102
04:35.050 --> 04:36.080
here okay so let's

103
04:36.080 --> 04:40.800
knock everything into spaces and let's try that entirely again so arrow up try

104
04:40.800 --> 04:41.840
again hit enter

105
04:41.840 --> 04:45.480
this looks a little bit better and as we can see here we now get the result let

106
04:45.480 --> 04:46.160
's go back and see

107
04:46.160 --> 04:50.310
what's happened then so slide on over to the blue box let's do an LS or rather

108
04:50.310 --> 04:51.120
an LS we'll try

109
04:51.120 --> 04:55.700
and look at what we actually have here the contents of the archive file here

110
04:55.700 --> 04:57.040
have now been populated

111
04:57.040 --> 05:01.080
inside of the documents directory on the target device so that is how we can
WEBVTT
X-TIMESTAMP-MAP=LOCAL:00:00:00.000,MPEGTS:900000

111
04:57.040 --> 05:01.080
inside of the documents directory on the target device so that is how we can

112
05:01.080 --> 05:02.160
archive files and

113
05:02.160 --> 05:06.220
unarchive them notice the process is a little bit different understand how

114
05:06.220 --> 05:07.600
these different modules

115
05:07.600 --> 05:12.020
operate particularly with respect to the unarchive module keep aware that we

116
05:12.020 --> 05:14.080
have to specify explicitly

117
05:14.080 --> 05:19.920
when the source happens to be a remote machine
