1 00:00:01,150 --> 00:00:06,370 Do you know you could pick and choose an -- playbooks as in steps? 2 00:00:06,580 --> 00:00:07,420 Yes. 3 00:00:07,450 --> 00:00:11,140 You could start a playbook at a specific task. 4 00:00:11,140 --> 00:00:18,760 For example, you could run a command ansible playbook followed by the name of the YAML file the playbook. 5 00:00:18,940 --> 00:00:24,280 And then you define the options dash, dash, start at task. 6 00:00:24,550 --> 00:00:28,660 And then you put in the task name that we defined. 7 00:00:29,170 --> 00:00:32,860 Or as an example, you could run as dash playbook. 8 00:00:33,070 --> 00:00:35,470 HTTP yaml. 9 00:00:35,500 --> 00:00:36,850 Dash dash start. 10 00:00:36,850 --> 00:00:46,060 Dash at dash task and pick the name where you want to start installing or start executing that specific 11 00:00:46,060 --> 00:00:46,780 task. 12 00:00:47,170 --> 00:00:47,650 All right. 13 00:00:47,650 --> 00:00:49,380 Let's let me give you an example. 14 00:00:49,390 --> 00:00:54,970 So this way will be a lot easier for you to understand what I mean by pick and choose steps. 15 00:00:55,450 --> 00:00:58,120 All right, here is your YAML file. 16 00:00:58,120 --> 00:01:02,140 You define the YAML by putting in dash, dash, dash. 17 00:01:02,290 --> 00:01:05,970 You give it a name, HDD and telnet. 18 00:01:05,980 --> 00:01:12,670 So in this YAML file, basically what we are doing is we are installing HTTP PD and starting the HTTP 19 00:01:12,670 --> 00:01:16,480 service and then we are installing Telnet package. 20 00:01:16,810 --> 00:01:17,230 All right. 21 00:01:17,230 --> 00:01:23,980 We are doing that on all the host or any specific or defined host that you could put it here. 22 00:01:24,370 --> 00:01:25,780 Then comes the task. 23 00:01:25,870 --> 00:01:27,550 Here is the first task. 24 00:01:27,550 --> 00:01:31,750 The task is name install hpdi and we will use the module. 25 00:01:31,780 --> 00:01:32,310 Yum. 26 00:01:32,590 --> 00:01:35,230 And what is the package name for that? 27 00:01:35,230 --> 00:01:35,730 Yum. 28 00:01:35,740 --> 00:01:40,690 It is hpdi and the state is present, which means you want it installed. 29 00:01:41,080 --> 00:01:41,350 All right. 30 00:01:41,350 --> 00:01:42,730 That's the first task. 31 00:01:42,910 --> 00:01:48,340 Now, once that is done, it comes the second task in which you want to start that package. 32 00:01:48,340 --> 00:01:48,790 Right? 33 00:01:48,790 --> 00:01:55,510 The service of the package, which is the module you will use the service, the name Hpdi and the stay 34 00:01:55,510 --> 00:01:56,170 started. 35 00:01:56,830 --> 00:02:03,370 This these are the two tasks now that comes to their task, which is the name of the task is to install 36 00:02:03,370 --> 00:02:04,120 Telnet. 37 00:02:04,270 --> 00:02:07,930 Telnet is just a package example that I'm picking it up. 38 00:02:07,930 --> 00:02:13,120 You can pick any package of your choice, but since this is a small package, we'll just go with this 39 00:02:13,120 --> 00:02:13,840 example. 40 00:02:14,590 --> 00:02:18,010 All right, then we will use the module Yum! 41 00:02:18,250 --> 00:02:19,900 To install the package. 42 00:02:19,900 --> 00:02:24,700 And the name of that specific package is Telnet. 43 00:02:24,880 --> 00:02:31,990 Well, back in the days, Telnet was used to log into from one Linux machine to another Linux machine, 44 00:02:31,990 --> 00:02:34,330 but now it is replaced by SSH. 45 00:02:34,540 --> 00:02:40,750 Tennant is still use for troubleshooting purposes if you wanted to check a port or something anyway. 46 00:02:40,750 --> 00:02:47,410 So we are at the point where you will get the name Telnet and then of course the state will be present, 47 00:02:47,410 --> 00:02:50,170 which means install telnet. 48 00:02:50,770 --> 00:02:54,880 All right, so let's go to our Linux machine here. 49 00:02:54,880 --> 00:02:57,670 We have our Ansible control node. 50 00:02:58,000 --> 00:03:02,740 We are in the Playbook directory and we are logged in as root. 51 00:03:02,920 --> 00:03:06,530 Let's create a file and we'll call it this file. 52 00:03:06,550 --> 00:03:11,050 Call it http and telnet yaml. 53 00:03:12,030 --> 00:03:12,970 Hit enter. 54 00:03:13,090 --> 00:03:15,580 Now define that it's a YAML file. 55 00:03:15,700 --> 00:03:19,930 Put in the name and the name is install. 56 00:03:21,690 --> 00:03:22,150 Sorry. 57 00:03:22,170 --> 00:03:27,120 The name of Playbook will be http, dd and telnet. 58 00:03:27,510 --> 00:03:27,960 All right. 59 00:03:27,960 --> 00:03:32,880 Host runs it against all and tasks. 60 00:03:34,470 --> 00:03:36,210 The name of the task. 61 00:03:37,490 --> 00:03:40,040 Install http dd. 62 00:03:40,550 --> 00:03:41,090 All right. 63 00:03:41,090 --> 00:03:41,720 The module. 64 00:03:42,920 --> 00:03:45,080 The name of the package. 65 00:03:45,080 --> 00:03:46,240 HTTP dx. 66 00:03:47,170 --> 00:03:51,190 RD state we wanted present. 67 00:03:51,880 --> 00:03:52,810 All right, let's. 68 00:03:52,810 --> 00:03:54,370 That is one. 69 00:03:55,240 --> 00:03:56,020 Task. 70 00:03:56,170 --> 00:03:59,750 The second task name is Start HTTP. 71 00:04:01,210 --> 00:04:01,840 All right. 72 00:04:01,840 --> 00:04:13,090 You could do service module and the name of that service is HTTP feed and the state is started. 73 00:04:13,390 --> 00:04:13,710 All right. 74 00:04:13,720 --> 00:04:16,830 That's the second task name. 75 00:04:16,840 --> 00:04:22,360 Now let's define the third, which is name and install. 76 00:04:23,250 --> 00:04:30,630 Tell it, and that would be the name of the package is Telnet. 77 00:04:31,980 --> 00:04:33,420 And the state. 78 00:04:34,250 --> 00:04:35,630 Is present. 79 00:04:40,330 --> 00:04:40,940 Okay. 80 00:04:40,960 --> 00:04:42,250 Now let's save it. 81 00:04:42,550 --> 00:04:49,900 Now, you'd notice that right now, Hpdi is already installed on your client. 82 00:04:50,260 --> 00:04:55,120 So if you go to your client and you type it in your password. 83 00:04:56,320 --> 00:05:01,870 And you could do rpm qr and grep for a http. 84 00:05:02,620 --> 00:05:05,110 You notice that Hpdi already installed. 85 00:05:05,140 --> 00:05:09,040 Now, let's see if it has the. 86 00:05:10,390 --> 00:05:12,470 HTTP service. 87 00:05:13,480 --> 00:05:14,680 It started or not. 88 00:05:15,850 --> 00:05:17,620 It is loaded and it is inactive. 89 00:05:17,620 --> 00:05:23,080 So what we could do is we could actually start and we could do install Telnet. 90 00:05:23,320 --> 00:05:25,570 So we could do. 91 00:05:26,550 --> 00:05:37,910 This Ansible playbook and then define the name of the Ansible playbook, http and Telnet yaml. 92 00:05:38,070 --> 00:05:49,740 Now right here, if you move this down and move this down and you put in the start at task and that 93 00:05:49,740 --> 00:05:50,520 would be. 94 00:05:52,690 --> 00:05:54,600 And not install. 95 00:05:54,610 --> 00:05:56,950 That would be start. 96 00:05:58,650 --> 00:05:59,730 Deep, deep. 97 00:06:00,680 --> 00:06:01,160 All right. 98 00:06:01,160 --> 00:06:10,160 So when I run this playbook, this playbook is going to ignore the install speed and it's going to go 99 00:06:10,160 --> 00:06:16,340 from here this point on, which is start hpdi, then go to the next task to install Telnet. 100 00:06:16,920 --> 00:06:18,560 All right, let's go ahead and hit enter. 101 00:06:21,950 --> 00:06:22,390 All right. 102 00:06:22,400 --> 00:06:27,500 It is going through the name of the playbook, but it's coming straight to start http. 103 00:06:27,500 --> 00:06:29,930 You see it skipped instal http. 104 00:06:30,140 --> 00:06:31,160 You don't see it here. 105 00:06:31,430 --> 00:06:31,880 All right. 106 00:06:31,880 --> 00:06:33,380 It started at speed. 107 00:06:33,380 --> 00:06:36,290 Let's verify it by checking the status again. 108 00:06:36,290 --> 00:06:37,100 There you go. 109 00:06:37,130 --> 00:06:41,930 It's active, nice and then it install the telnet. 110 00:06:41,930 --> 00:06:43,340 Let's verify that. 111 00:06:43,460 --> 00:06:47,450 And for that we'll run the same command rpm dash queue and grep for. 112 00:06:48,220 --> 00:06:48,970 Telnet. 113 00:06:50,200 --> 00:06:50,890 Sorry. 114 00:06:52,160 --> 00:06:56,330 Tell it and the package is there. 115 00:06:56,330 --> 00:06:57,800 The Telnet package installed. 116 00:06:57,830 --> 00:06:58,820 Excellent. 117 00:06:59,090 --> 00:07:06,170 Now, you could remove the package by using the gem, remove townland, and then you could try to run 118 00:07:06,220 --> 00:07:07,520 the same playbook. 119 00:07:07,520 --> 00:07:13,100 But but at this time, start at task to install telnet. 120 00:07:13,100 --> 00:07:21,350 So this way it will skip the install it will skip the start of the service and go straight to this task. 121 00:07:21,470 --> 00:07:29,240 So the reason I am showing you this pick and choose is because you might get to the point where your 122 00:07:29,240 --> 00:07:36,940 playbook will become really big and it will have so many multiple tasks inside. 123 00:07:36,950 --> 00:07:43,670 So you could either split the playbook into different playbook, or you could simply go straight to 124 00:07:43,670 --> 00:07:50,900 a specific task, leaving that same playbook as is and run it from where you want it to run. 125 00:07:51,620 --> 00:07:52,880 Isn't that become easier? 126 00:07:52,910 --> 00:07:53,810 Yes.