1
00:00:01,020 --> 00:00:01,550
All right.

2
00:00:01,560 --> 00:00:05,450
Moving on to the part two of running ad hoc commands.

3
00:00:05,460 --> 00:00:09,030
The next command that we will learn is about installing package.

4
00:00:09,270 --> 00:00:15,990
So we could install either Telnet package or HTTP dx manual package because these packages we didn't

5
00:00:15,990 --> 00:00:18,930
install earlier during our playbook creation.

6
00:00:18,930 --> 00:00:21,450
So we'll use that for our ad hoc commands.

7
00:00:21,660 --> 00:00:26,820
So the command that we'll use is ANSIBLE space all minus MB module.

8
00:00:26,820 --> 00:00:28,260
A module is a yum.

9
00:00:28,260 --> 00:00:33,240
I'm sure you know that module to use to install a package with the minus a options.

10
00:00:33,420 --> 00:00:38,130
The name of the package will be telnet and the state that you want is present.

11
00:00:38,130 --> 00:00:39,900
Same thing for Ansible.

12
00:00:39,900 --> 00:00:45,270
All minus M1 minus a name http manuel and stayed present.

13
00:00:45,270 --> 00:00:49,440
Let's go to our Linux machine.

14
00:00:49,650 --> 00:00:53,310
Before we go to our Ansible control node.

15
00:00:53,340 --> 00:00:59,250
Let's go to our client and let's check if the client has these packages or not.

16
00:01:00,270 --> 00:01:01,620
All right, so we logged in.

17
00:01:01,620 --> 00:01:06,170
Let's check our RPM dash queue minus gateway.

18
00:01:06,240 --> 00:01:08,490
Pipe it, grep it for telnet.

19
00:01:09,920 --> 00:01:10,130
All right.

20
00:01:10,200 --> 00:01:11,190
The talent package is there.

21
00:01:11,190 --> 00:01:19,290
So let's go ahead and remove it first before we run ansible ad hoc command yum space remove telnet.

22
00:01:20,680 --> 00:01:21,190
All right.

23
00:01:21,190 --> 00:01:25,780
It is removing and it's asking for confirmation confirmation removed.

24
00:01:25,810 --> 00:01:28,990
Let's check again rpm q and grep for telnet.

25
00:01:29,020 --> 00:01:30,050
It is not there.

26
00:01:30,070 --> 00:01:31,750
Let's clear the screen now.

27
00:01:31,750 --> 00:01:34,480
Let's go to our Ansible control node.

28
00:01:34,540 --> 00:01:36,210
Here we have the control node.

29
00:01:36,220 --> 00:01:38,260
Let's go ahead and log in as root.

30
00:01:38,290 --> 00:01:40,570
Now let's run the Ansible.

31
00:01:41,860 --> 00:01:44,350
Ad hoc command, all minus.

32
00:01:44,920 --> 00:01:45,760
Yum.

33
00:01:46,240 --> 00:01:47,500
Sorry, the module.

34
00:01:47,710 --> 00:01:48,790
Yes, the module is yum.

35
00:01:48,790 --> 00:01:52,270
Minus A is the option and the name of the package.

36
00:01:52,270 --> 00:01:53,880
You wanted to have it installed.

37
00:01:53,890 --> 00:01:59,290
Tell it and the state you wanted to be present.

38
00:01:59,770 --> 00:02:00,130
All right.

39
00:02:00,130 --> 00:02:01,300
That's how it is, right?

40
00:02:01,300 --> 00:02:03,640
Let's minimize this.

41
00:02:03,640 --> 00:02:08,770
Let's move this down and the name is tallied and state is present.

42
00:02:08,770 --> 00:02:10,480
Yes, that's how it should be.

43
00:02:10,480 --> 00:02:12,100
And let's go ahead and hit enter.

44
00:02:13,910 --> 00:02:19,130
All right, let's while it's installing it, let's go back to our.

45
00:02:20,380 --> 00:02:30,180
Client and let's do our rpm q a and grapple telnet and it has this Telnet package good.

46
00:02:30,190 --> 00:02:35,040
And right here when we got the response back, everything came back in yellow.

47
00:02:35,050 --> 00:02:36,430
No error messages.

48
00:02:36,430 --> 00:02:38,920
It means it has installed.

49
00:02:39,010 --> 00:02:40,630
All right, so we'll do the same thing.

50
00:02:40,630 --> 00:02:41,590
Let's minimize that.

51
00:02:41,590 --> 00:02:44,800
We'll do the same thing with HTTP Manuel.

52
00:02:44,800 --> 00:02:50,350
But of course, we'll do we'll check if it has already been installed or not.

53
00:02:50,620 --> 00:02:51,580
Manuel.

54
00:02:53,270 --> 00:02:53,570
All right.

55
00:02:53,570 --> 00:02:54,370
It is not.

56
00:02:54,380 --> 00:02:59,020
So go to our control node and let's minimize this.

57
00:02:59,030 --> 00:03:03,290
Let's move this up and let's clear the screen.

58
00:03:03,770 --> 00:03:13,130
Let's hit up arrow key to go and just change from Telnet to change it to a http PD dash manual.

59
00:03:13,130 --> 00:03:20,740
So these are the documentation, the manual for HTTP present hit enter and it should install HTTP the

60
00:03:21,020 --> 00:03:22,420
dash manual.

61
00:03:22,580 --> 00:03:31,400
Once it's installed, we'll go in here, we'll check http, dx, rpm, dash, QR and dash manual and

62
00:03:31,400 --> 00:03:32,810
there it is.

63
00:03:32,810 --> 00:03:33,740
It is installed.

64
00:03:34,280 --> 00:03:34,670
All right.

65
00:03:34,670 --> 00:03:36,950
And right here there have been the command ran.

66
00:03:36,950 --> 00:03:37,670
No error.

67
00:03:38,270 --> 00:03:38,720
Good.

68
00:03:38,720 --> 00:03:39,590
Moving on.

69
00:03:39,590 --> 00:03:46,800
Starting HTTP package service to start you have to use the Ansible space, all of them.

70
00:03:46,850 --> 00:03:48,470
And the module is service.

71
00:03:48,470 --> 00:03:53,390
You see, all the modules that we will be using for all the related commands will be the same.

72
00:03:53,390 --> 00:03:59,810
We're not going to use a different module for ad hoc command and different module for playbooks.

73
00:03:59,810 --> 00:04:05,570
So say modules and the service we need to start is HTTP, DX and state is started.

74
00:04:05,570 --> 00:04:08,090
All right, let's go to our client first.

75
00:04:08,270 --> 00:04:10,220
Right here is my remote client.

76
00:04:10,220 --> 00:04:15,230
Let's make sure it does not have HTTP service already started.

77
00:04:15,230 --> 00:04:25,460
So for that we have to do system CTL, status http and you'll see it is a loaded but not running inactive

78
00:04:25,460 --> 00:04:30,500
so we'll do is we'll start through our control node.

79
00:04:30,500 --> 00:04:32,960
Let's clear the screen Ansible.

80
00:04:33,760 --> 00:04:34,230
Space.

81
00:04:34,240 --> 00:04:37,000
All minus m sorry.

82
00:04:37,300 --> 00:04:41,410
M service minus a name.

83
00:04:43,240 --> 00:04:50,320
Of the service that you want to start http dd and the state you want it started.

84
00:04:50,730 --> 00:04:52,480
Okay, nice.

85
00:04:52,870 --> 00:04:55,090
Now let's go to our.

86
00:04:58,750 --> 00:05:07,090
Client and due system CTL status HTTP PD and here we have active or running beautiful so it means it

87
00:05:07,090 --> 00:05:07,600
worked.

88
00:05:07,690 --> 00:05:11,740
Coming back to our slide and see what's the next ad hoc command are you doing?

89
00:05:11,740 --> 00:05:14,320
Start Hpdi and enable at boot.

90
00:05:14,410 --> 00:05:14,830
All right.

91
00:05:14,830 --> 00:05:20,620
So right now, when we boot or reboot our system, the service goes down, it doesn't start.

92
00:05:20,620 --> 00:05:22,560
So we want the service to be started.

93
00:05:22,570 --> 00:05:26,790
So all you have to do is run the same command and specify enable equal.

94
00:05:26,800 --> 00:05:27,490
Yes.

95
00:05:27,580 --> 00:05:27,970
All right.

96
00:05:27,970 --> 00:05:34,870
So for that will go straight to a control node, hip arrow key up arrow key and just simply type enable.

97
00:05:35,740 --> 00:05:37,960
Is it enabled or enabled?

98
00:05:37,960 --> 00:05:41,200
Let's check enabled equal?

99
00:05:41,200 --> 00:05:41,560
Yes.

100
00:05:41,560 --> 00:05:44,290
Hit enter and it should enable it.

101
00:05:44,320 --> 00:05:50,800
Let's go to our remote client and we'll do system status.

102
00:05:52,470 --> 00:05:52,980
All right.

103
00:05:53,070 --> 00:05:53,700
Right here.

104
00:05:53,700 --> 00:05:57,950
It's active and it is right here, if you notice, enabled.

105
00:05:58,170 --> 00:06:00,030
And when we run it under control.

106
00:06:00,030 --> 00:06:00,180
No.

107
00:06:00,180 --> 00:06:01,890
Do we get any messages?

108
00:06:01,890 --> 00:06:02,970
No, we did not.

109
00:06:02,970 --> 00:06:03,630
It worked.

110
00:06:03,630 --> 00:06:06,750
That's why we got all the yellow messages back.

111
00:06:06,750 --> 00:06:07,050
All right.

112
00:06:07,050 --> 00:06:07,530
Good.

113
00:06:07,650 --> 00:06:14,970
Moving on to our next ad hoc Ansible commands, which is checking HTTP service status under more clients,

114
00:06:14,970 --> 00:06:16,920
whether it's up and running or stopped.

115
00:06:16,920 --> 00:06:22,560
So for that, Ansible, all will use the Shell module at this time.

116
00:06:22,560 --> 00:06:29,540
And the Shell module allow us to run the actual shell commands that are available on the remote clients.

117
00:06:29,550 --> 00:06:34,210
We'll run the simple shell script which is sys CTL status hpdi.

118
00:06:34,440 --> 00:06:39,150
All right, let's go to our control node and Ansible.

119
00:06:39,940 --> 00:06:47,920
All minus m as a shell a and the shell script is sys CTL status.

120
00:06:49,870 --> 00:06:53,620
And that is http de enter.

121
00:06:54,490 --> 00:07:02,550
And it will bring the status back from the remote client back to me to the Ansible control node.

122
00:07:02,560 --> 00:07:05,470
Exactly the same as if you were to run under more client.

123
00:07:05,470 --> 00:07:10,880
You get the same output right here is active and loaded and enabled.

124
00:07:10,900 --> 00:07:11,770
Perfect.

125
00:07:12,010 --> 00:07:12,400
All right.

126
00:07:12,400 --> 00:07:13,330
What's the next?

127
00:07:13,360 --> 00:07:16,000
The next one is remove HTTP package.

128
00:07:16,270 --> 00:07:16,830
Right.

129
00:07:16,840 --> 00:07:21,010
To remove it, you have to run Ansible and use the Yum module.

130
00:07:21,220 --> 00:07:25,990
And the only difference is that you define the state to be absent.

131
00:07:26,070 --> 00:07:28,090
Okay, let's do that.

132
00:07:28,090 --> 00:07:29,440
Go to our.

133
00:07:31,730 --> 00:07:35,510
Control node to type ansible all yum.

134
00:07:35,510 --> 00:07:46,610
Sorry define that we are going to use yum module with the option name equal http dx and I want the state

135
00:07:46,610 --> 00:07:48,470
to be absent.

136
00:07:48,470 --> 00:07:50,720
Meaning remove it.

137
00:07:51,800 --> 00:07:56,030
Okay, now let's go back to our remote client.

138
00:07:56,750 --> 00:07:58,160
Right here is my remote client.

139
00:07:58,230 --> 00:08:09,890
Let's clear the screen and first thing we'll do is do our PM Kua and grep for http dx and it has only

140
00:08:09,890 --> 00:08:10,880
tools installed.

141
00:08:10,880 --> 00:08:14,330
So which was which is not part of the HTTP package.

142
00:08:14,330 --> 00:08:16,850
Okay, so it's gone right here.

143
00:08:16,850 --> 00:08:18,710
We confirmed everything is gone.

144
00:08:18,710 --> 00:08:19,520
Just changed.

145
00:08:19,520 --> 00:08:20,060
It worked.

146
00:08:20,060 --> 00:08:26,570
And now if you do sys CTL status http PD, you're not going to see any service because the package itself

147
00:08:26,570 --> 00:08:27,260
is gone.

148
00:08:27,710 --> 00:08:28,610
Okay, good.

149
00:08:28,610 --> 00:08:30,050
So it work now.

150
00:08:30,050 --> 00:08:30,940
What's next?

151
00:08:30,950 --> 00:08:38,810
The next one is or in order for you to remove the HTTP package, you could have done ansible all minus

152
00:08:38,810 --> 00:08:44,810
M and you should have you should use the shell, which is a bash shell that is available, the command

153
00:08:44,810 --> 00:08:46,280
that is available under your client.

154
00:08:46,280 --> 00:08:47,990
And that is just simple.

155
00:08:47,990 --> 00:08:49,070
Use yum.

156
00:08:49,070 --> 00:08:51,230
Remove HTTP package.

157
00:08:52,100 --> 00:08:52,820
Nice.

158
00:08:52,970 --> 00:08:53,510
All right.

159
00:08:53,510 --> 00:08:56,330
Thank you so much for staying with me and going through these commands.

160
00:08:56,330 --> 00:08:57,740
I'll see you in part three.

161
00:08:57,740 --> 00:08:58,640
We will be.

162
00:08:58,820 --> 00:09:01,850
We will cover more ad hoc commands.
