Ansible for the DevOps Beginners & System Admins | AR Shankar | Skillshare

Ansible for the DevOps Beginners & System Admins

AR Shankar

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
38 Lessons (4h 45m)
    • 1. L1 Simpliv promo video

    • 2. L2 What do we cover

    • 3. L3 What is ansible

    • 4. L4 How ansible works

    • 5. L5 Ansible lab Overview

    • 6. L6 Preparing Ansible system

    • 7. L7 Install Ansible

    • 8. L8 Setup RHEL Managed node

    • 9. L9 Add RHEL as managed node on Ansible

    • 10. L10 Ansible Ad hoc commands

    • 11. L11 Ansible Inventory

    • 12. L12 Ansible Configuration file

    • 13. L13 Ansible Modules

    • 14. L14 Create a first Ansible playbook

    • 15. L15 Setup Additional Managed nodes

    • 16. L16 Know about playbook output

    • 17. L17 yum module

    • 18. L18 File Module

    • 19. L19 Copy Module

    • 20. L20 Install and uninstall httpd

    • 21. L21 Install apache on ubuntu

    • 22. L22 Notify and handlers

    • 23. L23 Gather facts

    • 24. L24 when condation

    • 25. L25 Uninstall Apache2 & httpd packages

    • 26. L26 copy index

    • 27. L27 List and with items

    • 28. L28 Ansible variables

    • 29. L29 Convert Shell commands as ansible palybook Tomcat server setup

    • 30. L30 Ansible tags

    • 31. L31 Ignore errors

    • 32. L32 Ansible Vault introduction

    • 33. L33 Ansible vault with git

    • 34. L34 Ansible roles Introduction

    • 35. L35 Use notify, handlers and vars in httpd

    • 36. L36 Ansible roles Lab

    • 37. L37 Push playbooks onto git

    • 38. L39 Conclusion


About This Class

Are you are started working as a DevOps engineer or you are a typical system administrator and don't know how to automate your tasks? then this course is for you.

Ansible for Beginners course helps you to understand how Ansible works and automate your day to day activities. We have discussed various topics like ad-hoc commands, playbooks, variables, inventory, roles with detailed examples.

I am sure that you will be able to automate your regular tasks using Ansible after completion of this course.

I will continue to enhance this course according to feedback and reviews what we receive.

What are you waiting for? Join with me to learn Ansible now!














1. L1 Simpliv promo video: are you a system administrator? Our clothing in here and would like to automate some off the activities in your infrastructure are Are you tryingto movinto develops technology Then this course is for you . Welcome to answerable for the develops. A big notes on the system had been scores. I'm Year Shankar under currently working as a day works specialist Hi. How are under 10 years of fighting experience on various technologies like develops aws under UNIX Let's come back to our course. In this course you are going to learn how answerable works and how can you automate your tasks using answerable? I have taken different kind off scenarios as examples Well writing our answerable playbooks So I am very much confident that you will be able to automate You were most off day to day activities Once you have completed the score successfully during our course How usually a playbook, toe object, Whatever we learned that helps you to understand how does it work? Various concepts collectively, in this course, we are going to cover answerable components answerable are recommence writing answerable playbooks most commonly used the modules converting shell commands into your playbook. This helps you to understand Latin quickly writing and simple playbooks and several variables answerable world and simple rules on how to convert your playbook in the year old artisan toe. This I will continue to enhance this course further until it comes into your good ship. Then where don't you start your new year veto? This exiting course, John, with me to learn danceable. I will see you in the course. 2. L2 What do we cover : Hello, friends. Welcome back in this lecture. I'm going to run through it. What do we cover in this training? First Introduction section. Under this we're going to cover. What on Dwight? Answerable then how answerable does work. Next. Prerequisites to start in the next section, we are going to talk about answerable love environment set up in this. We are going to see answerable lab set up overview, then install answerable. Next, set up Manager north next to section. We are going to talk about answerable components like inventory modules. Playbooks aren't answerable. Configuration file. Next one answerable playbooks. We are going to see what is answerable, syntax on how to write ever cost to answerable playbook. In next section, we are going to see models like your model file module copy model on a few other important models over here. Next, we're going to discuss about conditions in conditions we are going to use when v titans note planned handlers. Next, we are going to talk about danceable variables. Then additional concepts like converting yourself script into your playbook, gather facts, better handling tags. So these are the topics we're going to cover next. We are going to see multi tasker answerable playbooks. Something like installing Apache Unmanaged north. Next section we're going to see answerable world like answerable Walter Introduction. How to use answerable world with get then answerable rules. This is our last section here. We are going to see Rolls introduction converting your playbook into your role on pushing changes on took it. This is the course content worked week over in this training. Thanks for watching Seve in the courts. 3. L3 What is ansible: Hello, folks. Welcome back in this lecture we're going to see what is answerable on way. We should use sensible if we see the definition off answerable. Answer please. Radically simple open source idea automation engine. So it is open source under it helps us to idea automation purpose. Now what? Answerable can automate and spoken Automates con figuration. Management means we can update conflagrations off the servers by using answerable. So what kind of configurations? Let's take an example that we help Pro agenda. Knew William. After William provisioned, we need to do some of the prerequisites before handing it over to application team our database. Tim. In those cases, we need to create some of the users Some of the packages we should install updating the system, enabling the monitoring, enabling the backup, all these kind of activities. We should do nothing. What? We are breeding conflagrations off our system. This can be done by using answerable provisioning. It means creating new resource is answerable can help us to provisioning. New research is creating Williams creating cloud instances. Creating docker containers are cooper notice parts. All this can be done by using answerable. This is already covered in my other course, that is simple. Develops project. You can check it out. Application deployment. We can deploy applications using answerable applications like a jar R E x e. Any kind of applications can be deployed in the applications are worth using answerable. This is also covered in my develops project. Next orchestration Arkestra Shin means executing tasks in the sequence l format. Let's take an example that I want to enable monitor into my system to enable monitoring. First, I need to update the system, then installed required packages to enable monitoring. Restart the system if we assume this is the process that these steps has to follow in the sequence ill. If we change the steps, it may not work as expected this weekend. College isa orchestration, answerable can do all this stuff. No way we should use answerable because same activities can be performed by some other tools. Right? But if we take answerable, Ansel is simple way. It is simple. Answer will use the way a mill format where Mel Farm it is quite simple. Aren't human durable under no special core skills are required because the indentation for the way normal format is just a spaces and Collins. It is quite easy to learn tasks executed in order. Whatever court we write in answerable, those activities are executed in the sequence l former next. It is powerful where it is powerful because we can use it as a conflagration. Management application, deployment, provisioning, orchestration, then agent lists. This is the one off the measured one days because it is going to use open issues which you don't required additional agent on that there is no additional headache toe restarted. Worry isn't winning. Where we update some configurations under it is secured way because we are using openess his hit. Apart from this, it is efficient because it is going to use The default isn't which comes with the UNIX platforms that is a sausage on. Also, it is a push based mechanism. Nothing but your claims. Just sit idle. You were answerable. Sorry, we're going to push the all the changes under target systems. It's conscience, very less resources in the systems. I mean to say you can run some applications in aranzabal system as well. It is weapon sort. You don't need to procure any licenses until you knew the privileged services Other ways we can use it for free. It is flexible. Why? It is flexible. We don't need to maintain different tools for different purposes, like for application deployment, one tool configuration management, one total provisioning, one tool orchestration. So we don't need to maintain different tools for different purposes. It is a single point off tool which can do all these tasks. That is the reason most of the industry use danceable. Thanks for watching. In next video, we're going to see how answerable works. 4. L4 How ansible works: Hello, folks. Welcome back in this lecture we are going to see how unspool works. If you see this emits here we have your system called control nor Onda. We help a few other claims north. So, Control Lord, were we usually install answerable so wherever answer please installed We called as a control nor on this control note is going to manage so many clients. These claims we called as a managed the north on the control node is going to manage these notes using SS it control. Nor should how access to these Client North, Our Manager North That is possible through password less at indication So too man, is these notes We should enable possibly sat indication if once possible less authentication is enabled. The only control nor Ken ableto manage these notes Now we'll see. What are the components are there in danceable So first component is inventory Invent reiz list of the Star Wars Information are managed North information Assume that the three notes we have over here These three notes information is updated in the inventory. If these three notes information is not updated in the inventory, it cannot able to manage. So all the North's richer manager back control note should be updated in the inventory if it is not a bitter. Even though you enable pass wordless authentication, it cannot be managed. Next component is playbooks. Playbooks are the actual tasks which you need to execute on the target systems. Let's take an example that we want toe creating a user under all claimed systems are managed in north. So how to create a user which users should create that information is updated in the playbook on video servers. We should update that information is available in inventory. Okay, next component is marginal. Somare deals usually user by tasks, so tasks nothing but the activity. Where do you want to look? These models arcs ship rivet danceable while you were installing most of the useful models comes while you are installing, answerable. And so these models are in user by answerable playbooks. So these are the measure components on control, nor are answerable. Masters are were. Now let's see what is the terminology is we should use in answerable. 1st 1 is control or control or nothing but any mission with answerable installed. As I said, wherever we install a sensible that we called Isaac Control Nord Next one manager do not. The network devices are servers. You man is with danceable. So whatever is managed by answerable those systems we call it as it manager nodes inventory . As I said, a list off man is the north. What? Our man? Everybody, you were answerable. You're an inventor. Refile is also sometimes called as the host. Well, so whenever I say in wintry our host Well, both are same. Next March, do the unit off court danceable executes. Each model has a particular functionality. So this is it. Piece off court which is executor by answerable well running our playbooks. There are hundreds of models which comes with danceable. Those we call it is a pre defined models. Even we can create custom models. But that is not scope off this training next tasks usually the unit off action in answerable action. Nothing. But what is the activity you want to do that we call DOJ tasks on the task Use models next to playbooks. Playbooks are ordered released off tasks. Usually we keep on lily Stop tasks in playbooks on we can execute playbooks. So these are the tarp. Knowledge is we should learn about answer. That's all for this lecture. Thanks for watching. See you in the next video. 5. L5 Ansible lab Overview: Hello. Folks will come back in this lecture. We are going to talk about how we are going to set up our lab environment for answerable. If you see here, we are going to set up your controlled which runs on our measure, Lennox and it is going to help plain north like our hate. She'll manage north, um, Asian and open to systems. I'm using three different flavors way because answerable can ableto do our perform tasks on any of these operating systems. And we can still set up a control Nord on our head Shells are over itself on also, please remember that you cannot install answerable on windows. It should be installed on Lennox. But your client systems can be windows. So to set up first, I'm going to set up answerable control Nord then our his shell as a client mission. Then I'm going to enable pastoralists at indication between these two Under add are hit chills are were in the host invent Trefilov answerable so that it can able to man is same thing. I will do on amazingly next every creative server enable password less authentication and updated the information in invent refill same thing for open toe also. Okay, Once this is done, we are going toe eggs. Good. Our answerable comments. All right. Thanks for watching. See you in the next video and we'll set up our answerable server. 6. L6 Preparing Ansible system: Hello, folks. Welcome back in this lecture, we are going toe prepare our system to install answerable. So before installing first we need to launch an easy two Instance then set up host name It is optional, but for better understanding. While changing the screens, it is useful. Create an Assad mean a separate user to manage answerable is the best to practice. So I'm creating a new assortment. But we can create any name relive into our particular project after our convenient on our user to suit as well because this user should have root privileges to perform some of the tasks then generate as his hitch kiss so that we can use this to copy on declined systems and manage pastoralist authentication. Then enable password based authentication because terribly iStar worse by default, Password based at Indication is disabled. We should enable it. But if you are setting up, they were environments on wheels. It is not necessary. Then install instable so before in selling answerable, we should do all these steps. Let's jump into AWS console to create an easy two instance. So this is my irritably a second and I'm using London Region and you can see a service called Easy to Under Compute. This is were we can provision the instances, go to easy toe and that this is the easy to dashboard under to launch instances, we can go to instances that we can go to running instances. Either we would be fine. Go to instances we don't have any instances so we can create by using launch. Instance are here itself? Let's go to lunch instance. Here we have multiple clever self Lennox operating systems on windows as well. So this is a measure in the next to our mission. Lennix Redhead and praise to see Lennix who going toe on a few other flavors are there. But as a discussed I'm going with a measure clinics to install our answerable. So I'm choosing t to make room because it is free. Terrel Izabal So if you are using a single instance for interment, it is free. But we are going to use multiple instances at least weekend reduce our cost if we go with this one. So let's go toe to toe Micro higher capacity is not needed because it is a test enviroment . If it is a real them, maybe we should go with higher instances. Depends upon how Maney cleanse it is managing nothing to change here. Next, our stories KGB would be fine. Next ad attacks. What is the name we want to give for this? Over name and civil control North. This is the name I'm giving next creating security group. We are going to create a new security group. Alerts Name it of the answerable SG answerable. Yes, G and ah, For time being, port number 22 would be fine. But in later point off time we need port number 80. That is heads to DP. And also port number A Gero Gero That is custom port. So I'm opening now itself. Whatever is required So these three ports are required. Please make sure that you are opening these three ports. Next the review Lunch on where? Lunching. We should create a keeper. I'm creating a keeper. Keep Berries user to log in tow system. I'm naming it as it and simple on Whenever you are creating new keeper, you should don't load it. Don't lure once it is Don't loader. You can see here It has been downloaded and it is pain for Met Onder lunch it. That's it. Our instances get ready in couple of minutes. Let's go to view instances. So currently it is impending stare. Let it come into running state toe. Access it. All right. We can see these interning Stuart, let me refresh it. This it is interning state and you can get the appeared dust off this system over here. This is private AP ended. This is public AP. You cannot access it. What system? With the prayer. Maybe you can access it only with public AP from Alzour. And this is the one off the software to log into your system that is more by Ekstrom instead of mobile. Extreme. We can still use Pootie as well on a few other tools. Are there whatever is convenient for you? You can use that one, but in this course we are going to use more by extra to log into the system. Goto station on the church. We are doing shh and copy the I P address. Go toward West. Use the private key because we heard Don't lawyer that keep it. We should use that. So this is my keep here. I'm loading on the user name it is easy to minus user Okay to connect So it is successfully logged in on You can see I imagine early next to let me increase the font size first. So we how launch system next step is we should set up your host name. So host name Danceable current role Nord. Okay, under if you want to see Okay, we should be accrued toe Do this one. I'm becoming your route. Well, let me exude the same command. Okay, so I helped set up the name but it is for temporary. If you want to make it as a permanent, we should aided the TTC hosts file. Okay. Sorry. You d c host name Okay here we need to update over horse name. So this is the default was name Let me remove it on add it That's it. Now you feel like in again Duplicated tab You can see here ever answerable control Nord is going to appear right? So that is how we can do. But if you want to do it from same session let's become your route again. You can see that you were Muslim. Now we set up the host name next to thing is we should create a user. I'm creating your user called in. This would mean so. User allergies recommended to create a user, then set up the password. PS Esther Bloody. Yeah, and that's Hartman on giving password. Also in this had been at 123 The nurse had mean at 123 Okay, because it is a temporary purpose. That would be fine, but in drilled in we don't keep such kind of passwords. Next to step, let's go and see. So, Creator user, our user two suitors fell then gender key and possible. Baseless indication. Now let's are this user to service Fell further to be a pseudo onda sifted you to go end up the file. Onda, come up. I am hiring under the root here. You can add this one in any location in Assad mean and ah, we should have all Is he called all no password. Okay, so this is what we need Now let's save it. After that, we should Gender keys for our yeon aside means so let me switch as a in Assad mean So this is to switch as a NSAID mean now my user is switched from root to do and they said mean, let me create the ssh keys. It's a shit Ke Jin is a command under nothing Tokyo as a important just to give enter. All right, now it's created a keys, So keys are stored under Darty associated territory. There is a dark tissues directly under home directory. And if you see here, there is a public e under private key. So we are going to copy this public in tow Target systems and private keys like key, which is going to use to connect with this public. Right? So we have set up kiss on one last thing we should do that is enable possible. Based on indication I'm exiting back to root because it requires root privileges. Let me clear the screen. Re eight slash citizen. Yes. A search is a search D underscored conflict. This is the fight. If you open this file on the slash B s is the blue or this is how you can such for this particular pattern in the V eight. Go here You can see this is password authentication currently is but it is commented it out on the same entries, their password authentication No, it is a NCAA mentored, so it is taken effect. That is the reason we cannot able to like Nazir User. So let me uncommon this one and comment this one. So from now onwards, I can able to log into the system by using password. After doing this one, we should restart the service service associated E the restored. Okay, so I have only started now. I have enabled the password based at indication, to log into the system. That's how we can prepare our answerable system. So all prerequisites Saturday in next video, we are going to install answerable on this system. Thanks for watching this video. See if in the next video. 7. L7 Install Ansible: Hello Folks will come back in previous lecture. We helped prepare the our answerable system In this way, we are going to install answerable on this system before installing. Let's go on to see the steps. What we should follow I how updated this in our get hub repository. Let's jump in. So this is my get hub repository under the res e reportedly called answerable. If I go insert on, you can see you file called Install instable on our mission led eggs And if you follow these steps so prerequisites is we need an answer policy to instance Once it is done we should install python then piped on people then answerable Okay, This too We should do first then and simple Once you answer please installed answerable minus minutes Fortune to check the answerable Abortion Onda User Ed, We have already done this one And this also that is ah adding user to suit as well Generating keys also done. Next thing copying kiss under target system But we haven't set up the target system. We will do this one later. All right now we should install python. You mean stall python? Yes. Next. Um install fight on. Yes. Alright, we haven't started it. Fight and bite on people. Now clear the screen. It's set up to install answerable pip install Because answerable we are installing using people install and simple. Okay, so it is installing answerable. Alright, danceable installation is successful. You can see the words and answerable to order. Reminder to We can check that one and civil minus minus fortune. It will give the danceable workshop. Okay, Next you can see here Conflict file None usually this configuration file We needed to manage our answerable. But if you are installing you were answerable with people Command, You cannot get the conflict fell. But we can still don't Lord it. The conflict file location is usually slash CTC answerable under the location. It will be available. Okay, so it is not did. That is the reason I'm going toe Create your sensible directory under slash City. Sedin will create this well. So let's create em. Katie, Air slash sea. It is sensible. Okay, once we go here and symbol now here nothing is there because we just created We are going to copy this conflict that we can download it from the official answerable website So this is the documentation you can see here. If installing answerable from your package manager, the latest answer will dot c of DFL should be project in slash city sensible, possibly so on his own. So if you are installing, answerable from people are from the source, you may want to create this. Well, okay on this is available over here. Let's go here. And this is the file. I'm just to selecting the entire file. So I have selected this file. Copy it. And Ah, really? A file name is answerable door to see if g Okay, this is the pilot. We just copier is fail over here and saved it. Now if we go answerable dot CFT more Yes, you can see the stuff. Okay. Apart from this, we should have one more file that is host file so we can create it by using touch on the hosts. Okay, so two files we have creator on the please. Remember, we are not touching this one now. This is like a inventory file. As I said, all our manager systems information we should update over here. But we haven't created any managed north yet. We are going to create it and we'll update over here So that Afghans Bilkin able to man is it clear their self for this lecture in next video, I'm going to show you how to create Manager North. Thanks for watching. See you there. 8. L8 Setup RHEL Managed node: Hello folks. Welcome back in this lecture we are going to set up answerable Manage Nord. So initially we will go with our hit Shell server Later we are going to add Imagine the next under open toe. So these are the steps we should follow to manage or control Or first thing you set up Easy to instance. Then set up host name, creativeness, admin user and our user to pseudo swell and enable password based that indication and we no need to create This is hitch keys over here. All right, so let's go. So I'm on my answerable server. Let me create your head chills over No, for that lunch instance friend Let's goto our head shell. Nothing to change in here. Here is ill, sir. Your name name are hit you control north. Okay, Security group existing one answerable SG and you can see here These are the ports are open burnt large it this time we no need to create a new keep here We can use the existing when itself. So I am acknowledging that I have this keeper with me. If you don't have this keep here It is difficult to log in That's it. We have created new are hit. She'll server as a control node. Sorry, it should be managed. Not not control north. Okay, on the currently reason running. Stuart, let me take dye Pierre truths under large in fission. This is huge. I'm loading my keep here on the user. It is easy to minus user. Okay? And whatever we have done for the master not same things we should do on this system as well. So first, let me become your route on the Let me set up the host name. So our Hetchy ill manager north. Okay, so it is easy to remember. So this will be taken back to one lead off to restart. So host to name Park Temporary. I'm also sitting up our hit you managed Nord. Okay. Pseudo issue minus. This is our head Shell manager. No, that's it. No, we'll create your user here User Art Airness. But mean Said the password for these inside me not 123 So you should keep the same password across the environment. If you change it, it is difficult. So create same user and same password. Once this is done, you know, need toe gender the keep its over here because it is managed nor from the remote system. We copy the key piers, but we should enable the password based that indication for the class it easy associate necessary to the underscore convict on the search for password under here. Also seem when it to a NCAA mentis on comment. This that's it. One last thing. We need to act this user to sort as well. That is really a solo sifter. Gee, and you can see here the C terminus user. So this is how we need to do anyway. Adding here itself wore to insert more in this apartment turned same element. I'm going to do alert. So that's it. We have set up our clan system Now I would like to manage this client system. Be answerable for that. We should update the Sarwari Piotr Asan danceable. How to do that? One will see in the next video 9. L9 Add RHEL as managed node on Ansible: Hello, folks. Welcome back. So far we have set up our answerable control nor under our hitch ill manager Note. Now we should establish connection between these two. For that purpose, we should update this heart. It shields R I p address under control. North side. We have created a file called slash CDC answerable hosts. That is the inventor. If l we should update their once we update there on day After that, we should copy. They sit ski onto our Hatchell server. Then we can able to manage our Arctic chill server. Let's go on to do this one now. So if you see here, this is my answerable control Note on that This is my art shell server. Now I want to manage this article Sorour By using answerable for that we should add this article sorrow or i p address in the hosts. Well, let's open this file on guitar. Hey, chills RR ap I'm going back to our kitchen server I p 80 year. You can see this is die appeared yourself over our Haiti and server on this is the primary P Please use private I p because public a piece are keep on changing anybody was restarted with Star Wars and it can communicate with the prey. Wait. A people within the environment. So you no need to worry. So no way. How updated our hosts file with the single system. That's okay. Now, to manage our answerable, we should lag in a j NSAID men because we helped creator Keys over there. Those keys we should copy under target system so that we can enable password less that indication the Serie ways U minus C And that's hard mean on da Tocopilla. Since its keys, we should use a commander called Shh. Copy idea. This is the command followed. Beta I p address. Sorry, not this one. This is the I P. Right. So this is the I P address, So Oops. So it is trying to copy. But it is not because we have a little basis Italy conflict, But we haven't repressed. If we refresh, then only Tello's user Login service s a search D restored artery Lord. Okay, I'm just reloading it now. You quit, right? It will allow me to do the password based that indication. So first time I need to like a nice here user. Yes, now it is asking for password in this ad. Men Art Oneto three rate. That is the password we have given. Yes, No number of case. One key has been added. Now if I tried to log in, put this system okay. I can ableto lagon only to use Esta Airness Admin user. So yes, you can see here answerable control or toe are Hey, chills are over. I can able to leg and let me exit again It ministered I can able to communicate with make claims system successfully retort password So that's all our answerable can able to manage our our hit chills or what? No, but usually we can execute and civil Arctic comments before executing answerable are decked comments Let's understand what is our recommends? So this is answerable documentation if you see introduction toe are that comment? An answer will recommend you sister slash serious Serbian and civil command line tool to automate your single task on one or more manage north So it is going toe automata Single task task means some activity So it is autumn It single task on managed north are their comments are quick and easy but they are not reusable. So to execute our that comments, it is quite easy. But those cannot be reusable. That is the problem with our their comments. But when do we use it? Whenever we have some task. And quickly, we want to execute on there. It is not reusable. Then we can go with that. So are that comments in tax would be something like this. And civil, then patron, then minus him are no module name, minus C model options. This is there are recommends index. So all answerable comments starts with answerable Patron will discuss this one little letter minus, um um nothing but model. I said that to usually models using the tasks. Right? So we are executing your task. That task is going to use them more deal. No water, no models are there. As I said, we have hundreds of models are there? We are going to talk about models little later. So for time being, we are going to use these models. So to execute our recommends, we are going to use the model called the Pink under another model called Command Next to Stat yum. Use that under set up. These are the models we are using through our direct comments. Let's go and execute first. A model that is being and Sibal just to use all I will tell what this all minus him. So, as I said, I'm going to use your model Called a pink thing. Is the one off the model on Whenever execute any model, this model is going to execute under systems which are there in the inventory file. So you nobody in Winterfell We have one host. So in that one host it is going to perform pink test. So whenever you to do the ping, you get the responses. Your punk, If the surgery is fine Okay. So you can see here, Ping, we got your responses upon nothing. But it is successful on this system. Now what? I will do toe test it more clearly. I'm going to edit our inventory file with one more server which is not exist will execute the same command on sit output. So I'm going to idiots class. It is answerable hosts. Okay, Sorry. Sort of useless. It is answerable hosts. So here I'm going to add one more, sir. Where so? 1 72 ordered the one dot dot dot one. Party one. Okay. This our body is not exist. Let's save it on to execute the same command again and it will all minus him. You can see here it is trying to check with the two systems in one party successful on 1 41 it is not successful. Clear. So that is how we can test our answerable. Now again. Come back to over command answerable all minor something. So as I said, Ping is a model. That is the reason we are going to use them on Dhere. All means whatever Star Wars are there in this file, that is way. Whenever I kept only one server, it was pinging only one server when I kept two servers, it is pinging to two servers. So here all means in wintry file in in re entry fell. Whatever servers are there, all those are words Do are performed this particular action that is the meaning off that one. Okay, so that's all for this lecture. In next video, I will show you how to execute remaining all comments. Thanks for watching. See you there 10. L10 Ansible Ad hoc commands: Hello, folks. Welcome back in previous lecture, we are talking about how to execute Arak comments. So we have seen Pink Command. Now we are going to see remaining all comments, so let's execute command module so answerable on minus him command. Okay, so model name is command. So while executing command model, we should probably an argument. That is arguments we posit as their minus a command on What do you want to do? Usually command module is going toe execute. Comment as it is. So I assume that I want to just see the up came off my system up time is a UNIX commander. It If you use command, my deal, you can use the UNIX comments and directly. Okay. No, we'll see. You can see this system is upon turning on this system I cannot able to reach. Okay. That is how we can use common model on instead off up time. I want to execute a date. It excludes the date command onboard the systems, but it reached only one system. Another system it cannot able to reach on. I want to just to see who nothing but who is logged into my system like this. You can execute any UNIX comment as it is if you use the command model. So currently to users has been locked into this system. Okay, that is how we can test it. No, let me clear the screen. We are going to do with their next model. So next Marjorie's start model, Let's execute to start model. So no, we're going to execute Start command and simple. All minus him. Start. Okay, start, Marty, but start Mardell. Recordation attribute. That is which file do you want to start? Nothing. But whether the file is exist or not, it is going to show us. So I just want to see pot where the file exist. This pile existent. That's classy. TC hosts. So I just want to see whether slash c d. C hosts file is exist or not. It gives the information about this. Well, you can see here. This is the information about this. Well, success successfully can able to retrieve that one. And this is some additional information earned Another system it cannot able to reach. That is how start command does work. Next command young. So young is a module which is useful to install your packets. Let's clear the screen. Oh, and Sibal all minus here. Young Marginal rate now young model is requires air tribute. That is which packets do you want to install? So name off. The Pakis name is ical. Get I want to install. Get so I'm installing. Get software on the target system by using the year model. Now let's go and see here whether get is installed or not. So just I am checking with the get. If command is installed, it will give us in tax error. Berta, if it is saying that command itself is not home so it cannot give this index that now let's install it. So what happened? The commander has to be run under hood. You can see here it is saying that this command has to run under route. We are running this commanders a NSAID mean on the target system as well. So you cannot install in these kind of situations we can use here. But I'm metal called minus B minus Be nothing but become become nothing. But it is becoming your route. So let's takes a good No so failed to connect host 1 41 But our salaries 1 40? No. Yes, it's installed on 1 40 you can see these. And if we go back this time and if i x a good? Yes. This time it is not saying that Come and not for it is saying That's index set of nothing. But I know what you are exiting, but you are not executing into a tree, right? That is young model. Next thing user we can create a user by using answerable are recommends. Let me clear the screen and Sibal on minus um, user. Okay. I'm using a model called User on. We can create a user. So to create a user, we should probably attribute that's way minus here on the name off the user name is he called John. Okay, don't get confused. Way I'm using name. How do I know? I will tell you when models comes, but for time being just to use as it is. So I'm creating your user called John. And if I go on check whether user Johnny's exist or not, just we can see this one easily under slash CTC password file. So last user is a in a segment. So we are creating your user called John and ah, minus B way. Because we should execute this one as a root user. Other ways we cannot create a user. So let's execute. Yes, it has been created. A user called John on the crew Pretty is one double Jiro too There to see again. Yes, I could see John User. Okay, Now, if we re executes this command, what will happen so you can see that difference between the airport? Earlier it was changed on DA. It is in a local er OK, but this time it is just showing us this success. And it is in green color. It means that if it is already exist, nothing to change. It comes in the green color and it comes as a success. If it is creating Dennett, it come as a changed and it is in a local er Okay, That is how we can ardent rate. So you can still see only one user. It cannot create one more time, right? That is the hard one days off using answerable. All right, next to command, we are going to talk about set up. Okay, This is one off the important of Mardell. Let me clear the screen. Let's six good. The command and Sibal all minus him. Set up. Okay, set up is a module and it doesn't require any attributes earned. It gives entire system information off your manager north. So let's execute. Yes, we can see here. This is not reachable. That's OK. And if we see this system, this is the all the system Information about our our hit shelter were. And ah, if you see here it is talking about Prosser courts on the processor ConEd and ah, it is answerable Product portion image in orderto under. You can see here answerable Nordenham We have given out Hit. She'll manage north answerable ways from that. This is one of the important perimeter. We are going to use this one in our later stations. Okay? Please remember. And if we scroll up, it does network information, CPU, memory, everything What? They were systems information is required. All that information retrieved from the remote system on Da Displace over here. Okay, You can see you're answerable distribution. It is red hurt under it helped release It is eight redhead eight. All this information is there. Okay. And their cell for this lecture on the desert. They are quite commonly used. Are recommends on DA. We are going to see you again in next video. Thanks for watching. See you did. 11. L11 Ansible Inventory: Hello, friends. Welcome back in this lecture we are going to see what is invented. If you see the definition answerable works argon, Esther multiple. Manage north our hosts in over in frustration at the same time using a list. Our group off least known as inventory. So it means that and Swilcan ableto perform activities on list offs are worse. Her group off servers that we call it as a inventory inventory file is a collection off. Hosts are north richer, managed by answerable control north. So inventor file contents list off north, sir. Hosts it is manageable. Answerable. We can use the default invent refile are we can create a custom inventor fell Now where the default inventor file does exist The default inventor file exists under slash CTC answerable under that we have your hosts Well, that is your default in Winterfell. Let's see how many ways we can defend our invent referred coasts information can be defending following with the default location off hosts in wintry, its last CTC answerable hosts. So this is the one we are using right now for our attack commands. Next thing we can use our custom hosts. Well, nothing but we can create our wound, invent refile in any location that we can supply a well running our comment by using minus a option, I stands for inventory Over here. Another way is defined in answerable Darcy of DFL. If you remember, we helped create the unanswerable dot c of defiled in that we can defend our inventor file so that it will be treating the whatever file you have space for it in this conflagration. Well, while executing any answerable command you were answerable command required some imports. Andi, if you haven't space filled, it is going to take the default values from this answerable dot CHG file. Okay, Now let's jump in and experiment about inventor file. I am on my answerable server under I also logged into my red heart server. I'm going back to my answer pulls over If you see my answerable scream, it is your polarizer dark toe differently It master in order and the claim systems I just to change it so that you can I don't wave and I'm switching my screens. Okay, so now if you see the default host inventor if I feel that this last 80 c answerable hosts This is where we have different hourly stop hosts. If I exhibit any command answerable all minor Sim Ping, it is going toe exude under systems which are space filled over here You can see her These two systems It has been executed. But I would like to create my wound. Invent refiles then in current location I'm creating a in wintry fell. Nothing is there so I'm going to name it as your hosts on dime. Adding only one server I'm adding only one server earned. If I cut it, you can see only one server Now I would like to run this ping command on dis invent re not under default in wintry. In that case, we are going to use And Sibal and Minor Sim Ping aren't minus say that is what we were discussing. Rate minus a Our hosts Well so it is hosts If I've been now it is going Toe Ping, The server which is in this inventor fell okay? It is not trying to ping toe. Those are words which are mentioned over here. Now if I don't space for again this one if I don't this way again it is going toe take their default in wintry file and bring it to the server. Okay, Now you may ask that way it is going to take their defaulting went revere it is defend. Actually, it is different in the answerable dot c of d felt That is the reason it is going to take the default Invent Repelled. Now let's see the and spilled at sea of defile quickly I'm just opening with more slash CDC answerable answerable dot c of g So this is the answer will Dirty of defend We are going to see some of the important parameters in this. Well, so one off the miss if you see defaults, defaults, nothing. But if you don't space for any off, these values will executing your comment I'm going to take this default values. OK, now, if you'll see here this is the inventor. It is commented out Even though you can see here it is slash CTC answerable hosts nothing. But if you don't space for any invent refile, I'm going to treat this as a inventory file. That is the reason whenever we are executing aranzabal Command, if we don't specially hosts well, it is going to take this file as a default inventor. Now what do we do? I don't want to take this one has a default in wintry. Whatever I have created in my current directory, I would like to take this one has a default in wintry. In that case, we can edit this answerable Darcy of defile with the new location off every new entries so that it is going to take that as a inventory. Let's edit this one. Sodo v a slash c d c. Answerable and simple dot c of g earned. Uh, let's uncommon to this one on Change it to our hosts. Well, that is available under that is available under slash home slash Yanis hardman. Okay, this is the location. It is available. Let me save it and ah, clear the screen. Let me open the file again. More slash city sensible and simple dot C of G. You can see here I have changed my inventory file to slash home in a segment Hosts. Let me clear the screen again, Andi, Unless if you see here we have your hosts well over here, as well as one more host file under classy, dizzy, answerable hosts. Okay, now if I execute my answerable on minus him Ping Command, this time it is not going to take this one. It is going to take this one way because we have changed. In the answer Bulldog CFT filed to choose the host fell, which is available in my current or directory. You can see here slash home and simple hosts. That is what we have. Space where we can use any off these two ways to supply a explicit in wintry file. If you want to use the default one nothing to space for, you can update it in the default inventory fell. But if we are using default, inventory fell, we help few challenges. Let's take an example that in our team we have five members on each guy is trying to execute his wound Playbook on different difference are worse. If that is the case, you are updating their default inventory file with the Star Wars, which you want to do some activity through answerable similar way. You were colleague also trying to abduct the same hosts Well with his inventory. If you execute some command, we thought noticing that one it is going to run under systems which use whispered as well as you were colleagues. Pittsford, Soto overcome this problem Usually in the real time we will create our one inventory. We never, ever used the default inventor file clear on. The next thing is we can create groups in the inventor file. Let's take the default. Invent refile itself. Sorry, I need toe open with sort of yea sold O v a slash city sensible hosts I'm going to create a group So to create a group we need to special in the braces I'm going to name it as they are hit you because it is our Hitchens server On the next to settle it is dummy I'm giving it as it on me because it really doesn't exist. Let's save this file now. If we see I helped created two groups when is our hitch Ill group? Another one is Demi group I can create any number off sir worsened a specific group I can add a few more here also I can add a few more. Okay, there is no limitation Now let's executive answerable Playbook Sorry. Answerable Command and Sibal all my unosom pink If I don't give any invent refile it too takes my local inventory. But I don't want to take this one. I want do this one as my inventory. OK, so let's see here what will happen? It is tryingto it is tryingto ping their two systems which are there in this particular location. Okay, but I want o being only our head. She'll star wars which are there in this particular group, in that case, answerable. Sorry, there isn't. I pull. Let me update it, Okay? Even duties like that it won't create anything. We can do any name to our group, but just to make sure now I want hoping only our Hitchens are were In that case, I can give the group name over here are hit shell Minor stamping minus a hosts find Okay, now you can see here it is trying to ping only the server which is there in the are hit shell group. Now let me give the dummy as well. It is trying to ping the server's which are there in the dummy group. But anyway, it is not reachable. Now. You understood What is the meaning off? All right, so if you specify are it means that it is trying to pin all the servers which are there in the inventor. Refile if you space for the group. Name it Ping. Only that group clear now. I'm setting back my inventory file to default file. This is the default fell. Red slash city. Sensible, sensible. Darcy of Chip. Okay, I house sit it back. Now, if I don't know, retort to this, it will take their default in wintry fell. So it is trying to pin their damn is our work clear? So this is how we can use inventory. And there are few other ways to use. But this is the mostly commonly used to pay off our inventory. So usually we don't use the default in went different. We created a separate inventor fell on will manage that one. All right. So from now onwards, I'm going to use the hosts which is created in my current working directory. Clear. That's all for this lecture in next to area we are going to talk about and simple Darcy of defile. See you there 12. L12 Ansible Configuration file: Hello, Prince. Welcome back in this lecture we are going to talk about answerable conflagration. If you do remember, we helped create area file under slash city sensible and supple dot C of G. So this is the fine we are going to talk about. So whenever we execute any answerable command, if we don't provide certain information which is required to exhibit that answerable command, it is going to use some of the default information from this file. That is what it is going to do. If you see in previous lecture we have seen that it is pulling the hosts information from that default value we changed and we played it similar way. There are lot off default values which it is going toe pull whenever we don't specially while executing our command. Right. Let's open this file and see some of the important parameters which we are going to use. I'm opening this file. If you see here, the 1st 1 is inventory. If you don't specify are if you don't provide any inventory value, it is going to treat this as a in winterfell. Similar were library nothing, but it requires some models those model cities looking over here. Mardell utilities, which are required for models again on the remoter TMP. Whenever we were executing some comments on remote system, it is going to use this as a temporary file toe. Do some activity. Similar were local TMP in local system. Next one is this is the important one. Forks, Forks. Nothing. But after time, answerable command can run on these number off systems assumed that they were in wintry file. How 10 systems and spool cannot perform activity rt ago on 10 systems. Whilst it will go with fire systems once it is completed, then it go with the next batch. So it will go with batch ways on the maximum number. It is going to take it from here. We have space. Verify it runs only at five. Then it will go with the next set off fire. If it is less than toe that a gym, 38 Star Wars are there. Prostate runs on five Star Wars, then next to three servers. Next this one ask a pass. So, while logging into the client system, do you want to ask me the password or not? If you change your true, you need toe. Probably the password. Well, Agnolutto claimed system similar way. We help you other important parameters. That is you face such for a default. Okay, you can see it. This is the default default model to use wind running the Arctic comments. So assume that well running our I recommend we don't provide any module. Then it retreats. Comment as a default. More deals. We are going toe test this one. Next thing there are a lot of parameters. But whenever we want to use it or the time we will come here and update and we'll explain. But one more thing. I'm just going to show you. Yes, a little bit up. Yes, you can see here Privilege Escalation in this were how become false become false Nothing. But while executing any commander, don't execute it as a root user executed as a normal user. Whatever user you are locking onto a target's system. In our case, we are logging on to target system as a innocent men under to execute all the comments has in a segment next thing become method. Well, if you want to become your route, how do you become your route? Ok, we are going to use this pseudo become ask pass. Well, becoming a route. Do you need to ask? Password or not? It is false. Means don't ask password. So that is how the sensible configuration takes the default values from the answerable Darcy of people. Let's run some of the answerable commands and we'll see how it is going to take it from this conflagration. So I'm just quitting this. Clear the screen now, As I said, by default, whenever we were executing our that comments, if you don't space for a any models, it is going to take the command module, right? That is what we discussed. Now we executed a command and simple on minus. Um, Ping. I'm using Ping model on all the systems. So it's working fine. No, what I will do minus him. Command my NSC up time. So I'm just checking the up them off all our systems. It is going to retreat from this system in next to command. I'm not going to give minus him nothing, but I'm not specifying any model. If you don't space for a any model by default, it is going to take the command model. You can see here it is still same output. Whatever you have use of the command. Marty, if you don't want to use the command model, you can go and update in the answerable Darcy of Chiche File. Okay. A gym that I want to use. The young model If I don't know space for any model. Yes, you can do that one. Let's go on to do that. Pseudo we a slash CTC answerable and supple dot cerci I want to use the young model is the default model. So let's such for command. See, we have many Andy, you can see here your command module name default model name. I'm just a NCAA menting this Onda deleting it and I will mention it as it um you can see No , I am trying to execute the same command at this time. It is going to fail because you are trying to use your model with it up time. It doesn't work. OK, but if I tried to do the and symbol um minus year name okay for young model. We need to specially the name off the package. I'm supposed saying get anywhere we have already installed, but I'm trying to do this one, Onda, While executing this one on the system, we should become route. If we don't become your route, it is going to throw you an error that you are not a root user. Now you can see here. Yes, it is executing commands. Young model on this is saying that you should become your route. So that is the reason minus B. I'm spacefaring. Now you can see we are trying to install it. But anyway, it is already installed. Nothingto do get these alterations told. Ok, answer Police saying that I can't do anything. It is already installed. Okay, this is how we can do so Minus be nothing. But we are becoming your even. We can skip this one by editing of transport Darcy of people we have seen become false, right? It means that while executing any comment, don't execute it as a route. Now, if I go on change the become true then I don't need to specially this one. Still, I can execute the command. Okay, let's do that. One also sold o v a slash CTC answerable and pulled out CFT on directly searching for, um sorry. Become good. Become become become? Yes, you can see here Privilege, escalation. If I see on da this one, I'm changing it it to truth. Okay, He should be caps on the uncommon to this one, Onda. Uh, now you fe Executor Commander, We thought to be also we thought be I'm trying to execute this command. Still, it should not ask for the password on whatever I have executed with to be same output I should get all right. You can see here this time on. So we got the same output even though if we don't space, baby. Right. So this is how we can customize our answerable Darcy of people. But it is not recommended. Toe update, default and split artsy of defiled. We can create our one answerable Darcy of defile on. We can add these values over there. Let's do that one as well. I'm sitting back. Our answer Will Darcy of defiled dot c of G. So we have changed or the module. So default more Deli's comment on Gran toe commented or similar. Where become so become should be commented out when it should be falls. All right, So we house said it back. So now we can create our one answerable doxy of defile in our current location on, we can specify whatever values we want. Toe update. OK, so before doing that one, let's see where until we can create answerable Darcy of defense. This is the answer. Full documentation. If you see here configuration file and we can create answerable conflagration in these locations on the priority would be something like this. We can create answerable configuration on the export of ity, an environment variable, so it will have the highest priority. If you see that fasted will take the are read the information from here. If it is not there, then it will go to the unspool. Darcy of Gene, the current directory in the current A directly. If you have an split out c of G it released the information from here. Then it will go to the You were home directory. I'm in a sad men, right? No. So it will go and check further my home directly. But there is any dart danceable. Darcy of defile is there are not. If it is not there, then it will go to the default. So deferred one. How the least two priority prior to that one. These files have the highest priority under it. May picked each and every variable from the different different configurations also. Okay, so this is how the hierarchy does work. Now we'll go and create under our current working directory under home Director, both are same. Anyway, in our current working there, we will create the and civil Darcy of G. So v a and Civil dart. See if you okay. Now what we are doing, we are going to add become true, but we need to add header also. Okay, so let me just say this one now it is a empty fell before that one answerable door answerable Dorsey of Jeff. I'll let me opened this one. And we are updating the privilege escalation that we need toe art as a herder. Yeah, Okay. This is what we are adding. Let's copy this one. Andrea and supple Darcy of G. I'm updating my answer. Pull Darcy of defiled. Okay, No, become instead of false proof. So know what will happen whenever I run any direct commands. Now, if it is executing as a Ennis had mean, But still it is going to explode as a root user. Let's executive the answerable. All minus e. Um Um OK, I'm using your model. I should use your model because now we have updated my answer pool Party of de Command with the command. More deal so minus M minus you. Name is he called three. Okay, three is the one off the package Which will be splitter there, Chris, in the tree format currently. Let me execute the tree command. Okay? It is saying that tree is not there. Now let me execute it and you can see here. I'm not providing minus b option. It should ableto take that value from here on day. It should install it. Yes, you can see here it has been changed installed and I haven't specialized minus b option. Now if I go and see the three Okay, it is exhilarating and it will displace the direct researcher. If you want to see the how it works, you can see here three It has the directory structure. This is how it works anywhere. So it means that it is taking the this value on the remaining always from their default configuration. So whatever explicitly you help provided that it is going to take it from here. Right? So it means that we can create our wound custom and supple Darcy of defiled, and we can defend our values. This is how answerable doxy of Defiled does work. Hope you understood how that differed. Configuration file works In next video, we are going toe talk about the models. 13. L13 Ansible Modules: Hello. Folks will come back in this lecture. We're going to see about answerable models. Hope you got a basic idea. What is module under? How does it work so far? Because we are already started using models in our Arctic comments like, um, user command being start all these other models. Now let's go little deeper and understand how it works and what Colonel models are there. Your model is a reusable, standalone scripted that answerable runs on your behalf. Either locally, are remotely a model is a script which you can drink through answerable playbook. Behalf off you on remote system, our local system nothing but in my system are on remote system. I can execute the models Models interact with your local mission and the A p A on remote system toe perform specific tasks. Leg creating users, installing packages, updating configurations, spending up instances on so on so this kindof activities can be performed by using models. Next models are the programs that performed the actual work off the tasks off your plate. So we are going to write tasks in our further lectures in the tasks we are going to use models. These models are going to perform the actual tasks. That is about models. And there is a very good documentation about models in answerable dogs. We'll go and see that. So let's search for answerable models. Okay? I'm searching for answerable models. If you see here working with modules, Foster link yourself will take us to models on you can see and school ships with your number off models called the models Library that can be executor directly under remote host are through playbooks. Onda thousands of models comes with answerable. Well, we are installing. Okay? And if we want to see the model index, nothing but a list of the models. We can go here. Yeah, if you see here, this is all models. Nothing but whatever is there. But if you want to see the category ways, cloud models, clustering models, command models. Okay, let's weapon command models. We were working with the command module rate. If you see here, command model along with command model. We have Ross script shell Telnet, this all of the models which are available under the section and ah, if we open command model further, you can see the detail information about command model. So What are the parameters we can use in the command module on the week scrolled on? You can see the examples how to use the command module. This is a word up playbooks how to use. So far, we have used the attack comments. So these are the examples We are coming here and understanding the models. This is how we can take it out. Only if you don't know any information about any model you can go on. Such in the Google. It will tell you whether reliving model is there are not any way we are going to see that as well. So this is all aboard the command module's Similarly whatever model we would like to know. All these models are available over here. We can check it out. And we can see these models which are installed on our system by using a commander called and simple dogs minus l. Okay, this command is going to display the least off the models. Okay, you can see here. So many models are there under the description. Only if you see there are so many models. Okay. I'm skipping you to underplay. See? Gesture. The blue sea. Just to to check out how many are there? Okay, are only 3300 place. More deals are there. Right? So this is aboard the models anyway, we are going to use in our playbooks. So there you can understand more about models. That's all for this lecture on. See you in the next lecture. 14. L14 Create a first Ansible playbook: Hello, friends. Welcome back in this lecture we are going to learn how to write our first danceable playbook before start writing our playbooks. Let's understand what is playable. There is a very good explanation in our answer. Full documentation. Let's jump in. If you see here, what is their playbook? Playbooks are essentially set off instructions. Nothing but place that you can send a tow run on their single target. Our group off the target hosts. So usually we are going toe run tasks by using playbooks, and those can be executed under group off. Targets are single target system, okay. And also there is a good explanation. I'm going to share this link in the research. A section please go through with this on Did it will be helpful for you and most of the cases I'm going to refer answerable documentation itself because it is very nice documentation toe explore more and let's go back and see what are the instructions we should follow. Well, rating over answerable playbook. Answerable playbook is a text file return in y a mill format on is normally sold as a dart William l file. So if Britons in year way am l format earlier. Why am else transfer yet another markup along with? But now they have changed it to buy. Am l ain't Mark a plan with the playbook begins with Yellen consisting off three dashes as the start off their document marker. So the playbook starts with three minuses. Okay, that is the starting off way Emel format. Next, an item in the way. Emma list starts with E s single dash, followed by the space. So usually the statements which are written in way ml format are key and value statements and it has the items also. Whenever we start any new item, it starts with a single dash. Initially, in our playbook, it starts with the three minuses. Then you'd start with the single dash. Next hosts on the tasks are mandatory items in the playbook we should use. The hosts hosts nothing but invent very well running over our that commands. We were using hosts, right? So similar were unanswerable playbooks. Also, we should use hosts under tasks, tasks, nothing but activities which we want to do without these two. We cannot right here. Playbook. The playbook primarily used indentation with space characters to indicate the stretcher off its data. So the enter amel format works with the space is usually if you take job RCC place, place. So it has that they're one format, but I am a farm at how only spaces. So if you define your space is appropriate, click. It means that your syntax is fine. Next models are used to perform tasks. You remember we were talking about models in our previous lectures. So these are used in that tasks Next comment to start with hash. So this is like another language is it starts with hash. Now let's write a simple answerable playbook with the command, which we used earlier. So if you do remember, we were executing this command that is answerable all minors, um, user minus e name John minus B. If you remember, this was the command we have executed to create a user. This is a recommend. If you see this command, the mandatory fields are all aren't, um so all means hosts inventory. If you don't space for any host inventory to takes the default one on the model user model we are using. Let's convert this answerable attack command as the answerable script if we do that one so faster. Thing is we are going to create a file with the dark William L Extension. That is the first point. Right? So all the playbooks create with their doctor way um ele extinction our way a mill extinction also find But it is not mandatory. It's up to us next to think it starts with that three dashes. That means that the starting off the oil this is file name the sister starting off the file next comment. It starts with the dumb miners. Okay, so an item in the way families to starts with your single dash. So you immediately it starts with the single dash on that There should be a space on the hosts all so same thing. Okay, we are spacefaring that hosts information our inventory information as all so. We are executing this playbook on all the hosts. Next to think tasks Okay, tasks is the another section in the answerable playbook under parks and the hosts. Both are in the same least nothing but are the same position it starts. So what is the task we are doing? This one is the task of creating user is there Tasker. So to create a user, we should use their module. Right? So we should specially the model. Now you can see here Every task starts with U minus this task contender toe the task section. That is the reason it starts from here on the user name is he called John. So the name off the user is he called John next become true. So why would need to mention this Says they become true Because this is getting a user. That is the reason we must become your route. Well, creating user So I can say this is my foster answerable playbook. This is how we can write. If you see here, these three are the same indentation because these three commander to the header section these three belongs to same level Whenever it comes to the task it starts with under tasks on This is how it will be right? Let's create this one under exhibit our faster, answerable playbook. So I'm on my answerable server. If I see my present working directory, it is slash home in a sidemen. But let me go toe the slash So pretty here I'm going to create here directly Souder? Um, k d a r. I'm creating your directly called answerable. Okay, I'm creating your direct. We call danceable. Go inside, toe answerable. Then I'm creating you our answerable playbook. What is our answerable playbook? Name Before creating, let me want this directory because it is wounded by the route rate. Yes, it is. Wonder Beirut. Let me change the Watership ch one units. Admin. I'm giving this directory toe in a segment so that I can create files under this directory without any issues. Okay, to change also should use the sort of privilege. All right, now, this has been changed to in this admin user. Let me go insert and create the files. So the past failures create underscored the user dart, William. Okay, this is the file name. And ah, as they said, it starts with three. Minus is that means that this is the way mill format. Next team, the Atlanta starts with a single miners on space. So hosts here. We need to space with a list of the hosts. I want to execute this playbook under all the hosts which are space for okay. Here. Also, it is going to take the default host. Well, that is class it easy and simple hosts. Once this is done, I want Toby commute, right, Because I want to exclude this playbook as a root user. Become through okay, become true. I'm becoming your route user while executing this play. But next mosques. So task section here we are going to create a task. That is way we should starts with here. Sorry, Not here, here. So indentation. New indentation. We're starting dash space, our Model Nim user. So we are going to use your model called user on DA user Model expects the There are metal called name Joel Ricin. Okay, we are creating your user called John. Now, let's save this file and open this file. You can see we have created our pastor. Answerable playbook. Let's execute it. But even though we execute this user is already exist on the target system, let me see. Okay, Johnny's already exist. It is not going toe. Create the user now. Toe executive answerable playbook. We are going to use a commander called and Sibyl playbook followed by our playbook. Name answerable playbook followed by our playbook name. Let's exuded and ah, you can see it is executing posture. Task gathering facts will discuss this one little later. It is trying to gather facts from the two systems, but only on one system. It is successful on other system. It is well similar where it is creating a user. You can see here task user model it is executing. So it is success. It is working Nothing. But it is success. Sorry. It is work. It means it is already there. And if I see here, you cannot see that any changes. All right, so this is how we can create our answerable playbook. Hope you could ableto follow me now. What I'm going to do is I'm going to create now. I'm going to create a two more servers in those oneness. When is our measure, Lennox? Another one is a boon to system on. We are going to exclude same playbook. Condos on. We'll see. How does it work? All right. Thanks for watching this video. See you in the next video. 15. L15 Setup Additional Managed nodes: Hello. Prince will come back currently. Our environment is something like this. We have your control north and we have your managers north. So so far we are managing only one man, is it? No, but I'm going toe are two more manage notes. So total it would be three manage notes on one control note here whatever steps we have done for the artificial management old same steps we should to do on Imagine Lenexa and weapon too. I will just run through those steps. So to set up Manager North first we need to set up ec2 instance Then set up host name creativeness, Admin user Are you use it to suit us for it on the enable Password bracelet. Indication. Once the system we can copy the associates case. Right. Let's jump into irritably is concerned. The launch The Star Wars. I am on my rhythm blues concert. I'm going to lunch new instance by selecting their lunch instance. As I said, I'm going to launch a major. An instance I'm selecting this to to micro Onda name. I'm going to give it as it managed existing security group that is antiballistic earned. Launch it, Sam, keep their lunch it So we have launched a one system that is Imagine the next Our Lear. Also, we have lodged a warning instance that is also imagine, Lennix. We are using that as a control north, not the manager, not next. This travel in selecting who going to serve Tito Micro? Let's go with the default settings on the name I'm going to give it. Does here were born to managed Lord, let's select existing security group burdened. Launch it that ship. So we help provision to Williams. One is imagine the next. Another one is over in tow. Okay? It is not taking because the tags think I need toe heard it. They should be capital name. Good. So dead practice also. So you should be caps toe. Take this one under this player over there. So All right, so we have launched to remote systems. Now I would like to add this to our aws controlled. Or so before doing that one. We should set up these systems. Let's go toe description. Take the public ap addressed to log in. So this is made more back. I have already logged into my and Spencer where earlier this is my are hate filled server. I'm logging onto my arm. Asians or what? No forearm. Agents are what as well it was. That name is easy to minus user. Let's become your route because we need to set up the host limb. The a slash c TC host land. Here I am removing the default one under naming it Does it on May John managing. Okay, Usually in the real time, it won't be like this. It will be something like ribs. Or perhaps our our deep desire will. But for lab practice purpose, we are doing it at the same time. I'm setting it up for temporary purpose. No measure, Manager. Okay, so this is updated. Next. We need to create your user. Use that ad in this ardent and set up the password for Reina. Said Lynn. Yeah. Unless our what? 123 they Unless Erdman at 123 Okay. If you see I'm using same password across the environment. Next, we need to added this user to sort as well the usodo sifter. Gee, onda, uh in that submarine earned. So So We have added disuse after in a 71 last thing that is It's a church. This is shit. D understood conflict here. We should have been password based authentication from no to yes. Okay. I am un commenting this one friend comment this one. That's it. Our system is dirty. No, I p Diddy year. I'm taking the I p address of this system. Oops. One last thing we should do that is we need to reload. They associated the other ways. Still, users cannot able to log in. So salaries? Yes, it's d reload. Okay, Now let me add this one to our hosts. Well, let me switch back to your DNS. Adrienne user. Okay. As I said, we are going to manage our wound hosts. Well, let's go toe pretty and simple from now. One words. I'm going to do all my tasks over there. So let me create a new hosts file here. I will create groups as well. I will create here. Well said a word. Web servers Onda, Absar. What's onda baby, settle it. Okay, just for a see how groups works. So I'm adding my am Asian Lennox or over under absolutes. Similar way I will take thy appeared yourself art. Hey, chill server So our Hitchens R I p address I have added under Web service and I will add a bulldozer over i p address under Devi Sahwas. Okay, let it be open. Meantime, I'm going together. Type your yourself open to system So let's connect Open to system. No Siachin. Yes, it's hitch. So I heard Lord or keep it next for well, Bhutto server user name is who couldn't do Okay, If you have any confusion what you can do, you can go to the connect and it will give the information If you come down here, it's a ch minus I and simple Dark Pym will do This is how we can connect from the Lennox systems from Lenox Systems. We don't need more by Ekstrom only you need to provide the part after where answerable that payment Well, and we can connect to the system. But whenever it comes to the a major, the next are are Hey, Children. Exit is easy to minus user. All right, so let's go back open. Okay, so this is we're going to system. And there we have locked in as they were going to use that. Let me become your route clear the screen. So first thing I'm setting up the horse. Now the a slash c d c. Who's to name Onda? Ongoing Tokyo Open It'll man is the north Okay? Similar way Host name? I want to Who couldn't manage it? No. So do issued minus. Okay. Next, we should create a user user ard Ignace our dream But in Woburn to system what will happen whenever we were creating your user? It won't create the home directory. Usually slash home in its admin directly get creates But here it won't create. That is the reason we need toe add home directory also for the open to user. For that, we can use minus d option. So the stones for directory it is going to create a new directly that is slash home slash And I said OK, user created Let's set up the password. Okay. And let's add May not want to three in as admin art. 123 All right now we'll just switch back Toe Airness admin and see whether it has hope Bear trail and are not okay. It is not yet set up. Let me see whether Homeric Trees creator or not. Okay, it's not creator. Okay, alright, I just evaluator. Oh, so we should use Manus. Um option. So let's create user with minus him Use that are dead in a sudden identity user user ard minus him minus d slash home slash See and know sod Glynn. And in a certain Okay, so let's check for this one this time. Yes, Sianis Admin user has been created with home directly. Let's switch back. Sorry. Let's switch back to And this had been Use it under Chrissy Peter. Bloody hell home Director way We need home directly because they sausage keys get copied intell slash home And I said Really, if this home director doesn't exist, it creates a problem. That is the reason we should have the home. Barry, creo slash homes last year. Now I'm copying the I P address and I will keep it under day. Be so let it be know under whip Serve us. I'm also adding the A major Lennox server as well. We have two servers under whips are worth once are under afterwards once are under DB server right earned one server can be part off multiple groups That is the reason I have argued my arm. Asian Lennox? Or were too. We're observer group as well. Let's say this web now, before using it, we need to copy over a sausage case. So, yes, I have done here. Use ready creation only. Next thing we need toe add this user to pseudo swell. So let's calm down. So this is little differ in less are green. I'm going to copy the same entry from here. Character slash C D C. So doors. So we have given in a segment oddity called all No password because we should give the no password. Otherwise it is going to ask for password. Well, we had, like no right out for that control. War control will enter, then control X to exit. They hold added So does well next to the a slash c D. C. There's a church. It's a C h d. Underscore conflict here. We need to enable Okay, password authentication. You can see it is a little differ. Password authentication is dead. Only one entries did. This is no toe and changing it two years. All right? Everything is done. No service. This is hits d three, Lord. Okay, We have the Lord, our service. That's it. Now we are enabling password. Less authentication between newly creators are worse. That is this one. So it's a shit. Call P. Already the settler name. Yes, I want to. Logan, First time we need to log in with the passport. That is the reason we have enabled the password based on medication. It s up. Factor 123 Seemed a lot of it. It's his hit cough peak. Yes. In a sudden, not 123 Permission denied. Okay. Password might not set up. Password ps swt An assortment art. 123 And I've been out. 123 Oops. In a sudden at 123 and nice I've been are one toe. Now we hold set up correctly and there are 123 Okay. It has been copied onto this system. No one last to test. We are going to do. Let me open the hosts file. I will try to associate toe this system rethought password. I should be able to large in. Yes. Next. I'm going to connect with the system as well. Yes, here also I can able to log in and we killed run danceable all on pinging all the systems minus him beans. But I'm going to give the explicit hosts Well, nothing. But in our current location, whatever hosts file is depth. Take that elementary and it should being three systems you can see here it is being three sisters. Okay. It means that it could able to reach to all the systems. That's all for this lecture. In next video, we are going toe execute our for ostensible playbook, undermining to servers as well. 16. L16 Know about playbook output: Hello. Friends will come back in this lecture. We are going to run our pastor answerable playbook on remaining to service as well. If you do remember, we have created a file called Create User Start Way A millwright. So let me open this. Well, okay, so we have trying to create a user called John Over here on this user doesn't exist on our arm. Asian Lennox system. So here last user Rezaian s Erdman similar way by going check here. Here also lost user Easy in a segment. Now we are going to execute the sensible playbook Whenever we exude the sensible playbook, it should be successful on two systems. One system it is going to ignore. That is 1 40 because it is already there. That's sexy. Good. And Sibu playbook minus a Why should we need to provide minus a? Because I want to create it unders or what's which we are having in over current location in real drivel. So I'm providing my hosts well followed by create user. Let's execute. You can see here tasks. It has been changed on two systems changes nothing, but it has been created. User. Okay. Means it is already there. This is our advantage off answerable. If the target system is at the desert level, it is not going to change anything. But if the target system is not a desert, live it. It is going to change it. Okay, lets go and see. So both the locations use that called the journeys available. OK, but if you want to do the same thing on cell scripted, you need to write a little bigger court. No, let's understand our answerable playbook Output If you see here, it is running the playbook on all notes. Okay, On which notes it is running on all north. So next one is We have added only one task so far in our playbook. But you can see here it is running two tasks. If you see here, number off tasks to it has ran. Both are working nothing but successful. But among those one has been changed. Next, This also one has been changed on this system. Both has excluder. Nothing has been changed. Onder, if you see here this gather facts so gather fax is equal to set up command Nothing. But it is going to pull the target system related information. It is going to gather by using the gather facts. Okay, this is the default task of each exit Guards on every play book on day. If you see here, welcome into it is gathering the information so you can see always It is Okay, then task. So which task? We are running next one That is user task on. Whenever there is any change, it will come in a local er If there is no change, it comes in green color on. If it is changed, you can see that changed. And if it is fine, it is just too. Okay, Next one is player recap List of the service which belongs to all. These are the least of the service which are available in the current host. Well and you can see here. Okay. Means number of playbooks are executor. All are fine out off them. One has been modified on the target system. Unreachable is Jiro Praeli. Argyros, capable, rescued, signaled. Okay. All this information will be there. According so, the output. We will take appropriate addition. Now let's exhibited the same playbook again. No. We'll see what will happen. You can see all are working nothing work. It is already executed. And creator, this user nothing to change. So just toe. OK, change the Jiro. So it is not going to change the target system. All right, now we are going to modify our answerable playbook a little bit because you can see the task. It is just too saying that pastime excluding user, but it doesn't have the clear information for that purpose. We can add one more statement called name. Name is a statement which will display the information well running our answerable playbook name is a statement which will display the information well running our playbook. Let's edit our answerable playbook. We a create user dot William Milk. Let's add one more statement over here. So I'm adding one more statement over here. It should be Start from here. Okay. Whenever you are starting a new statement, it should start with minor space name and ah, creating. Use it, John. Okay, that is the statement on DA. This statement is far this model itself, so we need to remove it. So each model should have only one minus if name statement is already there. User statement, A dozen gate. OK, No, let's execute this time you can see here instead of user. It came as a creating user, John. Creating user John. That is how we can make our answerable output more readable. Okay, now we can add in one more location. That is, are the starting okay? Here also. Wherever minuses did there, we can add name. This playbook is too create, user. Okay, that's it. Now let me execute this playbook again. You can see here uglier whenever you run the play. It was showing a zit all nothing but on also what? I'm running the playbook. But this time, this playbook is to create a user. Okay? It is giving the appropriate to description well, exhibiting this particular task. That is how we can modify our danceable output more available. And it would be easy to understand. Okay, Now we are going to modify one more change toe our answerable playbook. That is, you can see here, user model. I wonder if you are specifying you were user more deal information. I mean to say attribute where I live in the same land. Then you can use equal. But if you want to space for in the another land like this. Okay. Name like this. You want to space way? But name is the attribute off user. So it will be starts from here. Name John. Okay, this is how we can change it. If it is in new land, you should use the colon space. Let's say this one and exuded you can see the same old put nothing will be changed. All right, now let me open there. Create you is that? And if we try to recap it what we have done, you can Our name statement wherever minus was place where earlier so immediately took three minuses. You can space for the name statement. It will do the information about your playbook. What it is doing on the name hose to become task All these all our commander toe the same Internation. Okay. And whenever it comes to the tasks so each task will starts with minors. So miners space. And if we want to give some description, then name again we can use on da dis Treatment is not available. This minus will start for user. But if this statement is available, you don't required minus over here. So this is how we can do. This is one again. If you want to create one more task again, it starts something like this minus piece you to treat such a different does. All right on next thing, if you are spacefaring you were attributes were living the same lane off you were model statement Then you can use equal. If you are using your follower land, you can use the colon. But this attribute should have the proper intonation. Clear That's all for this lecture on the sea Win the next lecture. 17. L17 yum module: Hello, folks. Welcome back in this lecture we are going to write answerable playbook by using your model . Let's do that one. I'm clearing the screen and ah, a less. So far, we have created only one danceable playbook I'm going to create. You knew. Answerable playbook that is Install packages Dart way A mill. OK, install packages. Start way a milk Onda. It starts with three minuses followed by your single minus space name. I'm going to give name this playbook. Install packages. Okay, No hosts. Now, whether I want to install on all hosts are only on specific hosts that I can space for it. So I would like to do it on only Web servers. Okay, in Webster, what's we have only two servers next to become true because it is a installation. If you don't space for this one, you were answerable. Playbook cannot take to go to this one. Next docks under tasks we are using minus name. So I'm naming my pastor Task install back case. Okay. Installed Pakis on and I'm using a model called William. Okay. Your museum model. If you don't know which model you should use, you can guard check for and simple. More deal to install packages. You can see young Mardell manage packages. And if I opened the fostering yourself, it takes us toe model pays on. You can scroll down. You can see the perimeters, water and all parameters you can use for this bespeak model. And ah, scrolled on little more. You can see how you can use this model. You can see example installed the latest watching up Apache. Um, name hits the DPD State latest. Okay, Similar where you can see the other example says, well, clear. No, let's see what Colonel parameters we can use. We should use name perimeter for this one if you scroll down here. Yep. Name. This is the perimeter we are using Your packers name are packets bus fare with the washing . Like, soon So soon so we can switch for your pack. His name next one is state. So state is another perimeter. It is h eyes off, obstinate installed. A little taste present removed. These are the options. So if we want to install either we can use install, Latest are present. If you want to remove, either we can use absent or remove. Okay, so Let's go on to do this one now. Young model. I'm specifying in the new lane. Then it should give that to spaces. Over here on the name Colon. I'm going to install. Get if you remember, We have already installed. Get on only one system. That is our heat shield server. Now we are going to do in another server. Um vaginal, an X server now name get then State state. Nothing but whether gift is installed or removed. So I would like to say that it should be installed. Are installed the latest art project. Whatever I need, I can use it. It should be installed. Save it. Now let's open our answer Will playbook. Andi, if you see this one, I'm trying to install our packages on only rips or worse and ah become true. I have given you become true on the name. Get on the install. If I go and check in the the redhead server Get is already installed. Burti, Pacey on a measure in the next hour Work it is not installed on the same one wouldn't also . But currently we are not installing on. We're goingto okay. We won't do it is already there. Okay, It comes by default, I think. But anyway, we are not touching movinto. Why? We're not touching If I open my hosts Well, in the Webster words, there is no windows are ever going to serve our exist only on D. V. Serwer's okay. And also want to server doesn't works with him. That is the reason I'm not doing on woman to serve. It will do it in a little later. Let's execute the sensible playbook and simple playbook minus. I hosts on explicitly spacefaring my hosts Information on, followed by install packages. Okay, it is gathering facts. It's fine. Are you can see installing packages in foster system? It is already installed, so nothing to change, but in second system, it's installed. Now, if I go on check further. Get yes, you can see it is already in start. No. Now what I'm going to do is I'm going toe remover become true so that our answerable playbook should not run. Now let's edit our file installed some other packets. So here I am commenting. You told I don't want to do with the route and I want to install older three. Okay, three is already installed on our Hitchens server. No, it is not available on imaginary next, But let's try this one. So answer will playbook minus a hosts install packages. Let's do this one. No, I'm not running this danceable playbook as a root user. So you can see here. This command has to be run under the root user. Even in this also, you need to be rude to to perform this command. Okay, Now, again, I need to enable it. Instead operating I can supply a this value from outer that is with minus b option minus B . Nothing whereto become so let's execute this time. And it should be run as a root under install the packages on the target system. So on Arctic chills are work. No need because it is already there. Andan imaginary. Next it's installed. This is how we can supply become route statement from the answerable command line. All right, now I am going to do one last thing. If you see slash CTC and Sibyl hosts Okay, this is the default one. Great. On also cat installed packages it is trying to install under Web servers group. Now, let me execute this sensible playbook without any hosts file know what will happen. It looks for the Web servers in their default host. Well way because it is depending the unspooled artsy of G. But there is no group called Weppler words. It cannot exclude on any of the systems. Let's execute. You can see here nothing can be done because could not match supplied the host pattern, Ignoring rips or worse because it could not find Webster words in this particular inventory fell, so it just escaped. That's how answerable playbooks does work. That's all for this lecture. In next video, we are going to see how toe create your directory are file on the target system. Thanks for watching. See you there. 18. L18 File Module: Hello. Folks will come back in this lecture. We are going to see how to create a file are directly on target system for this purpose. I'm going to use your model called a file. Assume that you don't know which model you should use. Then goto browser and search for answerable. More deal. Answerable model to create file. Okay, you can see here. You can see file model manage files on the file properties. Let me open this one. You can see the description set. Our tributes are filed. Siblings are directories and you can see perimeters what you can use. And if you scroll down a little bit, you can see the example says, Well, okay. So how can you create your files? Are how can you change the one of support your pile? How can you create your directory? All this information is there. Okay, Now we are going to create a pile. Whenever we were creating your file, you should use the But I might recall the state and it has these choices. Okay. Up center directory file. Hard building. Touch these other options. If you want to create a pride, you should use the touch If you want to create a directly, we should use their directory plane on the next thing is but parties. Where do you want to create this? Well, you can see here part it is required. Where do you want to create your particular Kyle? That you can space way over here. Now let's jumping on creating new ones. Will playbook toe creative file or directory called it. I'm creating a new file to creative fell for this. So I'm going to use it. Three a create underscored filed out William l Go to insert Mort three minuses on the minus . Name this playbook. Creative files are better. Then hosts I'm going to do all because creating your directly is common for either are hit yellow Romijn, are you going to solar ticks? Good on All then become true. Okay, Become true is not required for this case but let it be. I want to show you one variation, then tasks I'm going to name it as a creating year. Fine now which model we are using that is file model in file model We are going toe do the part Nothing but the file name which you want to create on the target system. I want to create under slash home in this admin because here I have were not permission to creative Well, demo file. I'm creating your file called removal on the target system. So whenever you special a park here, you should give the ever file name are directing him as well. Other ways it will try to create a in a sad minimize their file. Okay. Next to create a file we need to give the state right so state either touch our directory If you are creating your directory, this is your file. So we should use touch. So touch Let's save this one and ah cat create filed out. Wait a minute. You can see here we are creating on all servers also wants nothing but care hosts recharge their in this current location. Okay, this is how we can display another way is we can display with the answer will command as well answerable all minus I hosts minus minus released least hosts. This is a actual commander to list or you were host Inventor You can see here three hosts It is going to display that all the unique hosts Information Let's create a file So and civil playbook minus I hosts create filed out women. Let me create it. So it's executing. Okay, Alright, it's created successfully. Let's go Toe toe Ruhl Sorour I'm already on. And so Blue Home directory. Unless if I give, they might fail. Similar way here. Also your list. I'm already on target location here also, Ellis. Okay, everywhere Demo file is created. Now I'm going to show you one more thing. Ls minus yell ls minus Yell here less minus yell. Okay, you can see here This demo file has bean created by root User user also Route Group also wrote And if you see here same thing it is one Beirut. If you see here here also, it is one way route way Because while creating over answerable playbook we have space for to become true become Truman's. What will happen first? I will log in tow Target system as a NSAID mean Then I will become your route. Then I can exclude this particular command Our model. If I don't specially this one, I will create here pile as a in this admin user itself. Let's comment this become true and create one more file. Okay, let's create a directory. Anyway, we have seen how to create a friend, so I'm creating your directory. D a r one earned d a r e city were way Okay, directory. But I want to create it. We thought to become true, so I helped commented the tote on Well commenting it doesn't to take the indentation. It may be anywhere. Just it should be, Commenter wrote. Now let's exude the same answerable playbook on same hosts you can see here it has been created. No, If I see your list minus l. The air one has been creator, but as a in a segment way, because it doesn't convert her as a root user to execute the sensible playbook. All right. Sorry. The list menace here. Okay, this is how we can create files or directories on target system. Now, I don't want to These two files, I can remove it. So to remove, I just need to spit strata instead off state to directly. I can give them off sent. Okay, let's exuded again. That has been changed on defy going check. It has been three more. No. Clear. So that is how file. More deal does work. Thanks for watching this video in next video. We are going to see copy more, do 19. L19 Copy Module: Hello, friends. Welcome back in this lecture, we're going to see how to use the copy module. So copy model usually useful to copy a file from one location to another location are one server to another server. So in this case, we are going to copy a file from our answer Will master nor tow target system. So before start writing over answerable playbook. Let's go and see what we can do with the copy model. This is the copy model. Unanswerable documentation. The copy model copies a file from the local are remote mission to your location on the remote mission. Okay. And if we go toe a little bit down, you can see that perimeters, water and all parameters we can use best nothing but a destination onto which location do you want to copy? This must be available. And also we should have sort before going to the source. You can see group. We would like to change the group more. Nothing but permission Warner, One issue on the Assad see nothing. But where is the source? Whaley's exist. So all this information we should pervert our live with scroll down a little bit. We can see the example. Copy a file with Warner on permission. Copy Source. Dish Nation on also Warner, the Group and more. So this is one off the example and a few other examples we have anyway. Let's go on creating a answerable playbook to copy a file. So first I'm going to create a file called Index Start HTML, which I'm going to use in my later classes. So Index start hits to your milk. I'm just going to name it as a hitch. One and Simple playbook toe Cho Ph. Filed. Okay, just I'm giving some content over here. Then we'll write your playbook and simple Sorry. Three. A call Pete underscored Filed Art Way and milk. So three minuses, then minus name and simple playbook to call for a year Plan hosts. I'm going to do it on all then become true. Actually, to copy a file you don't required to become your true. But if you are changing the one of sleep off your pile. Yes, of course, you should execute those comments as a root user. That is the reason I'm using Become true dos six. So the task is name copy. A file earned a Mardell Name, copy and copy model requires SRC. So source we have created a file underwater Pity answerable in big start HTML rate didn't destination. Where do you want to copy? I want to copy it on toes slash home in this had been a witness had been home directly. Only then more Nothing but well copying. What are the permissions do you want to give? I just want to give Jiro six double Jiro didn't order. We're not nothing, but do you want to change the wonder off this? Well, yes. I want to give it to the John. Okay, John user is already exist, so we can give it. So if you don't need Warner's change, then you don't require that become true. So let's save this file on the answerable playbook minus. I hosts copy a file. Okay, If I exude this one, it is going to actually going to create a file on the target system. But you just would like to check whether it is working Fine, are not so check usually just to check whether the playbook going toe work fine or not. So let's execute. See, here changed nothing, but it is going to change it, but it is not actually changed. So if you see here here less Wonder Demo file Is there here? Also? We are already in danceable home directory. Ls demo file only. Tell us they won't be lonely. Now, one more command is there. Just to to check your syntax. Syntax check is the another command which is going to check your syntax. Okay, Syntex, check Syntax spilling itself His room. All right, so syntax, check. It is going to check this index. Let me modify my file. So in just two removed one extra space over here on Defy Tried to execute this one. It is going to throw you an air of that. It is not at the right indentation. So let's execute No, this playbook. So let's ah modified this file on Gueye. So this file under let's sexy good. This playbook actually Alright, this has been updated earned. If I go and check this time, I can see the index started html and you can see the permission. It is six double zero earned. It is one way, John. Same thing over here as well Under here as well. So that is how we can copy a file under target system by using the copy model. Thanks for watching this lecture and see you in the next lecture. 20. L20 Install and uninstall httpd: Hello, friends. Welcome back in this lecture, we're going to see how to install a patching on manage notes on. Also, we are going to see how we can run more than one task from your single playbook. For these, I'm going to use existing playbook called install packages that weigh a mil. If I open this one, you can see it is installing your package. Something I want to do for the Apache as well. So let me copy this one on too. Install Hit, sturdy beauty dot Wait a minute. Now let me edit this file installed hits to the beauty dot William L. So here instead, off three, we are going to use hits 30 people. We are going to use Hitch pretty pretty, so start installed. So this is to in some the heads pretty pretty surgeries. Once we install hits pretty pretty. Then we need to start the hedge duty police service. Right. So, to start the service, we are having a model called service. We can go on such for that So danceable. More dool to start. Start your salaries so you can see a model called service. We have sensible documentation. Let's open it. All right? If you see here name it is required. So the name of the service we should Probert on the state whether real ordered restarted started Stop. This is the information on the examples to start history. Pretty service. This is the one we should use. Let's use the same thing. So toe add another task. As I said, if you are adding more than one task so tasks should be start from the same alignment. So name. I'm giving start history Beauties Service start hits too deeply Service on da marginalised service. What is the name off the service? It's too deep. Beauty State started. Okay, Starter Is the state on the name? Also? I'm going to change it to this playbook. Install head Sturdy beauty. Okay, so on Webster, what's only want to install it? Let's save this one. Let's open and see what is The content Is there in there? So first what I'm doing, I am becoming year. Okay? I should become your route. Otherwise it won't takes good. Anyway, I'm going to give minus b option, then install packages. So installing packets that is his treaty pretty and installed once it is installed we are starting the service. And if you see the alignment, both are started at the same indentation. Next these two also task on model. Also in the same inundation. Like about ask on these also are the same indentation. This is how you can defend the models right now. Let's exit Good answerable playbook. My inside hosts. Okay, Each time. If I don't want to give minus a hosts, I can create answerable Darcy of defile over here. Let me create it. So I'm creating Yeah, and spilled out CF. Just so you know, entry file. I'm going to define over here before creating. Let's see how we need to defend more class. It is a answerable and school. Darcy of Jeep. I opened this one. You can see this is what we are going to different. So let me copy this one. Quit Clear the screen. Three a danceable dot C of G under. I'm just copying this content on uncommon This ongoing change our hosts well on, please. Nor that host well can be anything. It doesn't mean that it should be hosts. Okay, slash Well, pretty and simple Post. All right, so if I see here we have danceable hosts now. We fired on danceable, minus minus were shown. You can see here. Actually, you should take slash CTC answerable and school Darcy of generator default configuration. But in our current location, it won't a new answerable dot C of defense. So treating this as a default one on digital takes the all the values from this and still it frequents a few other wear. Loose it, going to gather from the default answerable Nazi of defiled. Okay, if you see here become true, we haven't space for it. So it gone valued it over there, so become false over there. So you cannot pronounceable playbook as a root user. Now let's exhibit answerable playbook. I'm not giving any hosts well, because it's already updated over here. It is going to take the sensible door CFC file. Then I want to do only on Web servers. Yes, off course. It happens, then installed hits to DPD minus B because become proving how commentary Don't let me show . I'm not executing it. Canceled it. Install heads to TPD dot William l You can see here this playbook install hits the DPD and the UN. Webster was only on become trees. Commentary taught. That is the reason I'm giving minus b option. Let's execute this one. So whenever we eggs good, it should install hits too deeply on the target system. On start the service, let me go on. See my PS minus your grip. It's 30 beauty. You can see nothing is running similarly. Okay, so not enough these systems, it's running anyway on Woburn, the system we are not going to install. So here it is also not running here. Also not running. Okay, Clear. Let's execute it. And also, we can check the r p M minus qu grip hits to DPD to tell Sue that whether it's pretty pretty packages that installed or not seems six and started Just know even here also if you would be there by default on top off that when it installed traditional one. So I think it is successful over there. No, it's failed. UN supported patrons system the start. Okay, installation is successful starting. Sorry, this is not started. This is state. Okay? There is a type of let's edit this reinstalled. It's pretty booty. So this is not start to state it It it is doctored so currently packages has been installed . Second task is not successful. Let me read on it. Under this time it will just show you as their work because it's already installed already it is installed on the dis. Also started. Now you could check for the sort of ease it's running even on this system. Also, that's turning. So now we can access this from the browser. Let's go here on DA. Let's select our heat shield. So I'm taking the public DNs. And make sure that port number eighties open are the secret group level while creating the security group. We have opened that poor. So let me give this one. So port number 80 years are Hey, chill interprets similar where they play Graham, I'm Asian man out of the system data also you can access it. Okay, test pays. It is on. Imagine the next and the season are Hey, chill. So if I try to do same unwilling to system, it doesn't work because currently we haven't installed on this one. It won't work because it is not up interning. I'm going to show you in next a couple of lectures how we can install on this system as well. So no, let's go back. And ah, we are going to remove these packages. So to remove I'm going to clear. First we need to stop the services, then remove. Okay, it is reverse hard, right? So alerts open this file. Now I'm going to copy this file because we want to remove it right on install. I can name it. Does it uninstall hits 30 beauty Now, I did this well, according toe that. So this playbook on installs It's two deputy on Web servers. Let me enable the become true. So I hope enabled. Under first we need toe give the service. Okay, so let me remove these on the addict in the dawn. So foster name. Stop, Stop. A sturdy, pretty serious. Ana, this is stopped. Next task is name on install. It's pretty. Pretty Yum. Then Name. Hey, Strategic Booty State removed. Okay. Remote is the option to remove it or uninstall it. So let's execute And sibyl playbook uninstalled underscore Hits to deep rooted minus minutes. Check. I'm just checking it out, okay? It is going to stop early to remove, so I'm running this playbook. Once it is executed, we cannot see the packages over there and service all saying stop withstood. So it stopped the hits 30 Pretty service on installing the Pakis learned straight to check the service first, it's not running. And if we check the packages, you can see our earlier it was having four packages. So this package has been removed. Same thing over here. If I check salaries has been stopped. And if we check for the Pakis, this per case has been dream. Yep, this package has been removed. So that is how we can remove the services early. If I go and refresh pages No, it won't work. Onda dis also both are not working. Okay, this also it's not working clear. So that is how we can install or uninstall packages by using, and we are going to work with. It's two d pretty more in the further lectures as well. That's all for this lecture. Are you receiving the next lecture? 21. L21 Install apache on ubuntu: Hello, friends. Welcome back in this lecture, we are going to see how to install Apache on your Windows system. In previous election, we have installed Apache on our hitch. Ill under Imagine, Lennox because both the systems runs with, um command, but to install on open to system, we cannot use your model. Um, is not identified. Usually we use deputy install back is name. Okay, so a preteen still get this is how we can do. But anyway, get is already installed. You cannot see similar where to install Apache. Our heads through dpt. A pretty installing Apache two. You should not use the history period because it doesn't work. I'm not installing it. Similar. Where to start the service. We should use the service Apache to start. Okay, let's right. Answer will playbook. According to that, now I am writing install Apache Toe dart. Wait a minute. I'm just naming it as their prejudice because we are installing on window system. It starts with the three minuses minus name install. But she to our oneto I said Well then hosts this term I cannot mention all hosts. I will give the Davy servers because in Davis are worse. We have only movinto system, then become true because we should install the Apache packages DOS minus name. Install Apache to the model Name is Deputy. Okay, so to install on Apache. If it is the model, we can just check. And simple more deal. So I'm searching Anselm. Ordeal to him. Stolen Apache. You can see here. You can see here a pretty EP. It is the model to install Apache on Over to on the face Crawled on. You can see the example as well install a pretty H two d pretty. So name Apache two on state present State is optional for this one. All right, so let's do that one. A pretty name. Apache two state present present are installed. Also we can do if you want to check this value valued valley, you can go and check it over here. State, you can see her absent build Latest president fixed. Okay. If we don't space for a it will be present. We cannot He was they installed over here. Okay, then we need to start the service rate. So to start the service, the name start Apache to so to start, we are going to use this service model again. Name Apache two state doctored. Okay, Apache two started. Let's save this file on danceable playbook. I know no Tokyo hosts. Well, because under Ansel Darcy, FDA how already? Configured Danceable playbook installed. Apache two dot way of milk minus minus. Check. I'm just checking it out. Everything looks fine. Let's executed. So it is going to install Apache two. And also I can check for the service over here. Apache two. So the Apache two So it started. Means this job has been completed. Alright, so job is successful on the services. Let me check it out. So, services of a running, maybe my answer pills are worried. A little slow to display the airport, but anyway, Gorn, check over here. This is over. Apache is our i P. Address. 38 incident 38. Let me check it out. Yeah, this is we're going to system. Yep. Let me refresh it this time. Yet you can see a party to is installed on this system. So that is how we can install Apache on open to system 22. L22 Notify and handlers: Hello, folks. Welcome back. In previous lecture, we have seen how to install Apache on Arctic Chill Star Wars. In this lecture, we are going to talk about how we can use notify under handlers. I'm opening over. Install. It's two d pretty file on. This is the file. And here we are installing the package aren't start the service. I assumed it. If you are not installing the packets, if that is the case, you cannot start the service as well. Right? And also you were targets are what is already installed and up interning with his study PD . Then you should not install it are in this case I need to skip the my next two tasks itself . So how can we do that one? So this can be possible by using the Northway and handlers we are going to do over here. So let's open this file and Ah, let me become true then I want to start my head's pretty pretty service Whenever this history pretty is installed. If it is not installed I don't want to starters service For that case, I can use something like this. So I want to notify to start hitched to DPD service. Okay, so I want to notify start hits to the police service. Then it would be something like this. Handler. Suit starts from here. Okay, handlers. Now I want to handle this situation. So how can I handle? I want to start the heads to D pretty service. In case if this hits pretty pretty is installed, if it is not installed, it won't exude this particular task. So resist ring the output into the north weight in this one on. I'm handling this one over here on. Make sure that this and this should be same. Okay? It may be anything. It should not be a start. Hit. Pretty pretty service are start Apache just like that. Okay, start Apache. But here also, you should use the same start. Apache, if you don't give, it, cannot handle it. Okay, So what we are doing, we are just adding handler on top off the our service model so that if this is executor, it is going to notify to start the Apache and it comes here and start the Apache over here . All right, so let's save this file and let me open it one more time. Okay, Now let's execute answerable playbook minus I hosts. So I will provide the hosts information all the time from now. One worse so that you don't get confused because you may feel that I'm running errands. Will playbook with a deep old host. Well, ok, minus minus. Check so you can check it out. And you can see it is installing packages on the once it is installed. It is going to start the handler already. Packages are already available. It won't handle it. Let's do this one. We thought chick already it has been installed. If I go and check in the brother, I could see that this is opened running. Yes, this is 100. Okay, on also, if you notify fast, it installed packages on it starting the service Apache service. Now let's re exude this playbook. If we re eggs good, it is already installed. So if it is already installed, not Faye will not. Not Puerto Handler, Toe hand in the situation Because no activity is happening on the abort. Ask So you should not do anything you can see here installing packages and it is not handling the situation because it is already installed. So that is that one days off, using the Northway under handler so handler can handle if you were not where task is executed, If not way is not doing anything, it won't touch. That's all for this lecture. So in next lecture, we are going to see how to use when condition. 23. L23 Gather facts: Hello, folks. Welcome back in this lecture we are going to talk about gathering facts. I'm going to take one off of transport playbook that is create filed outweigh a mill. Onda, let me exhibit the sensible playbook. Danceable playbook minus I I know only too space where the hosts, anyway. So create filed out way of milk. If you'll see here, we have special do only one task over here, but it is exhilarating to tasks. It is executing tasks. So as I discussed it with you, gathering tracks is the one off the original task which is executing well running my answerable playbook. So what exactly gathering facts is going to do? Usually gathering facts is going to recruit the system information from you a remote system . In our case, we have three Manager north, right? So these three manners of notes information it is going together. Then it is going to explode the task. But toed led a file Our creative file You don't required gathering. What system information? Where should you need to do then when it is going to useful? Whenever we are doing some installations on the target system, you want to check out What is the state of self? Your current operating system. Then you can do that one. So during the installations gathering fact is going toe perform major task. And if you do remember, we have executive area commander called set up. Right. So let me re execute it. And symbol all minus, um set up. So here all means it is going toe check in my current answerable host. Well, because I have created here and school dot CHG File over here. All right, let me execute it. It is going to exude on three systems. Whatever are there on DA It gives a lot of information information like I p addresses volumes, CPU memory colonel Abortions on the operating system mawrtians on the operating system families All this information it is going to give if you go a little bit up, you can see a answerable ways Family perimeter? Yes, you can see here and spillways from lift aroma trees. Debian want easier Davian family operating system on the north name also you can see we're going to manage in north similar way. I'm going to other system. You can see a lot of information collector from the open to system. Okay from here. Okay. From here. Whatever information we have seen, just know that is all belongs to one toe on this information here. Also, you can see answerable ways. Family. Yes, answerable ways. Family is the redhead and it is our Hatchell manager system. Similar way. If I goto imagine. Lennox. Imagine Lennox. Also Red hat ways Family system. So still. Here it is. Read her server. Then I'm going up on before a check for here answerable ways from Littered hurt is there so a little bit up? Oops. Okay, came don't anyway. So it use the information that all this information has been collected by gathering facts command as well. That is the reason it is going to execute by default. Now you would like to deserve We were gathering practice. Then we can do that. One for that. I'm going toe. They did this file we ate, create filed outweigh your milk. But here we are removing actually. Okay, let me created strip directory because it is a direct revert. So what I'm doing here? I'm creating your directly called or dear one on target systems and ah, I don't want to gather facts then we can space for a something like this. Gather. Understood. Fax. No. Okay. This is how we can do. Gather, underscore, fax. No, it means don't gather the facts off this system. Let's six a goat. Okay, what it is doing? We don't mind. We just want to see it should execute only one task not to tasks. This time you can see here now directly. It is exuding task. It is creating your directly. Anyway, it's created. That's fine. But it's executed only one task. So this is how we can restrict gathering. You were packed. Now, why should we need to restrict gathering practice? Assume that they were environment? How are owned the 100 plus systems? If you are collecting youth system information from 100 systems, it will take a little longer time to run your hands will playbook. Moreover, if you are using that information well and good if you are not using, it's unnecessary. Okay, That's how we can use the gathering facts. Let me enable it again. So I will just commented out Go. That infects again. I'm executing system. You can see it is gathering facts and the two tasks has been executed. All right, that's all for this lecture. Thanks for watching 24. L24 when condation: Hello, folks. Welcome back in this lecture, we are going to see how when condition does work with our answerable playbooks. You do remember we were trying to install Apache on our hey, chill servers as well as we go into systems. But we have created two different files for the similar kind of task. It doesn't looks good, right? And also, it is not good way of handling. So you should read single answerable playbook. Depends upon you were operating system. It should take addition. Okay, Whether should I need to run? Um, our deputy, This is possible by using Aaron condition. Let's open these files on creative single file out off this these are the two file threat. So this is running on DB servers. This is running on whips or worse. Okay, so I'm creating a single file three a install, install Apache Apache hits to DPD. Okay, so in this one, I'm going to copy this both the files output. So 1st 1 is this one. So next one next one is this one. So when the tasks would be fine, Because remaining all information we don't need, so v a install Apache underscored heads to d beauty. Okay, so I just kept both that asks in single playbook current If you see the alignment also I have copied as it is so it won't throw any syntax error. Now, if I run this playbook, what will happen? So these are all tasks is going to explode on all the systems. But my requirement is whenever surgeries are hit, she'll distribution Run these tasks whenever Tarvaris Debian distribution run these tasks for this purpose. So we were talking about answerable ways Family gathering facts is going to gather facts from the system Now we are going to use that one. So to use this one let me Marty for yet So instead of Webster words let's install on all those her words Okay No become true under install packages hits the DPD here I need to use when Okay I want oh, use when condition win Answerable wool yous Family Okay answerable ways Family is equalled So this is red hat Alright if answerable ways family is redhead Then run this condition When answer always families redhead Then during this condition for time being, let's ignore them Notify earned a handler as well because it may create confusion. So this one I want to run only answerable ways. Family is the cold redhead. Similar were even this also on the amendment Would be This should start with equal to you were model. So when? And spillways family is redhead. Similar way here and spillways. Family is Davian rate. Okay, Davian answerable ways Family is debian on. The same is applicable over here as well. So what I'm doing, I'm just using one additional condition. That is when condition. So I would like toa exit. Good. This one depends upon the operating system distribution. So if it is, read her distribution. Ronnie Um, command, if it is a Davian distribution around a pretty command, let's save this file. Onda, clear the screen. Let me open. Install Apache. It's too deep. You did great. So you can see here. This is the file. Looks good. Let's run and civil playbook minus a hosts. Install Apache hits to the beauty minus menace Check. I'm just checking it out. And if you see the checking, you can clearly understand how it is going to run already. You can see here first. It is gathering. Perhaps once it is gathered effects it is going to install packages faster. Task is executing on only two systems. That is 1 35 and one party. Because these are our heat shield distribution. Andan 43 it is skipping because it is a woman to system means Davian distribution. Similar. We're starting the service. Also, it is keeping over here, but whenever comes to here. So in starting Apache, it is keeping these two systems and installing only on the system similar. We're here as well. But if you see all are installed with other packages, that is the reason it is not going to change. So before executing this playbook, I'm going to execute on install packages. So danceable playbook minus 80 hosts uninstall packers have been uninstalled. So Indian are Hitsville distribution. I'm going to remove one woman toe so sort of ease Apache to stop. So your beauty Not anymore. I bet she okay, I'm removing the packages. Yes, lots and uninstall only played. Check it again. This time it is going to successful on all the systems. Nothing we're going to change. So install Apache. It's two TPM running. Okay, you can see here posted sorority's keeping but remaining service changing. Alright, So let's install over Apache Tomcat. So just to check it out, if I request this one, it won't work because we have one installed. If I refresh this one also, it won't work. If I refresh this one, I'll say it won't work. Once we exude or the sensible playbook, it should work. So let's execute post It is installing heads to debility against the Packers. I should use heads to D Pretty in a way. It's installed one on 1 40 on 1 30 fair and started the services. And it is installing Apache two. It is keeping on these two systems installed on started on move into system. Let's go on to refresh inal. You can see here it's working. And this also okay, this is how we can write and swill playbook toe eggs, eager to depends upon you were operating system flavor. No, who tested out? We are going to disable the gather facts. Apache. It's pretty beauty, So oops, I haven't given the doctor a mill extinction. That's okay. As I said, the disease optional just to to make sure that what will happen if we desirable gather packs, gather understood fact Okay, I'm just changing. Gather facts? No. And I'm also moving this one toe appropriate naming convention. Dr. William in. No. Let's exclude this playbook with check just toe with check and you can see it is going to fail. So dart were moderate, so you can see here what it is saying. The condition check answerable ways. Family read Hartfield There was error while evaluating the condition so it cannot able to evaluate because gather facts is not giving any input for this particular value. Okay, so I'm going to add it back Held. Deleted it under Lord Street on No, this time it is going toe. You can see it is untreatable way because we immediately ran it. Now you can see this. It could ableto All right, So that is how we can ableto running a single playbook depends upon the operating system. Their cell for this lecture. Thanks for watching. See you in the next lecture 25. L25 Uninstall Apache2 & httpd packages: Hello, folks. Welcome back in this lecture, we are going to update our uninstall history Pretty dark. Where? Mel file. If you do remember, we helped created this well while installing its treaty beauty are the time. This was creator only for redhead distribution. Now we are using move onto system as well. That is the reason we should add tasks toe uninstall Woburn to as well. Let's open this file with three a. So here we are going to use when condition to make it more efficient. So let's art Ben condition for this one toe work only with our hitch ills are worth. Then we'll aria pity model toe uninstall on woman two systems Ren answerable boy. Yes. Family double equal to not really hurt. Okay, so this is what I want to do. Same thing over here. So I'm going to use when condition similarly stop Stop Apache two services. So then suddenly he's surgeries. Name Apache two state stop. Okay. Next one condition. When and simple ways. Family equal to Davian, right? So similar were minus known unknown stall. Not bad. Cheap to so Yep, It is the model then Nan Apache two state look removed Okay, That's it. Let me say this file under. Let me test this file and spill playbook. What? You Sorry. Get Tau are the Where's family as well? Road. So it's family day PM So that's it. On disability playbook minus a hosts. Then uninstall heads to the PD minus minus. Czech lords validated through. Okay, it is working only on Web servers, but we want to execute it on all systems. I mean to say with whom to as well, let's change host to all that's it. Alerts executed again. So it is working on all the systems, so value should be fixed. Noticed. Present removed. Okay. So absent. Okay. So to remove on, we're going to system. It is absent. So again, I'm going to read it. So instead of a remote, we should do that absent. Okay, that's it. Let me re executed. Cool hurts working her name to moving it. Now, that's all for this lecture. In next video, we are going to update our Apache playbook. Thanks for watching. See you there 26. L26 copy index: Hello. Folks will come back in this lecture. We are going toe enhance our install. Apache. It's pretty pretty dot way a milk and supple playbook. So what we are going to do is we have created the index start html pile. Right. We are going to copy this one. UNWTO we are dub Dub Dub, html location. We copied this file aren't aware. Dub Dub Dub heads chairman location. So whenever we refresh our pages, we are going to get whatever content is there in that. Well, before copying, let me modify this file. Index started html file. I will just to name it Does well come toe Paci. Tom. Kurt. Okay. No, I'm going to modify our answerable playbook. Toe, copy this 500 target system. So just weaken open this fell under. We are going to add new task. New task learned. Uh, copy index Dart Indexed art html no copier. Find we are going to use them. Ordeal card. Copyright Yes. 30 source Hope et and Sibal index dot html. And where do we want to copy destination? We want to copy in tow. We're Dub, Dub, Dub Hitch, Tianmen And, uh so do this one we should have your route previous. So anyway, we are doing with the become on the more we want Tokyo Real permission. So Triple Six I'm giving So that read under it would be there That's it earned the let's save this file. Now, if I open this file, copying files is same Respect off our operating system. That is the reason I'm not using when condition so alerts executed and civil playbook. Minas a hosts when strong Apache hits Trudy Beauty. Okay, on the minus minus. Chick just to tow Landed it. So already we have installed over Apache hits the DPT so you cannot see any changes accepting copying your file. Okay, so let's ex beauty it before executing, I will just to show you the index started Tamils cash We're dub dub dub heads to your men Kind of this swim. Sorry, which TML so you Unless there is no index fell over here. If I go here also clears Sudi Where? Dub dub dub PhD in men. So no index Well, so in a purchaser Torres will. So you're less minus really crazy here already? If I lose their okay cat file, get some content. Is there. Now, let's execute this playbook. Okay? So you can see here. It has been copied? No. Unless you can see index started. Steer milk. Sodo cat index started similar because it is copied through route user. So that is the reason. Let me do ls over here less minus yell. Oh, okay. Permission. Juror. Triple six. We should kill. Let me edit it. So it should be jailed or triple six. Let me execute it again. Okay, Now it has been copied properly. They're less Manus yell. Okay, you're great x here as well. Yep. Sodo card index start hits TML same content. And if we go here as well, Okay, there was the other content. Right? And if they do, you're less minus l and indexed. It hits TML. Whatever content was there, it is getting replaced. So always it is going to update the latest configuration. Now, if I going to refresh my page, I could see this content. Welcome toe, Apache. Tom, get sending over here as villas here. Right. So that is how we can copy our application file onto a target system there cell for this lecture. Thanks for watching on to see you in the next video. 27. L27 List and with items: Hello, folks. Welcome back in this lecture we are going to see how to install multiple packages with you . Single task So far, we are using year task to install only one package. If you see our answerable playbooks. So we have your file called installed packages start women. And here we are installing only one Pakis that history. Let's take an example that I would like to install Get the blue gate telling her to Jesup all these packages with you Single task how to do that one I'm going to show you know. So let's say did this well, usually in world abortion are this washing Also, we use wheat items, but in updated abortions, veto items is going toe Deprecate it so I don't recommend to use potatoes but I will show you in the border is the fast way is just simple. We just need toe art it as they list. Remove this one over here. Earn Start with the braces on weaken spits weight whatever packages we want to install. So make I want to install then gcc Saudi Just you see then w get tell net. Okay. Next Jeep. All these packages I would like to install with one task. So this is how we can do and save this file? Let's sexy good And Sibal playbook minus a hosts and still packages dot William l minus minus check. Okay, just we can check it out. It is installing packages all ready to serve us. It is going to successful before exhibiting. Let's go and check whether these packages are there are not r p m minus qu I'm just search for only one pair Case that is the blue get So Deb Liggett is not there. Same thing I'm doing over here. So here already wt is there? That's ok. Let me such word. Gee gyp Jesup also there then make. Okay, so that is the bandage off using our major in the next, we will get almost all packages. JCC, I hope. Okay, this also there. Most of the packages are available over here. So here, anyway, we are not Ah, checking here. Anyway, we're not installing, but if we want to check the fpt least minus minus installed. Okay, this is the commander to check it out. Grape with the blue Getty feature, it will tell you whether it is installed or not, SimCity is there? W get if a check. Yes, it's there 100. So let's go back in. Sort of chocolate means toilet. So it is going to install packages. The crystal packages, some that are good systems. All right, both the systems. It has been installed. Now, if I go and check for the public it, we can see the package's over here. Here. Anyway, most of the bracket is sort of it. Same thing we cannot you with the v. Tatum's, but it is going to duplicate it in our latest wasn't so Please try to overdo it, but just I will show you how we can use it. Let me comment this lane because I don't want to remove it. But I'm going toe name over here. So name instead off our pack his name. We should space further with colon floor braces and we just need to space for the item. Unclos it. Here we are trying to use like a variable usually in danceable variable started different in such a way. Courts under flower braces. Within that, we need to space with a variable so same thing we are going to do. But variables I'm going to discuss in the next decision. No, we need to. Are the items water and all you would like to install? So here we can space very with items. Okay, so here we should space for the items Name that is get like least wishers. Westway, make them GCC next. W get still in it. Jesus! Okay, so this is how we can space Very only can see this one alignment is not fine. It should be. Start here. Okay. So no, everything is fine. Let's say this well Onda, check the Whether Syntex is fine are not ok. Something is missing in the alignment, so name state retail items. So here the result. Typo It should be read items. That's it. Let's say this file under the streets. Are you okay? You can see here. Duplication warning. It is saying that it is going toe deprecate in the latest fortunes that is worsened. Poldark 11. This feature will be removed in the wash in Poldark 11. So even I would recommend you to use the only lists. Don't use debit items. That's all for this lecture and see you in the next election and we'll talk about variables . Thanks for watching. See you there 28. L28 Ansible variables: Hello, folks, welcome back in this lecture, we are going to talk about answerable variables. There are various ways we can use answerable variables, but I'm going to use few off the waste, which most of the industry does use. Answerable variables can be defined within the answerable playbook, so this is one of the way we can use. Then passing from the external files means we can defend answerable variables in the external pile and call it in our playbook by refering that variable file passing from host inventory we helped created hosting went rate. Even There also weaken different danceable variables on the passing, well running playbook. While running over answerable playbook, we can still pass the variables using group Where's our host were turns on, we can use groupers. Host words when we are using and simple rules so deserved. The widely used are quite commonly used. Based off the variables. We have a very good documentation aboard the's on danceable documents. Let's go and have a look. This is using variable how we can use variable on the price crawled out. They have explained why we need variable well automation existed to make it easier to make things repeatable. All systems are not exactly alike. Some may required conflagration that's slightly different from others. As you know, we are going to manage different kind off systems. Each system may not work similarly, so depends upon the systems we need. Toe. Take the appropriate additions in those cases. Answerable variables, helpers lot. If we scroll down a little bit, how we can define variables actually weaken different under square all for numeric numbers . Also, we can use We should not use miners. So minus is not valued to use invariable. And also Spacey's darts only numeric numbers. So let's go on implement answerable variables in our playbooks. So I have logged into my answerable server. Let me become your inside me under clear of the scream on slash will pity and bill disease overworking directly. And these are the files we have created. And if you do remember, we have created a file called create user dot William L. Okay, this is our first sensible playbook, right? No. Take this example. We are creating your user called the John by using this playbook. But I assume that anywhere team in new gay has joined. No, you would like to create his user. So again, you need to go here and change his use. Ready? Not only this one. We may have multiple tasks. Nothing but creating his home that we are generating keys. A lot of things we can build all the stuff you would like to do with this one like this. If you hard court, it is quite difficult. And also, if you are using the same value again and again in your playbook, you need tomar differ in all these locations whenever your new journey comes in tow. He worked in to overcome this problem. We can use variables instead of hard coding values like this. I'm going to use variables within the file on will replace this valley with the variable. Okay, so do that one. Let's edit this file here. I'm going to create a variable called User. So alerts creative arable. Usually we can defend variables with bars. Okay. And if you see the indentation, it should be equal toe. You were hosts are tasks. Okay, that and I'm creating your variable called user. So user is a variable. Our name Space Wing Valley. Was it John? Okay, No. Here in ST off name. I'm going to use user. Okay, instead of name I can use. Use it. But if I wanted you user, it will treat it as your user I want to create. And it creates a user with user. So the richest special way off defending variables. Unanswerable. That is, we should space for in the flower braces under this extra space in between flower braces and the variable name it is optional. Okay, but this is the standard practice we can do On another thing is in the statement. This is the key. Under this is the value. This is the key on. This is the value. So in your statement, you were variable is the starting word off work value field. Then you should space for that in the braces. Okay. Like this, we need to keep it in the courts. If we don't keep it in courts, it throw an error. This is how we can defend variable. But this courts are needed only if we are spacefaring. Starting word off the value. Okay, if it is in between, Okay. Something like this are user, aren't Then you were available is coming. Then it is optional, but this requires only user value. Let it like this and save this file. Answerable playbook minus I hosts create user dot women. Let's exit. Good. Anyway, this user we already created nothing is going toe. But this is how we can do now. Watching that you never team a user called Morty is going to John now. I don't need to change in the alder tasks wherever it is space feel, so I can just change in the variable value. So I would like to replace this one with morning. All right, let's save this file. Let's exude it. No. Now it is going to create a user called Morty under all the systems. Yes. Let's go and check it out. So, Kurt slow CTC password. You can see your user called Ahmadi has been created. So similar were character you. Do you see Password? Yes. Morty has been created sending over here Charity to see password. All right, so more user has been created. This is how we can use wearables. No. Whenever there is a new user, we are modifying aranzabal playbook. Right? But I don't want to modify our answerable playbook. I would like to get this variable value from the external source means we can create a separate file. And from there we can pass this user name for that. I'm going to create a file called user dot. Wait a minute on. This can be any extinction. There is no restriction here. I'm going to give name more. The user is already creator. I'm going to get Tom. Okay, so now I need toe tell to my playbook that variable is coming from this file read. So let's modify our file. And, uh, we are not specifying any variable. So now it would be something like this. Where's underscored files? Okay. This is how we can define external file name where some the school files on DA, then filing him. Our file name is user dot way mill. Now it is going to call user from external source. Nothing but from the external pile. Let's say this one on DA will execute again. Minus minus. Check just to tow. Valued it. Okay, so the task includes an option. User is on different anyway because it is thinking that user is not passed, but it is already there. But ah, the description is creating user. John is there. Let me change it. So creating just to use it. Okay, adults. Yep. We can do one more thing that creating user. Okay, use that. This is how we can defend. Now you can see here. I haven't specified any braces, but still it works. Now let me execute it again with check and we can see the variation. Oh, I think they house Pittsford. Okay. It's not name. It is Use it, so use it. So that is the reason it is throwing any error. Let's execute. No! Yes, you can see here creating user Tom and it has been created. And we'll check it now. Yes, Tom is dead. It has been created. Ok, all right. This is how we can pass your user name from the excellent source now are we can pass the variables well running. Aranzabal commands itself. Let's take the same example now I'm goingto pass while running my answerable playbook. Please remember that well running you're answerable command. If you pass any variables, those how highest priority means wherever you have different, all those are ignored. And whatever we were passing well running were answerable playbook. That will be taken it as a variable value. So currently, variable user name Tom is there, but still I'm providing as their extroverts. This is the barometer. We should use our weaken just to use that minus e. Okay, either With so minus E What is the variable name? User? Right. Use a re quarter. I'm going toe Pass it as it Sonia there to see it should create user called Sonia. No. Yep. You can see Creating user called Sonia. And it replaced. And if I go and check over here here also, you can see the same thing. Clear. They said, Well, passing you are variable through the command line. It will have the highest priority. Even we can do with the extroverts. Sort of minus minus Extrovert. So same. I'm giving, But just it'll seem. Make sure that even extroverts ulcer does work. All right, so this is how we can defend. Apart from this, there are various ways even we can be painting over in wintry pile as well. Whenever situation comes, I'm going to explain. That's all for this lecture and see you in the next lecture 29. L29 Convert Shell commands as ansible palybook Tomcat server setup: Hello, friends. Welcome back in this lecture, I'm going to show you How can we can work our shells? Our UNIX comments into answer will play ball for this one. I have chosen Tomcat insulation, which I have updated in my get hub repository. This is my Get her back on here. I'm logging into my answer built repository. And here we have your file called a tongue God installation. So if you see here, here we have steps. Tom, get insulation. So pretty quick start easy to instance. Anyway, we help claim to manage north and we should install job our first, then don't Lord Tomcat from this u r l and that this is the world abortion. Anyway, we are going to download latest worship. Once we have downloaded, we can on gyp it, then give execution permission. Toe startup Gardez Hitch and shadow not is hit, but anyway, we are going to use startup dot Shh. Then start their time card services. Once it is started, we could able to access our application on port number A Jiro Jiro, which we have already open Nuts, security group level. Let's jump into Aranzabal Sarwar and creating sensible playbook toe set up Tomcat. So I'm creating your file name called Set Up Tom. Care to Doctor William. So first step is we should install job. Let's go. To insert more three minuses them name set up Tom Curtis. Then hosts Bond become true because it is the installation and set up, then the mosques. So for Stewart ask is we are installing java minus name install job to install job. We are going to use their model called GM on the followed by name. Java stayed installed, right? And ah, this is we are going to do only 100 hard distributions are worse. So then we should give answerable. Sorry. When condition Brennan and Sibu boy, this family quarto red hat. All right. Similar way. We want to install job on Mobutu server as well. So to install job on wood Windows server John would want to We should use default. Jerrick it. There is no packets called job I in woman two systems. So if we go toe overwinter system and check it out So the PT install over You cannot find the package, but we should use default. Jerrick it. So let's use this one. A beauty next to name default Jerry Key understate It should be present. It's not installed. Right then when condition we should use when answerable ways Family Quito Debian So then we should use this one. So we have installed a job. Now we need toe. Don't Lord Tomcat packages to donor topping care packages. We should use the similar command like the blue. Good. So name don't Lord Tom, Guard packages. Okay, so go download it. Let's search for the Mardell. W get commonly unanswerable If I do so get ur Elise the answerable documentation If I open this one and ah if we scroll down here we have parameters on we near your destination part where we would like Toa Don't Lord are now also You were really nothing but from which the world we should download. And if we scroll down This is what we need to get. You are ill You are all under addition ation location So let's do that one get under Scary world is the model earned you world So we should get the world You were really is available over here in Tomcat official website If I scroll down, start Dark desert. This is the world We should copy. Copy link Address earned. First it. So now we have specified that you were next thing is we need to specify their destination where we would like to copy. We would like to copy it under slash war. Pity. So now it has been downloaded Only if you see here. If you see here it is going to download in tar dot geezer format Now we need toe extracted are undoubted so under our perch E packages. Okay, so two under we have your model called I'm not cute. Let's go on Such for that? And civil in more deal to on Egypt. So we have your model called on archeo. If I open this one, we can see here. So destination Where do you like toe on our kill? This file that is mandatory on source Nothing. But what is the word? Our care, Flint. And if we scroll down? Yes. Here we have examples. Let's take this example So source under destination. And also we should switch very more death. 30 way We need remote Assad sees if we don't specially this one. It looks for the source Nothing but at this tar file Arjun file In the local system I mean to say only unanswerable, but we are downloading it under target system. Okay, so I'm not Do are not kill Colon next. Yes, sir, etc So source it is available under war. Pity once it is don't order So pack his name would be this one. So this is the don't look back his name then destination. Where do you want to keep one Cities extractor It should be under slash Were pretty. Okay, so next but remote under squared SRC It should be yes means on remote Sarwer check for this particular packages once it is are not killed. We need to give execution permission toe our files, so name uh, execution Permission on Start off dot Shh. File. Okay. We are giving expression permission to give execution permission. We should use model called file on. Uh but where is the part? It is slash War beauty on da This is the wonder it once it is extractor There won't be extinction off guard. Dodges it then. Under this one, we have your directory called Have been under this We have filed called start up doctors Hitch. I will just show you the our documentation here. You can see so execution permission would be on this one. We should cue slash bin slash start of data usage. So this is the part. Next, More we should give. I'm giving Jiro triple seven. Just I'm giving full permission on entire part, so we have given the permission next. Once we have given permission, we would like toa start the sort of your sister it. So Name start Tom. Kurt Services. Okay, so start Tomcat Services, we are going to use a model called Shell. Okay, Silesia model, which can start the cell scripts so we can just search for shell model over here. And it's full module shell. If I do, you can see execute shell comments. It is like it Command module. We can exclude shell comments by using this one. Arts groups here we help parameters called CHD area. She hit the areas to change. ER direct report. We are going to use this one only if you scroll down, you can see that comment. So this is how we are going to eggs. Good shell on, followed by ourselves. Script under arcs. We are going to switch to our particular directory. So it's to start our service. We should switch our directory. Then we need to execute that particular script. Let's go back. So here our script name is start of Doctors Church. This is the script and ah, we should pro Where the ark's arcs to sift over directly see hedged air is the command to change over directory. So we need to switch to this directory before starting our script on the one last thing. That is, whenever we execute this particular command under U free come out this script doesn't work . Soto Executive in the background continuously, we are going to use no hope. Okay, No hope. Start of doctors Hit there some for this script. Let's sell this one on. Uh, let me open it. Toe validated. Kurt, set up Tom Care Dr William Ill here. If you see first we are installing Java so it is only 100 hurt because it is a model Whenever it comes to the uppity model we are going to do on Davian operating system. Nothing but we went toe under downloading on RKO on the adding execution permission. Under running the script, it is common to respect wolf operating system flavour. So that is the reason I haven't added when condition No, let's go on to validate our target systems. So this is my are hit shell server. If I goto a pity, I have only one folder that is a genocide mean. Similarly, if I goto a pity here also, there is no Tomcat folder. I'm going here as well. There is no tomcat Now let's eggs Good aranzabal playbook. Once it is executed, we could see the Tomcat folder over here and we can able to access the application from the browser. So ensemble playbook, my essay hosts earned set up Tom Kurt Minus minus. Chick, I'm just evaluating my unspool play work. So installing java So maybe in Java is already there, but on weapon to system, it is not there. Okay, it's failed way because this particular file is not there. But anyway, we haven't or don't order yet. So off course it is going to fail. Let's sexy good aranzabal playbook without check Java installation on woman to his successful. Then don't learning the time care packages. Once it is downloaded, we can see the Tomcat packages over there. So on 1 40 Sorority success. Yes. You can see here under here. Also, we can see Yes, Here also we can see so extracted here. Here? Not yet. So you can see here every year. Olds extractor under happened here as well. Oops. Failed to start the service. No hoping not off. Put. It seems there is some problem. Well, starting the service, let me check. My answer will playbook So AUC's shell. Oops. No hope I should give dark slash, right? Other ways. Still, Scripture doesn't get start. So I love to save this one. We are executing. No. All right now it has been started. And if we go and check for the services Mo P s Ministry of Grip Dhammika, we could see the services running. If we do something undermine into servers, we could still see that it is running. Now. Let me access it from the browser. So, in closing of decisions and take the appear to suffer Major Lennox system on the Trans on port number A Girija. Okay, so we can just take it to a general? Yes, Here's running similar very on with frontal system. So it's training here as well on one lost, sir. What? That is are hit you here. All Surtees, Roman. Okay, So this is how we can convert our shell command. Scinto Answerable playbook. Even you can play on your wound. Shell commands are self scripts to convert into answerable playbook. That is how you can practice and learn and swill quickly. I hope this video helps and see you in the next lecture. Thanks for watching. 30. L30 Ansible tags: Hello, friends. Welcome back in this lecture we are going to talk a voter tax. So usually attacks are useful If you want to segregate only specific tasks from your playbook. So how does it work? We are going to see install Apache. It's pretty pretty dot Wait a minute. So if you open this file, you can see what exactly does it doing? It is installing the hits to TPD on our heads chilled server, then starting the services similar way installing the hedge to TPD on Apache and starting the services, then copying index dot html pile. Okay, so these are the activities we are doing. Okay, let's exhibit this playbook. You can see I'm executing this playbook. And anyway, it's already installed, so it doesn't change anything. It is fast installing packages, then starting Apache and again installing Apache. This is on open toe system on starting Apache two, then copying the files. So these are that ask cities dream. So in my case, what I want to do, I just want to install packages. I don't want to start the service. Okay. Either this task are this tasks should not be executed. In that case, we are going toe Modify our playbook by using tags. Let's take the file. We A installed Apache underscored its duty. Pretty dot way of milk. So here, I'm going to add tax. That sore tax will start something like this. Bags. Okay, I'm giving bad name as it install. Install Apache. Okay, so this is the bag I'm giving to install Apache. Similar were I'm adding here as well because we are installing about you over here. Hurt, so tax, install Apache. Same way I'm going toe. Give one more track for this. This one Here we are. Starting services tags start Apache. Same tag I'm giving for while starting over services. So I have added to kind of tax. One is install Apache and another one needs start Apache. Now, if you come down here, we haven't space for the any Ted. So if you're executive or playbook without the text, then only this particular task executes. If you are using any tag, it won't get executed. Okay, let's save this file. Let's execute this playbook. So if we exit route, it won't canister tax it. Just execute as it is how it was executed earlier. But if you want. Oh, restrict. To execute only specific tasks you can see installing and starting, installing. Starting. So I don't want to start my up a cheap services. I just want to install. Then we can use this one with minus minus. Bags on. Followed by. You were stagnant. So our tag name is to install a party Install Apache. Okay, this is our tag. Great. They're six. Good. No, this time it should not start our heads to D patisseries just toe. It is going to install packages you can see here. Installed packages on install packages. Similarly, I'm districting too, just to start the services. Right. Start Apache. Okay, So start Apache. This is another word. No, it is not going toe install packages directly. It is going to start the Apache. You can see here. So these tasks are executed. That is how tax does work. You can restrict the workplace toe only eggs. Good. If this specific taggers available Hope you understood. How does it work? Thanks for watching and see you in the next lecture. 31. L31 Ignore errors: Hello, folks, Welcome back in this lecture we are going to talk a boat error handling so usually well running, answerable it. Execute all the tasks in the sequence ill. If it find any particular task is failed, it cannot proceed with further tasks. I mean to say, a gym that I am installing heads to DPD on one somewhere on starting the service under. Let's take an example. Installing hits two D Pretty fast, we are installing. It's pretty pretty, starting the service and copying the files. So in this case, installation is successful. Under you are trying to start the service service is failed, then it cannot go for their tasks. Okay, so to overcome this problem, we can use the ignorance. Let's take or what example install Apache hits pretty pretty that way of milk. So our earlier we were using me to the tags. Let me remove the attacks for time being. So let's take this example. First, we are installing hits two deputy on all the systems. Once it is done, we are starting the service. Then we are installing a patch and will dwindle system and are starting up by general blender system on copying the files. Let's exhibit this playbook now. So, Apache playbook, I'm executing. And this time it is going to successful because there is no issues on the motorway. It is already installed under started. Okay, Was testing it so it started. It was not running on the system. So it's running now. What we are going to do is I'm going to my are hit shell server in our head shell server. I'm going to edit my slash udc you d c. It's too deep Beauty con slash s heads to d Pretty dark conference. Okay, so we are reading this one. Andi just adding Elaine testing. Okay, So whenever you add something, if it is not readable by your hits to the pretties or where it is going to fail so let's so this one on DA service hits to the beauty restored. If I do, you can see it is going to fail because I have added some additional lane which were Tomcats are working, aren't able to read. So now if I run the playbook again, you can see here. Installing is fine, but well, starting on our server, it has been failed on 1 48 has been failed after that. If you see these two anyway, it is not testing on this system and copying. Also, it is not working. Let's take an example that even though some tasks are failed, you still would like to continue for the these kind of situations may come because it won't effect if some playbook fails. In those cases, we can use their perimeter called ignore errors. Let's head it over. Answerable playbook. So here what I'm doing is on just adding ignorance. So So what I'm trying to say is ignore errors. Yes. So by default it is No. Now we made does A s. What does it mean that in case this task is not successful on any of the systems, please proceed further. That is the meaning off this. Let's save this one. Let's exhibit it. Oops. So maybe Syntex would be wrong. Yeah. Staple. Okay. Ignored at us and alert. Sexy. Good. Now we can see. Even though it is failing to start the service. Still, it will continue further. You can see here failing, but ignoring okay on 1 40 it is failing to start the service, but still ignoring on for the refuse e. It is tested on this system as well. And it is to start on this system as well on the copying onto this system. Okay, that is how you ignore arrest. There's work if we see previous output. Okay. Here. It was not copying. Fell under deal. It was not testing while installing Apache on Woburn toe. So that is how we can handle our errors. And you can still see it is not showing as a failed because we are ignoring that error. But in the previous output, we could see that it has been failed on the only two tasks. Excluder right. So that is how we can handle our error. Let me set it back. So I'm just removing this lane on the this train. If I executed again, it is not going toe fail. So you know relatives doesn't get executed. Yes, started the service. That's it. So this is how we can use ignore errors. Thanks for watching this video. See you in the next video. 32. L32 Ansible Vault introduction: Hello, folks. Welcome back in this section, we are going to talk about answerable world and supple Walt is the future of answerable that allows you to keep the sense to data such as passwords. Archies in encrypted files are rather than as a plain text in playbooks. Our roles so answerable Walt is one off the future of sensible, which will help us to protect our since two data since student or nothing. But it may be a passwords are keys are some other information which you should not exposed to others. Let's take an example that you would like to connect. We will get her. But while connecting to ever get hub, either you need to provide user name and password are your kids should be positive to enable the password list authentication in these kind of situations. We cannot keep our sense to date of it in the playbook because we may need to share our playbook with others, which will create a problem, Soto or come this kind of problems. We are going to use an spool world. This is one off the future to encrypt our data while using danceable all your wallet command starts with answerable Walter. Well, running our playbooks, we use the answerable playbook rates similar way Walt commands to starts with danceable wall. We help you commands to encrypt our data or decrypt our date of you over data. Let's see, what are those Assume that you are creating a new file on you would like to encrypt our data. Then we can use answerable Walt create. So this will help us to encrypt our data while creating over files. And also please remember that while using answerable world, we need to protect our files with the passwords. We should remember those passwords other ways. Even we cannot able to open those wells. So if you want to create a were filed with the encrypted format, then we can use create option. Next to view view command is to see the data in the encrypted file. So in Abu Step, we have created your file. Now I would like to see their data. Then we should use answerable Walter View. Similar were added. We want to edit the file which we created in the past a step. Then we cannot use the V a r, some other medium to aerated. We should go with the answerable. Walt edit. If you open by cat RV a option it will show as they encrypted format. It looks like you're asking file, then encrypt. Assume that you have created a file, but it has some sense to data. Now, you would like to encrypt that. Well, then we can use the encrypt option. This is to create a file with the encrypted format. This is toe convert Your filing to encrypt apartment next to decrypt decrypt is the option toe convert your file as a normal file which is in the encrypted format. Assume that we have created a file in encrypted format. Now we are not keeping any sense to data. We have updated our playbook. Now there is no sense to data. Then there is no point off keeping it in encrypted format so we can decrypt it even something applicable for the encrypted file. Okay, so these are the so these are the commands which we can use to encrypt on the decrypt, our data using and supple world. Now, if we want to use this encrypted format file while running over answerable playbook, we need toe pass this password. But it won't ask for password directly. We need to use their option called Ask Walt Pass. So this is the option we should use whenever we probably this option. It will prompt for password. If we provide that possibility to take that password under decrypt the file on. We have one more option. That is Walt Password file. So this will be helpful for us to pass the password through your file. We are going to see these two options Solar jumping toe aranzabal server on check it or these comments. So I'm on my answerable server, and I have logged in as a NSAID mean now, I would like to create a file in encrypted format. Then we are going to use here, Commander called Answerable. Walt create. Okay. And school world create is a command to create a new file in encrypted form. It I'm creating your file called. So I'm creating your file called World Past dot William L Let's created. Now. You can see here it is prompting for passwords. I'm giving your password. ABC 123 again seem a B C 123 If file has been opened in encrypted format Now we can write our data. This is encrypted file. Okay, so just I'm giving some data. I wanted Lee giving get type over here so that we can. Commander, did this fail again? Let's say this one on DA. If you see now, there is a file called World Passed that way of milk. Let's hope in this one amusing cat. So if you use cat, you cannot able to see the data way because it is an encrypted format. Now, what is the common we should use toe with their data? That is weird answerable, Walt, have you world past dot Women now you can see it is asking for password A B C 123 on You can see actually later. So this is how we can protect our sense to data. So whoever knows this particular password, only they can ableto view this data. Now. Assume that I want to modify this fell because I have given the type over here in this case , we are going to use and simple world it it. Okay, this is the command followed by ever filing them. So this will help you to a retriever file. Now, this file has been opened in editor. More on. I'm going to change it. So I'm just to replacing my world. I'm just replacing it toe encrypted and save this well, now again if I want to view If I do cat still like an art able to see the data. But we have updated this file, right? So you can see this. Ask you. Value has been changed. Okay, Now let me open this file again by using view command. So again, I could see that data clear. So this is how we can use now. Assume that it doesn't have any since two data. I would like to decrypt this file. Then we can use a command called danceable wall decrypt followed by ever find him. So it asks for password. What is the world password? If you provide that password, it is going to decrypt. Now let me open this file with the cat. I can see the data. Now Assume that again. I have added some possible Let me add some password v a world class boss Word answerable. 123 Now I help kept some sense to data in this file. And if I open this one you can see it is having password and spool. 123 Now, I would like to encrypt this file back then. Answerable world encrypt followed by your child name. Okay, so then again, it asks for password. That is a B C 123 a, B, C. 123 Now again, it has been encrypted. Let me open this file. Now You can see the data is encrypted. No to see and support wall. I love you. Followed by a final. Um, ABC 123 Okay, so this is how they were answerable. Walter does work usually whenever we encrypt any file, that password should be shared with the team because we don't know who is going to use that answerable playbook. So we keep this passwords in a common location where our team get access. Okay, That is how answerable world works. Thanks for watching this video and see you in the next video. 33. L33 Ansible vault with git: Hello, folks. Welcome back In previous lecture we have seen how toe use and school world commands in this lecture we are going to write your answer Bill playbook to use our answerable world. Soto demonstrated better. I'm going toe create a private repository in our get her back on Onda will manage from there. Let's go to get her back on. So this is my good Hubocan. I'm going to create a new repository, Onda reportedly name I'm going to you just to walk And it is a private repositories so that while cloning this repository, we should proper credentials. I mean, it's late in the read me file as well. Creatively! Positively! No, we can clone it by using this option. Get clone under. Let's go here, get Clunes! And if I do this one, it will prompt for user name and password. But if I use this you world in the answerable playbook, I cannot provide the user name and password. That is the reason in the u. R L itself, we can provide the user name and password Soto probably user name and password in the U. Well we can use Okay, use the name Colon password art Every Werlin. Okay, this is the syntax to provide user name and password with the Getty world. So here, over user name is way and killed when killed on password. I have changed my password too and simple. 1234 Time being toe demonstrate this lab. So now on giving user name and password in the u R l And if I clone it, it won't ask for password because it takes from here right now, if I see here there directly called Walt if I go inside, Okay, nothing is there because we just to initialize it. Okay, Now let me create your file over here. Creating a fire and creating your file called index start html because we're going to use it later. Onda Hitch one and Sibal one. Testing can't close it. Which one? Okay, I helped created Find again. If you want to receive updates, get pulled. Okay. So latest objects are going to come over here? Yes. You can see here index dot html is there. All right, so that is how we can clone our repository. Now let's write over and spill playbook to clone the repository. Let me take this one and clear the scream. I'm going to write Theophile called and simple wall to dart. William L Okay, this is my answerable playbook. On the minus. Minus, minus minus. Name and simple playbook to pissed and Sibyl world Okay, under hosts on become true. Actually, it is not necessary. Just I'm giving so that we don't face any permission issues. We're doing something under tasks. Okay, so we need toe balloon Colonia report. Okay, We need to use a model toe. Cloney repository, we have your model called Git. Let's go here, Get more duel in danceable. So if I go to get well here, you can see the parameters under destination is mandatory. Where do you want to clone it on? The reports required. So those two parameters we should provide. So we have few examples over here. You see the example toe download the report it rick it model and follow based on his own. So Okay, so let's go on to do this one. So get model on. We need you report. Right. So we have the repository. This is my repository under dist. Where do you want to copy on these target systems? We would like to copy. I'm on a in a segment, Andre, in this administration. Copy. So, under Ian s admin slash Will pity in Assad mean under this, I'm creating year pissed. Well, okay. We need to do you one directory names so that it creates it this directly on cloned this repository onto this directory. Okay, this is mandatory. So let's say this file on DA if I see here Yes, everything looks good. Sensible playbook minus a hosts earned the world minus minus. Check Just evaluating my playbook. Okay, It looks good. And it is going to close. Let's execute without check. It has been cloned. The replay gently, if you see here. Oops. So what is the part? I have been OK, well, pretty sensible. They have given. Okay, lets currency under or pity sort of suited, slash or pretty difficult to you and said, man Yep. Here, you can see the test the world. OK, Anyway, any location would be friends, but this is another location it created. And if they see, I can see the data similar. Verify Goto's theory. Slash were pretty in this admin. Just world. And you can see the data. Something over here in a sad men under test world. I can see the data. So now what? I'm going to go. I don't want to give the my password over here, because if I give this playbook to everyone, they can understand my get password. Right? So toe encrypted, this one I can encrypt and their coil. But if I encrypt, enter fired, you don't know what tasks you are executing on display. Able to work on this one. If you remember, we have created a file called Walt Passed that way. A millwright Let me open this one. And it's abilities in encrypted format. If you do remember from last class, danceable wall view and possible this ABC 123 So same possibilities available over here. Now, why can't I use this file as my variable file and pass the variable over here so I can replace the this value with the password so that password will be passed from here. So let's try that one on clearing the screen. Re a sensible world Onda here. Instead of using password, I'm going to use the variable so variable starts with floor brackets on past war on close with floated records? No, it is in between are fever content so you don't need to space for double courts. OK? Actually, if it is in the starting off this line, then you should space for under double court. Otherwise it is optional. Clear. So let me the mother double court. I don't need it. If I go here now, I need toe. Are the variable file as well, right? Soto are variable. Fine. That's under square files. Then we should use the variable name that is one pass dart way. And this is over variable friend, let's say this one. And before executing, will remove on that are good systems this particular reportedly other ways It is trying to create the same directory again out of my no sort of Saudi. This is route red pseudo out of minus audio visto Same thing on other systems as well. So let me come out under the movie It it's not there. Even I help came out here. No, nothing is there, right? Let's sexy Good This time I'm passing my answerable password from me encrypted fella. Then we need toe pass that password as well By using osk wall bus. Otherwise what will happen? This playbook is trying to get the variable, but variable file is encrypted and the sensible playbook cannot ableto open that well. So to open that well, we're passing the answerable password. So ask Walter Pass only tasks for password. ABC 123 And it's execute and clone the repository right now if I go and check. Yes, its creator? No, here. Also its creator here also, it's created. Right? So that is how we can do If we don't pass this one, you can just see what will happen. Yep. If you see here attempting to decrypt. But no world secret phone means we are trying to decrypt. Password fell, but we don't help any password. So this is how we can do now what I can do. I can update this Walter past file because somebody tried toe open. They cannot able to see until they know my Walter password. Even I still ableto property that my get credentials in this playbook. So this is how we can use answerable world to encrypt ever data. One last thing we're going to test that is I'm going to keep password in 15 Sorry. The pass, William L. So my wallet possible? It is ABC one poetry and just to saving it. Now, while executing my playbook instead of providing password, I will just to give the password file here. So world password file. Okay, this is how we can pass the file under our file. Name is passed out. Women in this, we have walled password and Walt password. He is used to decrypt Walt passed that way. A metal file. Right. So before executing this one again, I'm going to remove my presto world dot womens. You. Same thing on other two systems. Says Well, so it's not dead. No. Here as well. Right. Let's execute this. No. And I'm not providing password. Password is taking from this past file toe decrypt my wallet Pass. Well, no. Again. If I do your list No, you can see the file seems a little bit around here as well. All right, So this is how we can use and simple Walt in a work playbooks. Thanks for watching this video. See you in the next video. 34. L34 Ansible roles Introduction: Hello Folks will come back in this lecture. We are going to talk about roles. I am unanswerable documentation where they have explained clearly creating reusable playbooks. There are two ways that is including on importing under rules. So we are talking about rules. Let's understand what is roll on way? We should go with rule If we go back to answerable control Nord, we have written multiple playbooks. Okay, this is one off the playbook. You can see how many tasks are there and it will continue to grow for that. If we are enhancing our Apache server same, we will happen even for Tomcat playbook as well. So if you see set up tom care dot Wimal. Where does it? If you see this file, you can see if we continue to enhance this playbook it will be growing further. Whenever it is growing bigger, it will be quite a difficulty manners. You will get confused. Are you lost control? What you are doing on our playbook? To overcome this one, we can split our playbook in two roles. So if we split, it would be very easy to understand They were playbook and also another advantage off using roles are reusability. You can reuse the same task in the other section as well. Are other people can use the world so those are that weren't ages? Let's go and see our answerable definition. What they have given for rules. Well, it is possible to right here playbook in very large files. As I said, we can make it grow. You might start out learning playbooks in this way. Okay, so we have learned same way eventually will want to reuse files under start to organise them in answerable. There are three ways to do this that is including ports hundreds. So we are talking about roles so it rolls are lost more than just tasks. Toby back is we're together on can include variables. Handlers are even models on other plug ins, unlike, includes and import. So we don't use much about includes on imports. So we are going to talk about roles in this training so we can use those by using the encyclical axis so answerable galaxy contains the rules which is pretty friend rules. We can take those rules and we can use. But answerable collects is not scope off this training. So I'm going to talk about rules itself. So here they're more tractable. Toe includes an import. So let's go to rules. Okay? Yep. This is the role space. Okay. Already opened. That's okay. So if you see here, this is role. While creating our role, we will get the stretcher. Please. Remember, roll get the stretcher so you will have your role under role. You have these directories. Those are tasks, handlers, files, templates. We are so defaults. Meta. So let's create a rule in our system as well. So I'm creating a role called our Tomcat. Sorry. Hedge Pretty pretty, because I'm going to convert display book in two year old? No. Okay, so let's create answerable Galaxy unit set up Apache. Okay, set up Apache. This is the role I'm creating. So answerable galaxy. What does it do? It is going to initially Z rule. That role name is set up Apache and it creates their directory structure so that we can easily understand it has been created. See? Here told set up a But she was created on the This is the directory. Let's go inside. Toe this on. You can see multiple directories. I'm going to execute a tree so trees and are very, um, installed tree. So do William installed three? Yes. So let's clear the screen tree for do you can see here you will have you default under that . The reason men fell files files is there, Then handlers under that main file is there met on Main Fail is they read me dot MD asks men Feliz the Templars tests where? Okay, deserter. Default directories. First of defaults, defaults. Nothing but a gym that you are running your danceable playbook on. They were answerable. Playbook requests some imports to execute it. So while running you were rule. You need to provide that information, those variables. But sometimes you may not provide those variables. If you don't, Probert, it takes from the defaults. Okay, that is the hard one day. So that is where defaults come into the picture. Anyway, While using our role, we will understand. Next files so files nothing. But he would like toa copy some files. Well, running this role, for example, we are copying hits to tp sorry index dot html until target system. So now indexed our heads. Tamil. We can keep it under fells next to handlers handlers Nothing. But if you are doing some task okay. If the task is executed then only you want to exude they were next task. So that is where we have installed hates 30 pretty Your face 30 beauty is installed. Then only start the services. If it is not executed, don't to do that one. Those handlers, we are going to keep it under this location Didn't matter. It is kind of meta data. We don't use this. Read me aboard the information off your rule next door tasks. This is the actually important one. Onder. This is the mandatory directory for a world you can remove. All these birther tasks must be exist. So here we are going to keep all our tasks. Installing history pretty on how you can copy a file. All this information we are going to do then templates Templars. Nothing. But you need to copy some conflagration fells until target systems under depends upon target system unit toe copies specific file. Okay. In those case, we are going to use template, template and files. Both are similar, but file it will copy as it is. But a template even you can use variables in the file. Onda. According to the target system, these templates are copied onto a target system. Next door tests how you can test it just to test whether you're role is working fine art, not by using some testing. When 300 Test Way A mill next to ours. Huge relieve variables weaken. Store it over here. Where's 100 defaults? Looks similar, but defaults if you don't speak, sway any variability to take this value. But if you're defend, where's already? Then it is going to ignore their default. That is all about how roles get created on the Let's Go and see the definitions off this one. You can see tasks contained. A mainly stop tasks to be executor. Payroll and handlers contain handlers, which may be used by this rule are even whenever outside off the rule. So defaults defaults variable. For this role, we are other variables for this role. Files contains the files which can be deployed. Wear this role. Templars contained templates which can be deployed where this rule okay matter different. Some meta data for this role. So this is how it works. So I'm stopping over here in next lecture. We are going to see how can we can what our answerable playbook in two year old 35. L35 Use notify, handlers and vars in httpd: Hello. Folks will come back in this lecture. We are going to update about Apache. It's pretty pretty that way. Milk? Well, we will add additional tasks, Onder. We'll see how we can used it for the rules. For that, I'm copying this file into my set up miners Apache dot William L I'm creating a new file called Set Up a Budget That William L So that's copy it. And we are going toe edit this friend. So foster thing is, we are installing packages, right? So while installing if we are installing, then only we want to start our Apache service for that. If we remember, we have usually a statement called Notify under Handler. So we are going to use that option over here Now. Here we are, going toe hard. Notify start. Apache. Okay, So this is the notification, and this is the handler. Okay, Now I can art handler over here. So, handler, handlers, So start up at you. So But if we keep my handler over here, there is a problem because all these tasks are considered under handler and it won't get exude. That is the reason always. Please keep your handler. Are the end of the file. If you want to check, just let me say this well, and if I execute and simple playbook minus a hosts. Okay, so if we do hit 30 beauty minus manus check. So I'm just checking it out so you can just to see what will happen. So it is installing hits 30 beauty under handler section and start up at you. Okay, Remaining all tasks. It is going to ignore it. Okay, We are not expecting that one. Let's go on. There Did it. So we need to keep this one or the end. So let me copy this one on the core and after file on Goto in certain more find a copy. Were Clinton so I'm just copying it out. Now let's go on to remove this one. This is no more needed, so let's delete it. Okay, so now here. Also, we need handler because we are installing his to the police service. So notify Start a a She too. Okay. And this should commander toe handler, let me copy it out. I go to end of the line. Ana again. Copy. So just copy it. That's it. So we have handling the handlers. So let's remove this one. This is an honored. Okay, so this is how we can change our file. So if you do remember, we have already done this one sometime back. So we are first installing there. Hedged Pretty pretty. If it is installing, then start the service. But you're going hear Similar. Very. We are installing its 30 pretty young woman to start the salaries. So now well executed because we have removed it in our previous lecture and Sibu playbook minus a hosts set up Apache rate. So Apache, Dr William Minus minutes check. So let's check out it. All records working perfectly, then install. It seems there is some issue or not. Hey, chill server. Let me go and check it out. So this is our hit. You service hedged 30 beauty status. It's failed because of some permission issue because it is accessing port number. Exaggerate too. Or the network level, which is not enabled. Orto rthe always network level to fix it quick and just going to reinstall it. I was trying to change some other configuration on this server. Let me re install hits 30 beauty. Um remove its to TPD. Yes, I would like to remove it on the suit is close. It's pretty really gone. Here we have. Okay. Martin Minnesota. Because these are not working properly. So what? A Minnesota. So let me reinstall it. Um, store hits to tpp extra to purity. Yes, I would like to install. Okay. Surgeries installed. Okay. Sorry. Sort of is actually beauty stock. Okay, this time it has been started. Okay, It's running cool. No, What we are going to do is we will access this one from the browser. No, we are going to access this one from the broads at large stake. Ter r hitch Ill sir. Very Worrell. So what is running then? So Oneto, then open toe all thirties running, then on Major Lennox. Okay, here also it is running. So now if you see it is running on port number eight Jiro eijiro. Nothing but you don't proverb by default to taxes from the port number 80. But I would like to run it on port number age a great one for that we need to update our configuration. So here, if you see the reason more slash CTC heads to t beauty corn. It's pretty pretty dark con fell. If you see here in this there is the option called Listen rate in. Listen, it is listening on Port number 80. Similar way for you. Open here also slash CTC. It's 30 beauty corn. It's pretty pretty darn confident. You can see. Listen, Port number 80. So it is listening on port number rated similar way. If we go here in this location Serie slash E T C. Apache two in this. We have your file called reports Dark con. In this, we have yet listen. Option that is port number 80. So it's listening on port number rating. Now we want to update this one with the port number. Regenerate one For that, we need to update a principal playbook. So set up, Apache dot William L. So if you scroll down, Okay? Yes. So So for that, what I'm going to do, I'm going to search for the more deal for that. And simple more deal, too. Toe update, year plane. So we are just searching for a data file. Pile module earned lane in file. This is what I'm looking So lining file. If you go So this will help us to replace some of the characters and the desert. The parameters on the party's required anyway. If you scroll down for examples, you can see here this is one off the example to replace enforcing its silly next. So, similarly, if you scroll down, you can see here insure the default Apache port number is eijiro 80 So this is what we need . But in stuff a Girija graduate when we are goingto change it on the line in file So what is the part parties? Classy to see his to depict con. It's pretty pretty dark on regular expression. So it looks for this particular regular expression. Listen, so it will go to the target system On the looks we're Listen Yes, here we have listened. So now it is going to remove that one on insert after it removes this lane and insert after this one hash, Listen, nothing. But here are Balinese hash reason. After this one, it is going to insert what it is going to insert. Listen, port number exaggerate one. So it removes dry and their land which starts with the reason under replaced with this land . Okay, that is what we are expecting. Let's copy this one on. Go here. Copy it. So I just need toe object alignment. This is here, so I'm changing it to it. Generate one same over here. So it generate one. And it works only for redheads are worth right, because for Ruben, duties again differ. So I'm just mentioning it as it when answerable ways families so on. So Okay, that is one thing. Another thing is, whenever we update any configuration file, we should restart our services. So to restart again, I'm going to use the notified. So notify on the restored Apache. So now I'm not saying it this I need toe again. Handle it right. So goto under handlers. So here, minus name restart up. But you turned same thing. Okay, Service model we're going to use then name hits. 30 beauty. I understood. Restarted state restarted. So we are going to restart whenever we update our conflagration. Same thing will applicable for woman toe also So for woman also, I'm going to write it minus name in short order default Port number is 8081 on open toe. Okay, then lane in file. It is same next part. So parties. Here it is. Ah, Peter Blue this class it easy. Apache slash Filename is poor to dot com. So this is the file next to a regular expression. Same thing. Listen, next, insert after So where we need to insert this one? If I goto this file, I need to insert after this land rich so I can copy and their land. So here I want to insert it. Then what is the line we want to insert? Listen on Port number Ridge rates 81 earned the den when it should exude win. What sensible ways? Families, Davian. Okay, then again, nor defray the restart. Apache two. I'm just giving too, so that it would be easy. And I can handle this one over here. So let me copy this one. So to handle toe handle minus name so minus named this one earned, uh, sort of ease next to name Apache Two right for this one. Then Stuart restarted Ducks it. And we don't need to space for the win condition over here because it is going to execute when you say this one. Okay. So we can ignore this one even here as well. Okay, that's all for this one. There. Say this file on. Let me open it once again. So what I'm going to do first, I'm going toe installed. It's pretty pretty, Andi. I will not way it under Install Apache two, then copying the well next and shoulder. This port has been replaced with toe age. A great one. It seemed a little here. Here also. Age rate one. Whenever ways from looky so all looks good for me. Let's test to this one. And simple playbook minus a hosts. Set up Apache dot William illiterate. Minus minus. Check. We are just validating it. Okay, you can see here installation is skipping. But whenever we are updating the port number, it is changing. Whenever it is changing, it is going to restore the Apache. But you cannot see that starting the Apache is not there. Okay, so let's execute this playbook. No. Once we have executed, we could see that our Apache is running on port number 8081 in strap aged 80. So copying on changing the port number. Okay. In our hitch ill. Yes, there is a problem way because we need to enable at network level. So I'm skipping that Hegel for time being because it is more like ways related issue. So let's go on to refresh our pace. No, you can see it won't work on port number 80. Even this one. Also, even this one as well. Okay, so nothing is working on port number 80 among this 11 nineties Arctic chill. Any we are. It still doesn't work. So I'm not testing on this one, but here, I'm going to test it out. Jiro 800. Okay, one last thing. We need to enable this one in our security group level, so let's go on. Check it out. So, in born, I'm just updating it. So adding your so a general 81 to a Children under and adding around the 10 ports. Exaggerate. Want to a Jeremiah and zero because we are going toe testing. Furthermore, so I have sailed it. So let me executed. No. Yes, it is running on age rate one. Now we might see a 081 This also it's working right. But in our hey chill, it won't work because it's not restarted. We need to do or the network level some configuration. So I'm just going to ignore this one. No one last thing we are going to do that is again I'm editing. Set up my patchy Dr William. If you see here, if I want to change port number 8081 to a Jew 82 or some other report again, I need to edit all these locations instead off that one. What I'm going to do, I'm going to use a variable variable called poor. Today I will decide which port I should use. So I'm adding here, variable here we arts. So where variable name is Poor Colin Eijiro eight. So I'm replacing Aggerated also here. I should come down, so let me give the spaces over here. So here, instruct this one. I'm going to use port, so let me copy this one. So something I'm goingto do over here as well. So just put scenting over here. Single What? Here. Port. Okay, so this is how we can replace you to Let's say this one on before exuding. I will just to show you that, whether it is more deferred or not through our earlier playbook, so you can see Yes. Listen. Port number regenerate one Even if we do that capped off this one, you can see that age rate one. Now, if I execute this playbook again this time it should change it to the aggerated toe. OK, so let's execute this one. And whenever it changes, it is going toe. Restart the service. Okay? I don't want to reload. You can see here reach and into a generator to and it is also handling the restart, Apache. Anyway, our agility is not working on If we check it again this time, Aggerated to it would be there. So listen. Yes, Aggerated toe. Same thing over here. It planning on age rated toe. If I repress the spaces No, it won't work because they generate when it is not working. Let's change it. Sewage Aerated toe. Yes, seven thing over here, if it is fresh, doesn't work. So ifwe do energy right to it works. Okay, so that is how we can write our answerable playbook. And if you see how big it is? No sort of. So you feel see how big it is? No. So it is too big. Okay, now it is not good door live like this. That is the reason we are going to use and simple rules. Okay, We'll see answerable rules in our next lecture. Thanks for watching. See you there. 36. L36 Ansible roles Lab: Hello. Folks will come back in this lecture. We are going to see how can we convert our answerable playbook in two year old frustrating ? Why should we need to convert? Our hands will play broken Dear old. The thing is, if you're continue to write your answer will playbook with multiple tasks. After some period of time, it will be start creating your confusion. If we take our playbook itself, I'm just opening with more. We have added multiple tasks where we are installing Apache 100 hurt as well as on Debian and also copying index dot html file Chaining people port number on the ensuring that services are started are re starter whenever there are changes. So these are the tasks we are doing with a single playbook on. If it is continued to grow, we can start getting confusion. To overcome this problem. We can split our tasks in tow. Different folders depends upon the kind of activity Where does it to do on? We can manage it very easily. That is wanting. Second thing is the measure would want is with the rule is reusability. Currently we are writing ants Will playbook to install Apache hits 30 beauty a gym that you want to do the same task for some other project. Now you don't need to write again year additional playbook, our role for the same tasks. You can use the existing one. So that is the measure. At one days off, using rules. If we do remember, we have created a role called Set up Apache. Initially when we were tasting Now we are going to convert the sensible playbook in two year old. Okay, so do that one. I'm going toe open. One more station for answerable Master north. I mean to say control north. Let me log in as a in this admin on the CD slash were pretty danceable and clear the screen . So if you see unless ongoing insert of my role and ah here three. Doctor, if I do it is going to display the content in the streets. Stretcher! Here we have multiple folders that is, defaults files, handlers Meta read me tasks, templates, tests wears so will convert our answerable playbook into this one on Also, if you see the naming conventions, it is quite generous. So defaults nothing but it Contents, default values handlers Nothing but we can keep handlers over here. Meta meta data read me Information award. This role tasks nothing, but we're going to keep tasks over here. Templates. If we have templates and we want to copy according to the target system behavior, we can keep those wells under Templars tests. We can keep testing wintry under test way Mel file on. We contest it, then perhaps if you have variables, we can keep it over here on by Mr Felt. So if you would like to copy some files under target system, we can keep under files. So this is the structure. And also, if you see our playbook, our playbook also contents some off this information. Okay, we'll copy our answerable playbook will copy that your data into our and spittle. So if you see here, hosts become all this stuff. You can just leave it for time being under next parameter trees. There's nothing, but we need to use this variable. So if I go here, we have your direct recalled. There's so under this one, we should copy. Let's edited that main dot women. So under this one, we should keep our variables. So I'm copying available port eijiro eight to let it be no go back. So we helped carpet over. Where's next? Thing is tasks. So these are the tasks. We should copy it These tasks into task section while copying. We should not copy this header. We just need to copy all these tasks. So let's copy these. I'm copying first of three tasks, then demanding I will copy. So v a next one is tasks, man that way and milk time to be held to motor tasks. So let's go down. Yeah, so here you can see the alignment. These tasks starts from each task starts from the starting because we don't have any header section. So it should be like that. So it a weird So some of this index setters, right? So we have corporate tasks. Next thing we need to copy and Dick started statement. So you next artist email file is available under slash Reprehensible. We should copy this one on trial section. So let's copy that one cp slash were pretty answerable. Index start. It's too normal. Find So I have copied this file under files. Next comes to the headers. Sorry, handlers. So we need to copy all these handlers under handler section. So let's go here. Onda v. A handless main doctor way and copying here. So that's it. Let's say this phone. So we are using their tasks files on the handlers. We have splitter our answerable playbook into this one. No one last thing I'm going to do is I may or may not send my variables. That is the reason, in case if I miss it to send my variables, I need to give some default value. That is where you can update their defaults in case you were playbook. Need some information, but But if you don't provide that information, it is going to take from the defaults. In our case, we're using a variable called port, So I'm passing that one through the variables. If I am not passing that value through variables, then take the default values. So I'm going to defend our default value like defaults main that way and then so going to insert more port. So, in case if you are not providing your variable, then use the default port number as a gauge 00 Let's save this one. That's its or total. We are using five directories on DWI don't require the matter on removing this one on Also , templates. We don't help on the tests. Usually we never used tests. I'm removing all this stuff. Near rule tasks is mandatory remaining. All directories are optional. So that's all I can say. We have created it appropriately. You can see here Diesel are anyway updated. But under Felts, we have index dot hates him. But now our role is ready. But how can we Eggs Good to roll. There is no new way. You just need to create. You're answerable playbook in the playbook. We should call the role. That is the only thing we should do. So let's go back and I'm going to object the same playbook that he set up Apache that women before upgrading. Let me take the backup CP. I'm just going Tokyo. Understand? Back up. Now we'll edit this one. So same find. What we need to do is we just need to remove all the content except 1st 3 lanes. Oops. Okay, So this is the find What? We are doing this playbook install. It's too deep beauty. Then how it can install. I'm not going to write our playbook again. We just need to call rules toe collier role. We just need to give the rules on follower by They were rolling. What is our role in? I'm just going to get it from here. Set up up at you. That's it. You have created your role quite simple. Right before executing. Let me open it. So this is the one. No. Before exhibiting, we are goingto uninstall our heads to D pretty from all these systems. So this is my are hit. She'll server on the Imagine Lennox, Then we're goingto so. We are going toe uninstalled it aren't. If you do remember in our Hey chill. It was failing. So we should disable the Cecilia next for that Clark's Lassie. Dizzy? Yes, healer. Next. So a ceiling x Under this one, we have a conflict fell here we have your option called the ceiling. Next by default. This value is in enforcing. We change it so desirable. Once disabled, we should executive set enforcing Jiro so that it will work now My articles are always working friend. So there is no issue. Now let's go back and ah, uninstall over hits pretty beauty. So we have already written The sensible playbook. Great, So danceable and simple. Playbook minus a hosts. Uninstall hits to T pretty, but it's stopped Services on Arctic Chill distributions. Funding uninstalled on our hit You similar We're stopping Apache. Two on gun installed. Cool. Now let's execute our answerable role. This is the file read. Clear the screen. Answerable playbook. Communities as it is, hosts burned our playbook named minus minus. Check. First time validating it. Make sure that our playbook is fine, so it is not installed, so it is going to install it. Copying friend. It is already dead, right? So it won't copy. And if you see here, it is trying to check for the hits treaty. Pd dot com For Berta. We have removed our conflagration rate so it doesn't work. No, let's eggs eagled this one without check. Know what will happen. It is going toe install hates pretty beauty. So before installing, let me check the services Heads 30 beauty and it is not running on the paycheck salmon. Amazingly, knicks, if you're also it is not running. If I goto, this is woman persistent, right, So Apache. So here also it is not running so I'm currently under slash CDC Apache In this location your file called Port Start count Filegate creates here The port number Get updates Now I'm going to access my sorrows from the browsers. So once the installations are successful on the start of services, we could able to access our applications from the browser. So let's go back first time taking our hitch Ill server today public DNS on port number is a 082 Right. That is the one we are passing through Variable Then our mission Lennix I'm taking so I generate to toe here also it is not running. Okay are Hey Charles, It is not turning here. All city is not running. Let's go on the access from Ruben toe. Yeah, here also It is not one Knoller's executed. So I'm going going toe My answer schoolmaster system that's executed once it is executed, our hit city police are We should run on port number exaggerated But the default one is a dear it We are changing through our answerable playbook. On the first, it is installing packages under unopened. Also it's installed copying and extra dates Tamil In previous lecture we have already done that one. So it is not copying this time. And it is changing the port number two a generator to starting the Soviets and port number has been changed. Right? So restarting the services. Now let's go and check it out. You can see it is running here. Old Citi's running him under here on it. So it is around them. Okay. Now, if we see the port number, it should be changed to 808 earlier. It is age irritably. No. Yeah. Here it is, accessible from this system. Let Mary Presto. Yes. Here also playing. And here also, friend. Okay, cool. Right now to test it for that. What I'm going to lose. I will disable the port number from the first file. Nothing. But I don't past available name. Whenever you don't pass variable name it. Go and check for the variable in their defaults on whatever value is did that Well, it is going to take. So you know what situation the default value is page original. Right now I'm going to edit my worse main dot women. I'm just commenting. You taught my my variable value. So now it should go undertake there. Default port number. So let's six if you didn't know. So this time it won't install it. But it's sub theta con figuration. So that is the reason you should restart us service. You can see here it is not starting the service this time it is restarting on port number is changing to a juror Zero. Okay, it's completed. Now if I go and check for the port number can ticket over here. UTC. It's pretty pretty con hits to TPD dot com Only you can just grab for listen. So here the port number Get up. There's it is a bitter with a juror Jiro Same thing you ever do over here. You can see this empty. And here also it should be They're Gero Gero because it looks the default one. And if I refresh this one, it won't work because now it is running on port number Algeria General, let me chew And you tour Gerard zero. Yes, here also is very fresh. It won't work. I'll change toe Gero Gero. Same case over here. So this is how we can probably the default values. Well, turning your rules. No one last check I'm doing that is I'm going to pass my variables through extroverts so minus minus extra. That support is he called eijiro Double eight. I'm given. So if I give this one, this will have the highest priority. I will go on to enable the farce as well. Even though you enable Wears Are you few? How? Deports Nothing will be taken if you probably were. Variable through answerable command line. Karwell running. You're answerable. Playbook can No, you can see it. Let's change it. Toe zero. Double it on. Defy you open this file for Gerald of late Send thing over here earned same thing over here as well. Now it won't work on port number Age range zero. We should change it to the agent or double eight. All right, so that is how we can use our danceable rules. So this is one off the example. It is up to your requirement. How can you write your aunt's Bootle? But this is the procedure, so it is quite simple. You need to divide and split your tasks According to the folders, whatever is available, that's it on the answerable can able to do all this stuff you can see here. It is running the set up Apache, right? So it knows that where I can get what that is, how it is designed their son for this lecture, un deceiving the next lecture. 37. L37 Push playbooks onto git: Hello, folks. Welcome back in this lecture we are going to see how can we push our answerable playbooks on to get Herb repository? The question is, if I am your develops in in here, should I need to learn all the git commands are doing really work with the gate For this question, my answer would be mostly is because most of the develops in it there don't rate application court. But still we are going to write. Some scripts are playbooks to automate our develops flow. It could be a Jenkins. Files are self, scripts are answerable, playbooks are darker files. All this we are going to write as your files on what will happen if the system were you kept all these files. His character. You last You were data, right? Soto overcome this problem. We obviously going toe push our court into the get hub repository so that it is quite easy to retreat on. Also, you may not be a single person in ever team, right? Few other people also want to use it where playbooks are. You might be working with others to doll up some scripts. In those cases, you need to collaborate with them also. So you should How your knowledge off, how to push your court are poorly record under ability, work or Alistair. So in my case, I just thought that it would be an added I'd want is now. I would like to share all this playbooks with you because I assumed that you were going to use this one. Now what is the source? That is where I'm going to push this court into the get hub repository so that you can use it. So the minister, it this one. I'm going to create a new repository and I will push this court on. I'm going to share this repository information with you so you can access my playbooks for that one. Let me log into my get herb repository. This is my good Hubocan. I help Hi repositories. I can go and create a new repository. I'm naming it does here and spool for answerable for big nuts. And it is a public repository and create a repository. Now I would like to push my court over here toe push my court. So these are the steps I should follow. Let me increase foreign Saiz. So these are the steps I should follow toe push my court until this repository I can create read nipple It is optional. But having read me file is always better option. So I will create a read me file. Now we have you an extra file that is really felt. Go back. Initial ese were repository. Whenever you do this one, it is going to create a local report. So I'm creating a repository and get add. Read me whenever you do, only read me file is going to get out. But in my case, I want to add all these playbooks. So then what we can do? Get our dart? Nothing but in current directory whatever files are there, please add all those files. Okay, so I have ordered Now I can see the get status. Okay. These all files has been added toe my local repository so far it is in local repository Now I'm committing into my local repository. Get commit minus him instead of first commit, I'm going toe Give it as here and symbol for answerable for beginners. I need to provide my user name and password because it is needed for identities. User email I'm giving It does here then similarly, my name that is get conflict global user Dr Name? Yeah Shankar Now I can commit it Alright now I how committed into local repository are earlier guitar to add those into stays ing Onda keep committees to commit into the local repository Once it is committed into local repository I need to push it into remote repository toe Push it into remote repository I need to tell that what is my remote repository? That is where I'm going to use this one. This will tell you that Go into this Get hub Repository I have other my remote repository Now I need to push this Get push Our isn't master so I'm pushing my changes So now I'm your known person, right? How it will Arlotto push it into that one? Where is the authentication model? That is the reason it is asking So my user name is my ankles On the password I'm providing So once you have given the successful password you can ableto push a work order in tow. They were repository Let me go here on the Refresh it Now you can see all our court is available so please use this playbooks to practice on. Do you can write your wound? Playbooks are If you want to enhance these playbooks. Please do that when I will validate earned martyr Those requests their cell for this lecture on See you in the next lecture. 38. L39 Conclusion: Congratulations. If you are watching this video, it means that you have successfully completed and school for. They've also beginner sound system admin scores. I strongly believe that you have injured this learning journey with me. If you're still how any citations are questions, please reach out to us through Mrs our comments on we also available in Facebook and YouTube. You can reach out to us through these Miriam's. I listened to this. We have some exiting offers on our latest two courses. You can find those details in the bonus lecture. Please do check out. Thank you so much to joining with others in this course. Happy learning.