Fabric and Ansible - A beautiful marriage | Dániel Ernő Szabó | Skillshare

Fabric and Ansible - A beautiful marriage

Dániel Ernő Szabó, Pythonista in the making

Fabric and Ansible - A beautiful marriage

Dániel Ernő Szabó, Pythonista in the making

Play Speed
  • 0.5x
  • 1x (Normal)
  • 1.25x
  • 1.5x
  • 2x
21 Lessons (3h 14m)
    • 1. Fabric & Ansible Introduction

      1:48
    • 2. Fabric & Ansible Environment Setup

      9:46
    • 3. Fabric & Ansible Hello World

      6:58
    • 4. Fabric & Ansible Sudo

      13:16
    • 5. Fabric & Ansible Functions

      6:48
    • 6. Fabric & Ansible File movement

      11:40
    • 7. Fabric & Ansible Group vs Connection

      6:22
    • 8. Fabric & Ansible proxy jump

      6:34
    • 9. Fabric & Ansible Threading

      5:41
    • 10. Fabric & Ansible fabfile vs argparse

      14:32
    • 11. Fabric & Ansible Build Python Source

      14:16
    • 12. Fabric & Ansible Ansible Config

      4:14
    • 13. Fabric & Ansible App Update or Deploy

      7:34
    • 14. Fabric & Ansible Ansible Authentication

      9:53
    • 15. Fabric & Ansible Playbooks and Roles

      16:48
    • 16. Fabric & Ansible Proxy

      10:25
    • 17. Fabric @ Ansible Proxy 2

      11:39
    • 18. Faabric & Ansible Windows User

      15:34
    • 19. Fabric & Ansible Ios Login Motd

      11:55
    • 20. Fabric & Ansible Ios Tshoot

      6:44
    • 21. Fabric & Ansible The End

      1:46
  • --
  • Beginner level
  • Intermediate level
  • Advanced level
  • All levels
  • Beg/Int level
  • Int/Adv level

Community Generated

The level is determined by a majority opinion of students who have reviewed this class. The teacher's recommendation is shown until at least 5 student responses are collected.

4

Students

--

Projects

About This Class

Welcome to my course on Fabric and Ansible. This course teaches you about the fundations of Fabric and Ansible, gets you up to speed about these  technologies. Shows you how to configure public key authentication, winrm basic authentication, cisco ios authentication. It will serve as a solid background to overcome any automation task on these platforms. Join the DevOps community.

Meet Your Teacher

Teacher Profile Image

Dániel Ernő Szabó

Pythonista in the making

Teacher

Hello, I'm Dániel Ernő.

I currently work as a devops engineer. I have several years of experience with various platforms and I'm here to teach some advanced techniques which may attribute your job security ;)

Cheers,

Daniel

See full profile

Class Ratings

Expectations Met?
  • Exceeded!
    0%
  • Yes
    0%
  • Somewhat
    0%
  • Not really
    0%
Reviews Archive

In October 2018, we updated our review system to improve the way we collect feedback. Below are the reviews written before that update.

Your creative journey starts here.

  • Unlimited access to every class
  • Supportive online creative community
  • Learn offline with Skillshare’s app

Why Join Skillshare?

Take award-winning Skillshare Original Classes

Each class has short lessons, hands-on projects

Your membership supports Skillshare teachers

Learn From Anywhere

Take classes on the go with the Skillshare app. Stream or download to watch on the plane, the subway, or wherever you learn best.

phone

Transcripts

1. Fabric & Ansible Introduction: Hello there. And welcome to a course on fabric and uncivil discourse is going to teach you Ah, very good foundation to use these tools to ultimate your line looks and windows machines and even that devices which are each above for you. So fabric is up Item on your which is supported Ah, on fight on three and point of 2.7 upwards. And ah, it is basically on obstruction layer above the involved module which is like a CLI or task automation. Will your and the Perama coma your which is the network automation? Will you and ah answerable is something really popular nowadays because off its simplicities to set up and it's ah, that's a pretty decent implementation that allows you to automate easily. Remote machines and discourses also supported. We are get up repository, which you may be family are with from older courses. This way, I like toe. Let's a dream force that I say what I want that to say and I provide pictures and scrapes and what not? So if you have, like what I'm understanding what I'm saying, you will likely find the answer to the questions that might rise in this git repository, but you are also free to being me whenever you feel like regarding the scores or anything, as spite on or develops related, see in my next video. 2. Fabric & Ansible Environment Setup: Hello there and welcome to the environment. So tough video in the studio. I'm going to show you three things. The 1st 1 is the installation of the fabric manure. Second is the installation off answerable on our management server. And the 3rd 1 is the user creation and setting up the public key authentication. So let's jump right to it. Oh, my laptop. I have seen down the git repository and here I'm going to create a virtual environment and that's call it FAP. So after it is created, it is going to let me install the fabric manure separated from my additional packages which are not inside this virtual environments. So let's activate it on the line of systems. This is how you activate it. You just start the source in front of it. So now what we need to do, Mr Peeping Star Fabric and it is going to use the cash version from the paper because this module is already installed on my main packages and ah, it is not going to go out. And that loaded this is going to provide us with a new command which is called fab. They Swept Woman is looking for a fat five. This is how it is written. And this should be in the same directory as the common is executed. And basically it allows you to define fabric tasks. Ah, and call them from the common line. And now this concludes the fabric set up. Oh boy, why did I close? My calls are emulator Mary started. So now we are ready to install answerable. So I ssh into my cento us machine on why is it not working? Be on the show D u I activating connection? Why was it not activated? Oh, I think I know why. Because I forgot to a neighbor tautological activated of startup that I'm going to fix it. So now what? We can ensure the do is to Siddle am in star EPO really is. This is what holds the repository from which you can install Answer Go and that's wait for it. Cool. Very cool. Now, after it was installed, we are going to create the user fabric and configured s a stage both on my machine and on the remote machines to use the public a authentication and we will just simply security. So in order toe new user. What we I need to do is use the user at command, but let's change to root. So user, add fabric, bus, word, fabric and the password. But passivity and fabric fabric is going to be the password. Now, what I can and should do is to go ahead and see if my ssh said things under the ssh de conflict file are appropriate. So we need to come and this one out. So if I didn't comment it out and I wanted to copy the ssh key to this system locally, then it would not be possible because only pass world publicly authentication is the neighborhood. So now let's system CTO Let's start sht and change to the fabric user. So now we can use the ssh key Jim, and the type is rs say the length is 2048 and we don't need a pass phrase for that. This means that the ssh folder here has our idea rests a idea of stay pub and know most. So now I can copy this idea to the local host and you was the fabric Bufford. And if ssh into local host, you will see that it lets me go in now we have, ah, corporate it successfully here. But what we should do is to go ahead. Logan. We're doing a sippy to the center s A and modify my ssh configuration file to use these public keeper. And he was the fabric fabric and it's not cento us say just sent us. Okay, now we are in. We can go to That's the Sitch folder And just simply move the old ones here to the backup folder, copy down these ones and edit my configuration file. So this configuration Fei says that I go to any host. I use the report by user with the identity that I have just backed up. So now since I cope it down to this location the fabrics public and private keeper, I just need toe modify the user. And that way I should be able to look in to the center s machine. Now, as a sage sent the West, we accept that husky and we are in without passwords. So this is good. What we need to do now is to no ahead to our even to system and play this game once again. So here we are, going to issue basically the same commands. But let me just Uh huh. Let's increase the phone size. Okay, so now you can see it better. So sudo so use around fabric. Brassard fabric fabric. Great. Now what I need to do is to go to my Santo s machine with the fabric user and s a sage. Copy I d you pronto? Yes, Fabric and SSE Cuban toe. Great. Now what we can and should do is to play this for the fedora. So on fedora, I also have my own user. I look in adjusted them an asset things just a little bit for like, 21 and go ahead and pseudo so. User Odd fabric and bustard fabric, fabric fabric. Great. Now let's go back to our Centaurus machine and looking to the federal. But before death, copy the I d. Okay, and then we should be able to log in to the federal system. And basically, that was all. There are some configuration steps missing from the Answer bill part, but we will get back to it once the fabric parties. Let's say completed. See you in the hello World video for fabric 3. Fabric & Ansible Hello World: hello, doubt. And why come to the Hollywood video in this video? The time has come for us to start doing something, meaning for which discourse is all about. And as every course starts with, this is going to start to the hello world as well. So the first thing that I would like to show you is that how you can run a command against the remote machine? So in order to do that, we need to import from the fabric module is big enough. Well, maybe this great the connection class. So connection classes is basically a class that defines connection perimeters. It has different values, and there are values that you can specify. So by default to the connection class is going to read your ssh conflict five. And, for example, my ssh conflict filed grab. It looks like this. Well, so any house that I go to uses the fabric user name and the Identity Fi, which is good enough in our case now, what we need to do is to create area about which is C and we define our connection. Plus, so this connection class has multiple arguments. You could give it. You should first give it the host, then. If you have a user other than what specified in your assistance configuration file and you are not using their sausage configuration for a little, then you could define that user or no. Yeah. So for now, this should be enough. So we would like to go to the center s machine and we would like to collect the result of the sea that run and what should be. We should execute the Ket Broth issue and let's just save it and go ahead, navigate their scripts folder and execute the hello world that B y. So if everything is going wow worth Oh, we don't have on then at sea Red hat Greeley's Well, this is working. So what you're so here is that we have the center s line X in the file that we just read with the kept comin. And what about this result? Very Eva. So if issued the dir command, which is a very handed Kelman to use on the result, we should see the following on the author Put As you can see, this is basically ah result object which has different properties that you can refer to end . One of the interesting parameters that are relevant for us is the STD are and the STD out and we also the there. But that's not really a something that we're going to talk about. So what happens if we printed the result here? What do you think? Paused the video or try it out? So if you print the result, you will see two times what was the result? First, when the Commander Hans, and then when the result is printed and in the results, you will see the STD out. And if there are any adults yesterday are okay now. There is an interesting argument to this run, which is called Hold on Cold Hide, So hide his by default fourth. But if you specify the true, it is not going to omit any output. When you execute this part, as you can see now, we only see what the result variable holds. Not when the execution there is another interesting argument or useful argument. So let's leave it here. Had it was true and that one he is the warn. And if you specify on the worn true than what we will see here is the following, we should issue a command which we expect the fair. So the broke issue is going to something like that. So if we execute this now, you will see that this warning was presented that there is no such file or directory. And ah, this is ah different than not specifying the warn. It was true because that will result in an exception which is involved to buy a bed, common exit code. And ah, if you want to check if the file exists, for example on the remote system So let's restructure it. Does it exist? See, Ron, and let's just say test bash f and what we can do now is to refer to does it exist failing ? We print that the fire is not now. Otherwise we print that the five is there. Now let's go ahead and run this once again. As you can see, we don't see an exception, but we see that the fight is not there and we could add this hide argument. And that way we have perfectly cleaned up our old boot. If you don't print this result Walla. So that was what I wanted to show you in this hello video. See 4. Fabric & Ansible Sudo: Hello there. And welcome back in this video, we are going to talk about how you can handle situations when you need to use a pseudo prompt. So to install the package to modify the content off a fire which require sudo access and so on and so forth. So the first and most trivial example would be the following. So from the fabric, we would like to import the connection and we create our connection against our sent the West Machine. And we would like to have the result off the sea that run sido yum in stock. No, no, that's why. And ah, you will see what kind off the problem with this is. So if you're on this example, it says that it was a bad command exit code. So technically it ah, it expected us to provide a pseudo password. So if you want to utilize this way, the scripts What you need to do is to make sure that you have passed for less sudo access on your remote system or wait for the next two scripts which will provide a work around for this situation. So first, let's ah passage into our center s machine we would like toe and it the at sea pseudo ass. Fine. And whoa! Sorry. So Sodo so Reaper five on It's not going to work. Okay, so now what I would like to do is toe s age with the Reaper pie user to the center s machine and v I at C C doors go down to the bottom of this file and that the fabric user with bus for less sudo access. So fabric old ache waas Well, no bus word. Oh, and then sido he was that month Nash A g well, fabric. Great. Now if I go back to my script to the one that p y, as you can see No, no is already and start. This was a package that was already present, so basically did nothing, But we could modify this to install the different package. But I wanted to show you that this way you can overcome this situation. Now let's restore our original state and let me show you how you can handle this inside your scripts themselves. So this is just going to be commented out and go back to our script. Let's call this. You'll find sido to not be y so inside the script. What we would like to do is to create a responder. So basically, the responder is going to allow you to Well, let me show you. So from in walk we will import the responder from fabric. We will import the connection and from get bus, we will import to get past function. We will create our connection against the center s machine. And we will create the pseudo pass responder this ponder. And we need to specify a pattern and her response. So basically, we need to make sure that we know what we see when we connect to the center s machine and try to pseudo. So, as you can see, each asks for the pseudo password for fabric. So now what? We need to say that the pattern is this one. Mm. And the response is fabric with a back slash m. So we need to provide the new line character with which the responder should treat this type off prompt. And now, if I go and try to issue my command Sous ido, No, not so. See, See, the trunk goes to the result and we would like to execute the What should we execute? Get FC Su doors. Let's save it and try to run our example once again So sido to that b y as you can see, it got the permission denied And what we would like to do is to add the pseudo in front of it. Once we are Did we were faced different issue. So it says that we got the pseudo prompt, but we didn't respond because we need to specify something called watchers as an argument. And we need to add the sido past to these watchers now if he wants again run this. You see that it's not working because we also have to say that we need the PT. Why? So Ah, pt, Why simply says that we want this interactive termina to be present when the common is executed? Oh, come on. I have forgotten the white space. Maybe Uh huh, No. Great. So it says that it wanted the pseudo password for fabric on Why didn't it respond so sort of pass heard for fabric? Uh, the second thing is that you need to use escape characters here, so these are special characters which are Let's say, if Mattocks caped Bride batter. So this is going to be a regular expression, then they are going to be treated as they are. So now we don't have the prompt. We escaped the appropriate characters, and the script is working now. What happens when you need to? Let's a deal with multiple types off systems, which have different pseudo problems. So what you could do is to say that you would like to approach it in the third way that I'm going to show you. So sudo three b y. And in the third way, what we need to do. Oh, hold on, we forgot to use to get us. So let's say that Siddle bath word as a quote to get us and what the Sudo password and what we need to do is to change the response. So we still need the new line character. So we make it enough string and we just simply add the sido Vasbert. Let's see if it's working so by transit to fabric and it's working. The second thing that you may want to do this just got come this just came to my mind so basically, on center systems it will always say that pseudo user for the user that you are using in the moment. So let's replace this one with an f string And we say that see that user and that we which ever user you comfort here to use this sudo is going to be field in based on the configuration that your connection is using So you can forget you're set up if you didn't uses other than fabric. So this is how the second example is complete. Now let's get back to the 3rd 1 So let's import from the fabric more. You're the connection and the conflict objects and from get past we would like to important gap bus. So now we create our connection against the center s machine and we need to do the following Siddle password is coming from the campus and what's the pseudo password? And after that to create a configuration which is passed to our connection object Ah, when we are running a common so the conflict is going to be quite to conflict and discover fix says that we would like to override the pseudo prompt So Sudo and we say that whenever there is a pseudo prom that this can match with the Sydell. You would like to provide the password as specified. So this is going to be a dictionary password with an F string that is going to be the Sydell by third with a new line character. And now what we would like to do is to move this connection a bit lower after the config. And they say that God Fig is 1/4 config. And now what we can do is not to run. You are not involved around command. But say that. See that pseudo? And we say that when my we still need the PT Why? And the oath booth should be something that we expect. We are route in this case. And now if you want to run a command without sido, you can also do that. So the first command was around with pseudo. The 2nd 1 was run with fabric. Who are the old based on the oath put so technically here you can avoid the handling off the user name as you can see. And technically, that was all what I wanted to show you see in the next video 5. Fabric & Ansible Functions: Hello there and welcome back. Let's say you want in a situation when you need to create ah fabric script which exact Utes Ah, multiple commands. And ah, you want to group those commands based on on their purpose. So you would like to create functions so we'd functions The tricky party Is that how you can pass arguments to them? So functions that b y. Let's say we have a troubleshooting task and we would like to create a function which is going toe check the free space and the up time on during all systems. So in the light of that, we should create the script as follows. So connection as usual, we go to the Santos machine. Um, don't be bothered by the fact that it's, ah using always so far the sentence machine because later you will learn how you can jump from one server to another. So, uh, let's go and create function called day shoot. We need to pass the sea for the function and we would like to run the the F Dash H, which is going to say that we are checking the free space and then what we would like to do is to say that we are checking the up time, see the from time and now in orderto use dysfunction or we need to do is to call the shoot , see if we execute this example we should see the following. So we are checking free space. We have those. But for the day after she age and we are checking up time, it can come in handy because you could also further process this output. So you could say that you want the fear throughout. Only those drives that have lowered 5% free space new would create. Ah, I don't know warning if the time is lowered and I don't know, 10 days or whatever. Now what we would like to do is to create another function and this other function. How do we do this? Oh, check user. I see. And the user which is going to be none at the first. So what we can do now is to issue the print statement checking if you was a which was specified exists. Wow, I have escaped the court and see the from I d you sir. So this is one way to go about it. But ah, this is going to fail. If they use doesn't exist, you can handle it different ways. So if you specified a user which is non existent so what we say that user, if we have a user specified, then we would like to check if that user exists. Otherwise, we need user name to check. All right, now, if Iran hold on, we need to call the function to run, so check, user. And if you just simply call it with the object, we will get back the response that we need to use the name check. And we say that the user that we would like to check this fabric then what he was see is that this user exists. But if we specify that user which is non existent, so non existent, it is going to throw us an exception. And if you remember a few videos before I have shown you how you can handle this So we say that worn equals true and Hide Inc was true, and we've wrap it around the block and you say if this failed, then no such user is the response that we give. Otherwise, the user is there. All right. Now, if you're on this once again, you will see not an exception. But the message that states that no such user, if we specify the fabric once again, then you can see that the user fabric is there. So basically, this is how you can check elegantly the existent off uses. But you could swap it out for the existence of five. The eggs existence off in stock package or whatever you feel like. So let your imagination loose. And that was all I wanted to show you. So you could create a nice fabric script, which takes an argument that is going to be host, and it checks specific things based on your requirements, human. 6. Fabric & Ansible File movement: Hello there. And welcome back. Now that we have got the functions out of way, I thought it would be nice to show you how you can cope if ice back and forth between your systems. So in this video, we're going toe Donald some fires and upload some fires. So that's called a script five move month that bu I So what we need is to import from the fabric manure the connection, clear our connection object. And here comes the fun part. So, um, if you want to corporate FIEs to that specific system, you need to specify remote directory. If you want to get five from the three most system, you need to specify, like the full pass which you want to download, and it were placed on your current working directory. So, uh, here in the sources, we have a February zip on the Piketon zip. So let's make this script but platform proof. So we would like toa upload the fabric zip and then unzip it, and then what we would like to do removed the original zip and then we would like to create file which we would like to download. So grab a coffee and enjoy. So in order to do that, what we need to do is to create a responder. So from or, ah, don't go with the responder. Let's just say that we would like to add it that see pseudo er's no sido via shooters. And we would like to odd for past for Lucido the fabric user. And, uh, let's go back to our example. So how do we make this platform in the moment? So in order to grab five from the sources, regardless of where which blood from you are running this from? So this was ah goal in my mind when I created the scripts and the represent Torrey Excuse the s Manual. So the OS module has something called the past separator, which is different when you are running windows. It's different when you are running a line x or line, it's based systems. So now what we would like to do this to you with see that put man our five year be enough string, and what we would like to do in front of this is to specify sources. And this is just going to be I thought that plus was the past that Sepp, which is the past separator plus sources. Plus you owe us the path that's separator. And let's close it in braces or brackets. Let me move it down for you so you can see it. That's just stream of that. So we print out the sources to verify it looks as if we wanted it. And in order to do that, I need to be on my system. So find movement. Not that backslash sources, and we would like to specify a file. So if curly brackets sources plus fabric dash 2.5 zip and now we would like to pass the remote there. And this is going to be uh huh home. See the user forward flesh with enough string off course. So now if you run this what? It's not remote deer. Why is it not so we have Oh, hold on. So we need to use to see that. But on this save it. Execute the five movement ssh into our santo s machine and issue the ls dash l command. So as you can see the fabric that zip was installed. But here comes the strict part. So what we would like to do is to use our That's the third example. So we would like to import the conflict as well. And we would like to he was this one fortify movement. So we have these sources. We have the pseudo password, which is not going to be a next drink. So just fabric and config equals conflict. Great. And before we can zip this file, what we need to do is to install so see that sido pseudo instead. Um, in star on zip bash f, that's why. Sorry. So now if we execute this script, you will see that the answer is installed. The fire was moved and what we can do is to issue the seed from on a zip and the past the file which is going to be the following. That's 2.5 that Let's save it and run it. And now if you go to the center s machine, we will see that we have the fabric extracted. Now, as I said, we would like toa used to see Iran to remove So Adam bash f home fabric. The 2.5, uh, and back Miccoli That's it, huh? Yeah, old and it is not working. So because we didn't have a pretty wide defined part on a zip has helped. And it's have says that, uh, we could use dash f toe overcome the situation and less than we get back to our repository . So script activate script fightem five movement. Come on. Oh, no, it's not the f but the o argument. So city fab for scripts. Activate right thumb, find movement. Great. Now what we need to make sure is that we use the, um slash r f to remove the file. And now if you go to the center s machine, you would have what? Sorry, it's not the out If the zip needs to be removed So s to say, sent us all ls dish great So we can close the other window which is stuck. And now we would like to get some fights. So santo us, we look in and we touch a the txt be that txt And after we leave What we can say is that we would like to use to see that get have string home. See that user a dot txt and the B that txt if you're on this example once again what we were seeing our current folder is that we have a that txt and the B that txt. So, basically, this is how you can move files with the half of fabric to you in the next. 7. Fabric & Ansible Group vs Connection: Hello there. And the white Come back Now the time has come for us to learn a new concept which is about groups. So first, I would like to demonstrate you how you would solve a problem which states that you have multiple host against which you would like to run specific a month. And this can be done with the for loop, which is pretty simple. So from fabric, we would like the import connection. And we say that for host in Santo s A. You pronto, we would like toa create the connection for the host and then run the command that you want to run or you could call a function. So that's that's ah, the troubleshooting part. So the shoot see? See that from the F. Beth H c the from up time. And we say that checking free space on See the post with enough string and print checking up time on. See that host and we say that the shoot, see if we save it and execute it. So Group one bu I we see that checking free space on Santos A. Oh boy, why am I writing center Acie? That's what I just simply sent the West. So we are checking the free space Santo s the up time on Cento as the free space and you want Oh, and the halftime when you want. That's one way to go about it The other way, which is like more sophisticated way is to use the Syria Group. So that's created demonstration for that group underscore to B y And we say that from fabric we would like the important cereal group and as G is going to be equal toe Syria group sent the West you want toe And here what we can do is toe say that four connection and as G, we would like to execute the connection that run What? I don't know your name Beth Age and checking all of us And yeah, So now if he execute the Python Group two B. Y, you will see that we are checking the OS version on both of these hosts now to make it more talkative. First, we would like to print the connections object and, uh, let's say we want toe this information so it's more talkative. So you could also, uh, you was this to court functions that would work the same way. So let's create that. The shoot I see See the thrum you name? That's H print on We go here on Dhere Copy Paste on and here Free space and time. And how do we check the free space seat thrown DF bash age on and see Trump time and he just simply replace the t shoot connection. And if you execute this one, it is behaving similarly as to how our previous one behaves. But, um, yeah, this is a different approach. This way you don't have toe create a full of to eat a rate over the connections defined in a set. Or at least you just defined a serial group. Many people usedto call this group, but this is your choice, basically. So that was all I wanted to show you in the next video. We are going to see how you can paralyze this checking with the Threading group, which is ah, more powerful concept. See you in the back. Some 8. Fabric & Ansible proxy jump: Hello there. And welcome back in the city. Or we are going to talk about how you can jump hosts. So, for example, if you record the joing about the environment, you may be in a situation when you have a management server where you would want to log in from your local machine and execute command on a server which is reachable only from the management server. So this video is going to be about the topic. So it allows you to have jumps dynamically from one server to another. And you can change these jumps so you could jump from server to server and until you finally reach your destination. So what we need to do is from the fabric important connection and we would like to create a connection that is going to our you bento machine. We did the gateway, which is a connection against our Santo s machine. And let's create the huge A T shoot function. And the what we would like to do here is to kind of praying that the shooting on machine see that host we don't have string off course and we would like to run on the sea. The up time and see the from the bash h So bring free space and print up time on machine. And now what we need to do is just simply call it t shoot, function on the sea and executed. So find Ethan Oldham. Fightem Ah, broke sick, but be why? Uh huh. What? Come on. All right, then, don't they? This, uh, that way we just simply want toe execute, see the trump on up time and has no tribute What it cannot be. I was just really This threading cannot import even from threading We have functional five movement. Uh, sorry it was for the next video, but basically that's just remove the bank cash and by Tom Proxy And now it's going to work . The problem was that there is a threading maturing fightin and I had the threading that p y script in the current folder. And basically it is just simply stating that based on the more your resolution order, it starts from local for the user packages, outside packages and so on. So now it seems to be working. So what we could do is toe common this one out and say that he shoot see. And now, as you can see, we have trouble shipping on the even the machine up time free space and so on. And basically, this could be chained with a group and what not. So this gives you an idea how you can jump one. But if we want, we could jump to. So for this, the center say we will specify the gateway on this is going to be a connection from the fedora machine. And I think I may need to start this one out because, yeah, so it takes some time to spin it up. But after it is up, we should be able to run this and we are waiting for the boot up. So once we are able to ssh into Fedora Oh, yeah, we are. We should be able to run our proxy script. Whoa, great! Through a narrow, but basically it went Ah, from the gateway sent us to the gateway fedora and finally jumped. Do you been to host to execute this demo? I'm going to remove this gateway for consistency sake, But you should know that this is something valid that you can try or use so to you in the 9. Fabric & Ansible Threading: Hello there. And the white Come back in this video. We are going toe talk about the parallel ization capabilities or fabric. So Ah, so far what you have seen is a sequential execution off either sing commands or functions on the specified hosts. And ah, this is ah, kind of interesting because ah, you may have a situation when sequential execution is not really feasible and you want to go faster and the fabric has an option which it provides that allows you to go with the thread groups. So basically, what you need to do to utilize this is the following from fabric we need to import threading group as t G. And what we would like to do is that g equals to t. G. And we say that sent the West's you want Oh, and fedora needs to execute the halftime Calmund. This is the simple or more simple example that I could come up with. So python threading our threat groups. And as you can see, it was almost instant because ah fabrics spun up part of the threads that went out to each of the connections executed those commands. But, uh, what is the problem with that. Let me show you so as just ah of these. So if inspect the g vary able, what you see is that we don't really have a put or get function. We only have a run function. So this means that you cannot use the threading group to cop. If eyes forget fais from remote systems, you're only able to run commands on the remote systems and off course. This is not real limitation because you could tell on the remote system to use RCP to copy back some five to a location so you could overcome this situation. But ah, technically, this is just a subclass off the group class, which is like the at the heart off, grouping individual hosts. And, uh, another thing that I want to show you is that basically every ah connection that we have is just simply ah, class, which is going to manifest in a dictionary. So if you say that g that dunder score So double underscore Dick What he was holding. We don't want to use this. We want to you Oh, no, Sorry. That was a different thing. So technically, this was all I wanted to show you. What you can do here is to imbue this with the usual trouble should function. So the shoot lets us copy and paste it. And we would like to used the d shoot she hold'em. Not that Well, where is the connection? This is just see, where did I copied this from? So group to t shoot. See? Okay. And he doesn't have the argument host. So as you can see, it is pretty limited as to what you are able to do with that. What may just save this somebody fighting so but ah, I mean, regardless of the circumstances, still use it toe pretty much automate with the threaded groups anything. So we're checking up time checking the vice Ah stuff. So as you can see, the output is grouped because ah, the first common that Iran is grouped or executed peripherally on each of the horse that are specified in the threatening group. Then the second common is executed. So this is how you should imagine this popularization team in the next time 10. Fabric & Ansible fabfile vs argparse: Hello there and welcome back. If you have gotten this far in this course, you may be wondering Ah, okay, We can create our different scripts to execute stuff, unspecific costs. But how can we let they provide arguments to these scripts, which are passed and one way to do it? And it's not the best way. So let's call it Feb. Worse, the P Y. Let's say we want toe import from the fabric, the connection class and we say we would like to import the Arg Pars module, which is the argument parts of module for Piketon. So we see that we would like to create the part, sir, which is coming from the Ark. Parts and argument pars, er, class. And this is a simple arc bars. Hold on. Ah, you can't see it family. And we say that we would like to go ahead and add some arguments to the sparser. And our first argument would be the host which could be called Dash Dash Horse and we provide half function, which is going to say that Oh, what with this auto complete the host to bother, and we say that if oh, hold on So our eggs is equal toe part sir. Fars arguments if are not our eggs but host Then what? We would say that we would like Toa bring it out. Help do this! So I'd say that this horse that we have has type off string just as a hap to the user. And ah, drugs and the print Hold on bars a print help as we say that print running against most and we see dogs host, we don't have string. So let's call it, uh how did we call it Fab Worse. And we say that we didn't specify any argument as host and it is not going to run. So that shows sent the West We are running against Horst Santo s. And, uh, to be honest, I wouldn't say that this is the worst possible solution because, I mean, if it gets the job done, it doesn't matter. But there are some limitations that you were exposed to which the fab common, which comes after you install the fabric manure is going to overcome. So let's say that we would like to create a C which is a connection against Santo s machine , and we would like to issue to see that Ron up time. And we are not going to run it against the center s but arcs that host. And if you run it once again, you can see that the it is running against Santos Horst and it provides us with unalterable . No, let me show you something which is better so fab. Better not be Why? And technically what we would like to use or utilize is the fact file functionality of the fabric manual. So in order to use that, we need to import from the fabric manure, the task. And this is decorator. And we say that deaf up time, see and see the from ah time. And we say that getting up time from host see with enough string host and we don't have to specify any invocation here. So in order to use this, we can use the Fab Dash dash list common, and this it needs to be named as Fab Five. So now if list this, you will see that we have enough time common. So the sometime command is going to be pretty useful because what we can do now is to issue the Fab Dash h sent us time. And as you can see, it is going to run against the center s host. What we can do is specify you want toe fedora, and we have sequentially executed the Commons which are defined in this task. So this is pretty powerful concept and ah, if you want, we can let's say they find another task which is going to be deaf. The shoot, See? And let's just grab it from here because we are too lazy to right. So we're going to see here, see here and see here. And if we should a fab dash dash list, you will see that we have now do Commons, So fab slash h and he shoot Oh boy. And this is working. So this is what I wanted to show you. So this is how you can create different tasks with fabric which are, let's say, available with the fab command to pass arguments that you can use to run commands or put files or get fires or whatever. So let's say we would like to upload and ah, the pie tone or no, the fabric zip file. So we create the task and upload ducks see. And where did we do that? So find movement and what we did. Yes, To installed this one. Hold on. So we would like to snatch the in the sport on. We need to import the conflict as well. Um, we don't want this. So let's just go ahead and you want Not you, but not so. Ssh fed the order sido v i at sea adores brick and it's not in this address. Five. Let's go to our pm to correct this A terrible mistake. And again great terminal. And we say the Sedona we I had ceased the doors. Oh boy. So apt install. No, no, I don't know why, but when I'm in this, uh, the Americans are these commands don't seem to work. Oh, great. Now it's working. So, fabric, all it waas or no password All control. Ask why Now we go back and do the same for federal. So Sydell B I at sea sit doors and way go down, down. Um we go fabric all equals or no password. Oh, and if you go back to our script so here we need the import us more. Your so these sources are valid and ah, Now we should be about two. Go ahead and shoot this on Federal and Santos. And we say that. Do you want the shoe? The by a dumb no fab bash h send to us, Fed the order. Upload docks. Great. Now we have the fabric uploaded, and there is no such fine. Mm. World, Come on. So we installed the Alsip. This is working so far. Great. So now we have what? Working on most. See that host? Uh oh, boy, you want to download as well. So let's just say that the removed as it fire on and it is working so on the federal fabric zip. And if you go back to the host itself, how s that? Oh, home fabric. With the Siddle, you will see that we have successfully uploaded the material that we have always wanted. See in the next room. 11. Fabric & Ansible Build Python Source: Hello there. And welcome back in the city. We are going to talk about how you can build Bytom from source. So this is going to be a complex task which requires to you you toe use all your accumulated knowledge Have we are also going Teoh you was the weed contacts manager and the reason for that is that for example, this is just going to be a demonstration. So from fabric import connection, C equals connection sent us and we would like to do the following So see that from see the trump and P W d. This is going to work. But if you are using ah, that's a common like make or configure or what not It may fail as those commands have different. Let's a working directory is based on where they're invoked from. So since we are going toe work to be a fightem from source, then we need to approach this in a different manner. So what do we do? We would like to create in your file by from source the P Why and what do we need to do from fabric? We would like to import the task and we would like the important U S. Mind your and what we would like to do is to define a tasks and build vital, and we will just simply pass a connection. So this is only going to work for ah, method based distributions. If you want to use it on the BMB is distributions or Sosa or gentlemen looks rational looks . You need Teoh. Figure out what dependencies are there for them to use. So basically what we would like to do now is to first verify by phone source. So what we have here is that we have under the sources folder the fight on the ah 3.7 charge easy. And we would like to use their real smile your to check if the was the past that is five returns true to the following expression. So we would like toa concatenation the dot plus Oh, just ah yeah, sources equals sources. So we would like to contaminate with this west that path that step plus sources plus west a path that Sepp and then say that source found has bring source not found aborting and we were just simply raise system has it all. And let's just simply state that we would like to abort with this message. All right, so we're not done with this. So he would like to upend the Pritam stash. Three but 7.0 want tg busy. Why is it commented out? All right, So now if he should appear by a tone Sorry, fab list we were see still see the file. So let's rename it previous. And let's call it Feb five. Okay? No, if you say that beard, so fab build by some on the host sent to us. But you see that the source was successfully found. So now that we have the source, we need to move the source to a specific destination. So Ah, you may want toe Jack if, ah, the destination path exists. So you could over complicated as much as you want. What? What I would do is the following. So we would like to use the bring statement to say that copay fired toe destination and see that papa put. And we would like toa simply outsourced. This soul source is equal to So we would like to put the source on the remote which is equal to home fabric for a slash and if you want, we can say that this is to see that host. Now, if he execute this once again, it's 50 sorry source and I have rapper fail. Er Kobe file The destination sources found Onda Now it doesn't seem to be working. Oh, sorry. His seat of toast and see that he was great. So now if we go to the center s machine, we will see that the fight on charges he is there. All right, now we have the Tar gz. What we need to do is to see that Ron on Zip or Star Ex Z and the home. It was a fight on cash. Three. That's 70 t g z. Let's say with and run it and we need to make it enough string. Mm. All right. Now, if you run it once again, it is not going to make a difference. We could just ex ah, uploading the charges be filed. Okay, Now what we need to do is tow shoe, some pseudo comments. So let's check if we have passed for less Ido So Sudo Su. Okay, we have it now what we need to do its three install Dependence is so what are the deafness is of building? Fight on Currently these are the depths which are needed by python. I have copy pasted this list not to take off up time. So what we would like to do is to four D in depths. We would like to see the from pseudo yum installed the That's why with the f save it and executed. Okay, so now it is going to install every single dependency that is needed for vital meals. And after it is done, what we need to do is tow basically had, say, remove the tar gz. So see the trunk at Bash F home by time charges A with enough string. And after that what we can do if toe assume the following So we would like to use a weed statement and we would like the CD into directory. So this is basically the f string off for a slash home. See that user by phone, Dash 370 And then what we would like to do I'm going to go pick pasted because it takes quite some time to write it. So basically, first we would like to configure the source finds, then issued a pseudo make art in star and updated alternatives and Beith eagerly that it So now if he rerun this once again, maybe we should have He didn't in the output, so Oh, yeah. Sorry. So this to see that CD in the other versions, you had to import this from the P I sub manual off fabric. But in the recent version Oh, as you can see, it is now working. Now you can just simply refer to it esper connection, which is, I believe, more convenient than stating that you want to import a function from sub module and then associate it with the connection. So behind the scenes, it makes sense. Toe have function for a connection as CD or PWD or whatever, then to associate a different function from a sub manure. And ah, once this is done, we should be able to look into our Santo s machine and they should fight on three. That's seven common. So now we are the I think may called install. It takes some time, but ah, in my professional life, I have ah situation when ah, managing old redhead and Centris machines and basically fabric unanswerable has made my life so much easier because of the convenience of using them. That Ah, I really encourage anybody who is in a similar situation to utilize these stores because they allow you toe create flexible scripts which are executing biting beards or open as a Selby it or Java application deployments of whatever you feel like you could execute. You will only need to learn the ropes. And after that, basically, you could simply combined these scripts. So I have a big fat file with arguments that allow me to do whatever I feel like in my my official work. And now we are compiling the fight on. And after the compilation is completed, we should be about ish Aunt Ida Santos Machine issued a python, hit a tabulator, and now we have built a bite on 3.7 from source. So don't worry. This is going to be present in the sources off the G triple. So if you like named your notions similarly, you should be about toe. He was these examples and this is all I wanted to show you. See you in the next 12. Fabric & Ansible Ansible Config: lo there and the white Come back. Now that you have the foundation from fabric, the time has come to configure our answerable management server to allow us to communicate to remote devices. So basically, we would like toe in this video configure and above server with the fabric to use the fabric, private key and so on. So let's go to the center s machine. And first we need to pseudo to root and v I at sea answerable hands about that c of g here we search for the key he would And first we would like toa a neighbor the or disabled the husky checking. Then what we would like to do is to search again for the key. Specify a private key path. So it's going to be home. Ah, fabric, not as a sage. I d r s a. So now, um, we are almost there to do this. So what we need to do now is to currently or hold on. Ah, we need to define a group wars for order. So under the etc Answerable folder, we have the hosts and the rose. And here if we define on at sea danceable group wars for order. This is going to be afforded that is read by default by answerable. And you can create a special file at sea and supergroup force Or that GMO or why, Emma? Sorry. And here in the A m. A structure, you can specify the answer Ball user, which is going to be fabric not answerable. And the specialty off this file is that it is going to be applied across all of your hosts by the fort. So now what ah, you should do is to add it. Your hosts files So here we would like to have the Santo s the fedora and they want to. So if everything goes well, we could issue from the fabric user answerable Dash M Komen, Local host Bash. Oh, sorry, Nash. A up time and you can see on the local host. We have this up time, so let's see if we have the same for the center for us. Oh, we almost have the same. But sometime Waas elapsed. Do we have this for the U Bahn toe? Oh, we have it differently. Do we have this for the fedora? Oh, we almost have the same. So the lesson here to be learned is that if you set the invisible conflict the December husky checking and specify the private key that you want to use our authentication for and it is in the authorized keys or out rest hosts off the remote machines and you have said the group bores as the appropriate tens of a user. You should be about execute stuff on your remote machines. So we use the answerable dash, cam ping, the ping or and if everything is green, then we are green. See you next. 13. Fabric & Ansible App Update or Deploy: with that and the white come back in the city on. We are going to create a fabric script which is going toe either update or deploy a live application from get tub. So, um, currently I have something which is my let's say, get a bio. Ah ah, site. And what I would like to do is to create a February script which is going to go out to remote system. Check if the get common this present Jack. If the application for the is present, if they are both present them there, it is going to issue on the get full command. If not, it is going to clone the rappers it story. So let's get to it first. What we would like to do and we need to do ist import from the fabric, the connection glass. Let's create our connection. So send us. And now what we would like to check if the see the trump which get is going to fail so warn . True. So we do not get an exception and hide true. And if it's failed, then we say that get needs to be installed toe be install it. Otherwise, we say that get command his available. Okay, then we should issue to see that run, Sudo. Um, in storm sh y get. And we just simply want to hide this one. Okay, now that we have this out of the way we were, If I the debate command is available, what we need to do is to decide on a folder. So let's say the application should live inside my home folder off the fabric user. You can specify any other directory, but anyway should check it now. This way. So if see that rum test bash f home fabric. And how do we call this for the it is going to because Reaper pie in that get have that I owe warn. It's true. Hide is true. And we say that the folder does not exist. Gloaming. Okay. And then we need to make sure that we watch for the failed property as we say that the up is already deployed of a thing updating. So we need to do you use the width. See that CD And we would like to navigate toe the home folder and issue in the sea the from get clone and we select the you are. So this is the order that we need. And let's not commend this out at first. So now what we would like to do if the APP is already employed is to issue the sea that run , get full inside the application folder. So we need to use the with content manager and ah, we need to enter the directory. Great. Now let's run this example. So now we're cloning into the repository if I s s age to my center s machine and the shoot ls dash. Oh, you will see that the folder is now there. Now, if I run the script once again, you will see that. Whoa! So, huh, folder does not exist. Oh, holy moly. Okay, so if our folder doesn't exist home fabric, then we would like to clone into it. So we do not clone inside a death for though? Uh huh. Okay, let's see where we are. It's folder does not exist. That c was the old both of this command. So as a sage sent us Onda, we are almost there. So test we have this folder there, but the test fails. That's chef. Um, something. We get this number But if he said the test home Fabric Reaper prying it Io, why don't we? Oh, boy, we should not just for fire but directory. Great. So now this is the directory. And we would like the CD and clone it otherwise. See the end. Pull it. Hold on. Great. Now it is working as intended. So this was all I wanted to show you in this video soon and 14. Fabric & Ansible Ansible Authentication: Hello there. And welcome back in the city, we are going to talk about our authentication and how authentication can be set up as a bonus for in those machines. And naturally I see is so I have ah, spin up. Ah, C 7200 Cisco Device, which is connected to my network, the VM that one and the management service going to be able to reach it. So for Windows, what we need to do on the windows side is the following. We looking with an administrator user Startup command trumped. Issued the AL US Air EM JIA Common. Create a new user which is going to be called fabric. And the password is going to be start exclamation mark 12345 Start, exclamation mark 12345 We don't want to change password, and it is never going to expire in a test laboratory. Okay, Now who you would like to addict as a member of administrators and check names? Okay. After this is completed, what we need to do also is toe basically configure the winner. Um, so winner m is Ah, let's say ah, what is used by windows for remote management interface. And then Zuber has a pipe bomb on your which is able to talk this protocol. So first we need to set the authentication toe basic. Oh, so let's do this it power show. And then we need to allow an encrypted authentication. Great. Now, if everything goes well and we can a neighbor the PS remote thing if it's not by default on a world apart, technically, that's it. So let's jump right back into answerable itself. So, uh, currently in my at sea answerable horse files, I have two additional groups, so anything that is not group is going to use. Ssh authentication. And for groups, you can define specific authentication methods and credentials. So if we want, we can create Ah, under the at sensible group wars. A win that demo, which is going to be applied to any group members in that group. And what we would like to do is to say that danceable user iss fabric Dan Zebo password is start ask permission. I want 2345 and the answer both connection is winner. Um, and as of ah win Aram transport is basic. And just to make it the traditional yemma five. We had the three dishes on top, and we can try and use the wind. Being more you're against the 2019 a machine, and if everything goes well, it should give us back a bung. And ah isn't a duration it is taking to respond. I would assume that is not working. So for Windows you could use a plain text, authentication and care or south indication or even a certificate based authentication. So Kerberos authentication can be used. If you have a domain joined machine certificate bears out indication. Oh, hold on. We need to specified answerable borked Because if he check, the 86 is use for https and the basic is going through. Http. So now it should really work. And I would be really happy if it was working. So that's all about the That's one. So now Ah, I have opened up a console against my C 7200 and we are going to first configure our group unanswerable. So that's pseudo V I at sea ends of ah Group Fourth, she's cool or I us that, you know, bash Dash. As ever he was Ah, this fabric and the ends of ah, bastard is going to be fabric. And we're going to use a sensible connection network. Cli and we were used to ends of, ah, network OS I waas. So, uh, what I have left out is that in order to use when I'm authentication, you need to install with the paper. My your the by winner and Mario. It is already installed. That why it was working for the Windows machine. Now what we need to do is toe configure our router. So going figure terminal and the, uh, secret fabric and I be domain name is going to be repurposed dot com and creep though Key generate or ISI 2000 and 48 bits. Um, school sage fig e pssh. Version two. User name for brick busts. Hood for brick. And we go to the home. Tell me now, line VT. Why zero slash four transport in put as a sage. Hello. Game. Hold on. Yes, the second transport in protest. A sage. Oh, uh, and we need toe, uh, configure our fast internet interface. So we and it comes after in a phase zero slash zero ap address 1 92 168 56 six. And the mosque is still 55252550 No, shut on. And if everything goes well, I pin brief show I and Brief, we have this address configured. And let's open up a CME the and go with the SS age fabric at this one, joining me on this one. But all right, go with this. We have a response on assess age fabric at this one. Oh, yeah? So we need to odd the different Helmand group s h one. And if we don't want to go this way So if you use ssh to connect directly what you need to do a specific store arguments for them Otherwise, Ah, Isabel is smart enough to handle this situation. So we got back the punk here as well. So technically, that is all I wanted to show you. And in the next video, we are going to go. And though some playbook, creation and procreation, CNN 15. Fabric & Ansible Playbooks and Roles: Hello there. And welcome back in this video. Now that we know how are answerable, authentication can be set up and works. What we would like to do is tow, create Ah, or start using answerable itself. And there are three distinct ways that I would like Toa show you how you can use and cyber toe manipulator remote devices. So the first way that tends bar provides is at Hull Commons. So if you say that an Zuber dash M command that's a up time sent the S, it is going to go out and the execute the specific command with a specific argument on the target machine and this is perfectly fine. And what you could do is to create best scripts that IHSAA sequence show and numerous Asian off ends, well, commands that you would like to execute. But ends will provide something that is called playbooks and rose, and they allow you to group together Ah, set of instructions that you can call upon on your remote devices. And this is really the concept off answerable. And there is another term which is called item potency. So I temper pence means that I mean to my understanding. It means that we only do something if we have to do something. So, for example, you would like Toa Copia five from your local machine to the remote mission. And that file already exists. So you don't want the copy and override it. And what edible does behind the scenes it calculates. Check some and if the check some off the local file and remote fire matches, it is going to say that we have the same content we don't need toe, uh, overwhelmed the network. So we are not coping anything. And how do we create basically ah, label The playbooks are created with the m o extension. So, um oh is ah is the yet another markup language for abbreviation and it allows you to ah, let me show you. So be I. Hello? Would that Thiemo so And most of the cases you need to specify hosts and the basically these hosts can be either group or the specific coast against which you would like to execute These. So what I would like to do now is the following. Yeah, I see post not this one So answerable hosts and I say that this belongs to the line of group and I would create another group which is Gold Master and this is going to be the center s machine. So now if I say that I would like to create the hello world Yeh mo I can refer toa either groups or the members of the specific groups So if I want to execute something on the line X machines So all three of them I need to specify this group but now I only want to demonstrate something So ah, let's say we go with this. What we can do is to specify either tasks and each task has a name. So let's say get set up in full and set up. Call him if I execute my answer about playbook. What we are going to see is that it executes the following as if I had executed it. So basically this m set up on and it doesn't need any arguments, so it gives a detailed information about the remote machine that we can reuse. So if I say that, what do I say? I will not say anything. So basically, in different tasks you can do different things. So for full and that's a detailed information about invisible and what you can, ah, do it it. I suggest that you visit the answerable official documentation because it's going to be You're well, let's say number one go to place where you can basically get everything that you need to know. So, for example, let's say I want to create a file with content answerable. What we can do is to use the fires more yours or basically we can use the file module itself. So it only requires us toe specify the path for the five, and ah, there are different states for it. So you can say that the state that you require decide, absent or present or just touch so much means that it will create the file. And ah, I watched the widow. We can also specify the mood, which is basically the line export, and ah, we could also say that we want to use a for loop or a loop to create a set of fires. So let's ah, I don't know, try, try something out. So we would like to create four files with answerable. Hold on on the remote machine and we are going to do it this way. So name fires toe be creative and the we used five small your and we say that we would like to have a file under the specific bath, and this is very able substitution. So I attempt and we would like to have the following. We just simply specified a state touch and with high temps and yeah, let's say home fabric. File one, the TXT home fabric five to the txt or home fabric. 53 Not txt. Now, if he execute this playbook Well, come on. Couldn't resolve module action files. Andi. Okay, it to say that this is a file. Yeah. Sorry. So now we have creative three fires in the current directory, so it seems to be working. What is Ah, that's a commonly used more. You're It's called Copy. Yeah, this is the one. And basically it allows us to move fires from one machine to another. Or if we want, we can move a file on a machine to a different place. So let's say we would like to copy, uh, these tax fires to the temp folder. So we I Hello world on and name a copy. Five to dump. And we say that we used to copy my your and it had the source. Mm. And we use the very able item, and we would like to specify the destination that is going to be attempt. And we used to remote as R. C. Yes, and we just simply specify the with items. So this part that is going to be our list of fires to be moved, and that's execute this playbook. We have the info, we are moving the fires. And if you check the Time folder, we have those three fives copied from one direction to other. So basically, this is about playbooks that I know that are much more that you can do with these that I didn't show you about. This was just to give you a general idea as to how playbooks look like. And what I would like to do now is to create rules. So let's say Rose are basically going to allow you to group together tasks. We chart associate ID with a specific situation. So how do I do this? What we need to do first is to go into sido never gave to our etc answer per folder And here we have the rose further And what we could do is tow Go ahead and ah, inside the rules directory, we create an APP folder inside the APP folder. We created the tasks and this is not with the city comin And inside the tax tasks folder we could create Ah, main that GMO five and ah, let's just get the contents off the hello world. Well, what? Cut Burnt. Ah, so so home fabric. Hello work. And we say that we want to call these two tasks or three tasks even a role. So amps tasks main about Thiemo and we just simply almost so Let's ssh into this machine fabric and we use our public and private private key pair and FSH Oh my My cats home fabric have low word and we would like to put it in the app tasks main that yemma calf main, perhaps tasks I mean but demo Great. Now we need to edit this fire so usually this fine is only going to contain the actual tasks that you would like to perform. So this is good enough and what we need to do needs to adjust the indentation, So it should be out here. These are the task definitions. And now what we can do is to go back to Fabric and Ah, create. Hello, room. Hold on. So this is going to be I am a fine. So the whole lists is going to be sent to us, and the Ross is going to be and app, and basically that's it. So now if I should execute the answer about playbook Hello? Role. Whoa! At Seemed to accept or what Adobe I at sea as a Boro's. That's main. Um Oh, Uh huh, Yeah, what is happening now that this role is getting applied to the remote system and, uh, the idea of having raws is toe create atomic tasks that can be applied to your remote machines in a specific situation? So that was one thing that I would like to show you is that with both rose and the playbooks, you can execute the stuff faster if you together. Yes, Instead of that, you get oh, no, together. It means that whether whether you would like to gather the facts which are basically an information from the remote system and it can be useful because it allows you to decide which tasks the perform based on host faxed. But if you know that you don't need toe, um, execute task based on the information that you can just simply disabled and execute the thus that you would like so to you in the next. 16. Fabric & Ansible Proxy: Hello. That and the whack Come back in this video. What we are going to discuss is how you can create a proxy playbook. It is going to copy a source file from your local machine with the hap off the management. Sarah, all your line eggs estimations. So basically what we would like to do, it's to create ah fabric script. So if you remember, we had a script which is able to distribute fires with this is the five movement be why? And ah, basically, what we would like to do is odd some new functionality to it. So an zebo proxy, that be why so from the fabric manure he would like to import the connection. We would like to create a C equals connection and let's call it sent to us. And after that, what we would like to do is to create a new father here. So right, click new folder, play books and under the playbooks, what we would like to create is ah, basically a copy. But, um oh, and inside the copy that Yemma we would like to create the hosts and this is going to be lying looks and together effect is going to be No. And the tasks is going to be as follows. So we would like the name this task GOP by phone source. And if you go back to our browser, we can ah, copy fires. So, uh, basically what we would like to do is to go for answerable copy five so remote locations and so on and so forth. This is the module that we would like to do and, ah, let's just go back to our current playbook and ah, under answerable proxy, what we would like to do is to invoke the see the put, and we import the OS upon you and spared ah five movement, the p y. What we would like to do is to have the source is defined and, ah, going back here, we would like to uh huh put this file the fabric that zip and, uh, yeah, so that's basically after this was copied to our Home users folder. What we would like to do is to copy it further. So let's go back here and say that we have this copy task and under the copy that Yemma, what we would like to do is to delete some lines. But after that, we want the home. Ah, fabric. And we have a fabric 2.5 sip and destination is going to be the camp folder, and we do not need an owner or whatever. So we have called this, um, copy toe move the fire to our management server. And after the management services done, what we need to do is to see, but And we would like toa use Oh, dumb the playbooks and they books. Oh, a spot Sepp with the GOP. But, um oh, under the user's directory. So now if we go back to our local machine and fight on script and hands about proxy the P Y , we should be neither per sources fabric that zip. What is it? It's cannot find the gate. Fab burns Sources Copy that, Yamma. So script that Thiemo Hold on, answer a proxy sources and playbooks by and it's about rocks. And if you go to the SS age Santo s machine, we should see the copy that Yemma. So if you get the copy Yeah, most gone thump We We should see that from the fabric folder. We would like to copy to the temp, whichever the destination is. So now what we would like to do is to run this playbook. So see that rum? And we say that home fabric Korpi about Thiemo and basically that's it. So now we can run the proxy. Oh! Oh, Uh, sorry. So gmo and it still has the best, Oh, month. So let's make it sido And it still has the bad command Common found. But why is it not found? So SS age sent the West Ellis is now Uh huh. Oh, boy as well. Playbook. Great. So we have enough ending line in the playbook. So we have the copy that Yemma and, uh, why is dissing offending line? Uh huh. So now let's try to rerun it once again. And now we are able to run the playbook toe Go and execute a copy command on our management server to copy against our remorse machine. So if I go now and ah ssh into our federal machine, I will see that this fabric is currently copied. So that is all I wanted to show you and see you in the next room. 17. Fabric @ Ansible Proxy 2: Hello there and welcome back. So now, since we have seen some playbooks and rose, what I thought would be fitting is too odd the arguments to our playbooks. So how can we do that? The basic idea behind the CO p. Emma and ah, any other playbook that we have created Waas toe like, um, Copia up the the playbook itself, executed as it is. So now what we would like to do is to create a playbook. So this playbook is going to be called argument ID that Yemen and what we say here is that we have bash, dash host and these are going to come from F Q, the M and ah together. Facts is no and the dash tasks name is going to be executing task on AFC you the end. So, by the way, F. Cody and means fully qualified domain name and ah, we will have the wars and we say that one worry able is going to be a which is going to come from the argument. Hey, and the be is going to be coming from the very year will be and ah debug message is going to be the value off A is A to okay and name and executing task on after qd and after qd and exclamation mark debug message The value off B is equal to be all right Now what we would like to do is to create the script. So this script is goingto be cold, argumentative that be why and what we would like to do here is toe from fabric. We import the connection on we create the connection against our Santo s machine and what we would like to do is they should see that put and what would we like to put? So let's not make too much of a big deal about it so that the backslash playbooks backslash and, uh, our go man did. Man did that Thiemo and the remote is going to be home and zero not fans of a story fabric . Okay, now what we can do is to execute this argument it b y. And if everything goes well under our sent to us machine, we see the argument id yeh mo. So now if I want to execute this playbook, all I need to do is answerable playbook. Argument id dashi EFC. UDM is equal to Santos A and the E Hey is a quarto. Hold on Santo us A. Not descend to a city but sent us. So Dash e A is equal to whenever that she be is equal to whatever. Uh hmm. Great. So now Oh, boy. So this one should be aligned a little bit outer. All right. What makes it this one as well? Great. No Gets argument. So we have the oh boy. So asks name debug message, debug message. So now if he execute the argument it part Yeah, we are ever to execute these tasks. So basically this is Ah, almost everything I wanted to show you. So now the playbook is working. The debug is just a demonstration as to how you can pass these arguments. What we would like to do is tow modifying this argument it one. So see that run. And we would like to issue the answerable playbook. And you you was the home. See the host. Ah, sorry. User and argument id the yamma And what we would like to do is drink it a laugh string And we say that we like, snatch these ones from here. So we have this part on and we changed from double courts to single boats. All right, now we fear reissued the argument that the P y you will see that the fresh playbook Wasco pid and the arguments were passed. So the last thing that we would like to do is to modify this so that we have not a connection, but rather with desk. So death exit cute. And we specified the sea the age or the host, the A and the B. And we want this to be decorated by the task decorator. We can remove the connection and they saw and what we would like to do still modify the host A and B. So this horse is going to become half string, and the A is also going to become in the argument for the X F string. And the B is also going to become one as such. And, uh, let's go ahead and call this older fat file world and the argument it should be called Fab Five. Okay, now, if I go ahead and issued a fab dash dash list, what you see is that we have the execute. So, um, how do we execute this. So fab Dash age sent to us A and execute dash, Dash host sent the West. It's not Santos A. Why am I keep on doing this So dashed? A is going to be whatever and there's be is going to be whenever uh huh And it is no idea what this is so that we may be. And the shame maybe. And the show's maybe dash eight. It's not good. So that's execute it on the sport. Khost son, Tow us. That be is whatever. Mm couldn't manage the supplied horse pattern. So what we would like to do now it's the print host A and B. The horse is osc the A Santos and whatever is the other one. Come on. So there's dash forced Nash A whenever Ha ha ha! So they gets the whenever the biggest. Whatever. The horse where we execute is is the Santo s and we want this to be executed, as the paper label goes is on the center s machine so we could approx it ease to execute it on multiple remote machines. Don't basically dust was all I wanted to show you saying in the next 18. Faabric & Ansible Windows User: Hello. That and the white come back in the city or we are going to create a fabric based solution to provision user on our Windows machines. So technically, what we would like to do is to create a new fab file. So let's rename our current one as O. L. Let's call the new one Feb file not bu I and from no get so from fabric, we would like the import, the task and the task is going to be to deploy user and we have a C user and the bus. So if not, see that Horst or user or bus, we don't up than what we would like to do is to say that print we need Horst user and a password. Otherwise, what we would see is that we would like Toa deploy you was ah on host. See that host with bus bus would Why is it relating it? So now if issue the hold on, let me go on to my get repositories for bands activated the fact script, Activate the bath going to the scripts for their and issued a fabulist got one. So we have the deploy user. So fab Nash age deploy user, and it is telling us that we need to specify an argument which is going to be the 2019 machine. And we are still in like, ah, spending way toe say that we can deploy this. So we didn't receive the position on Argument User, which is going to be answerable. And the bus which is going to be whatever exclamation! 12345 And now we are deploying user answerable host with password that we have specified. So that's just do it calm and ah, let's create the playbook. So inside this playbook, what we would like to do is to create a new one which is going to be brooksie users that Yemma. And here what we would like to do is to specify the hosts, and this horse is going to be the f gud um which is the fully qualified domain name we would not like together facts. And we have the jousts with the name First. It's the provision user. That's great. Uh, you either with password. So this is how it looks like now you can see it and ah, what we need to use in this case is the wind user named Module Off and Zuba, So win user And we say that the name is going to come from the Vari able So you is that and the password is also going to be coming from the password. Let's put it in courts and the state is going to be present. Great. Now, if you go back to our fat file, what we would like to do is to make sure that we first put this playbook into the appropriate for order. So see the put and we would like to put the five and ah, what do we want to do? So we would like to use that that back slash back slash playbooks. Maximus rex slash proxy user. But demo on the dreamer, which is going to be the home, See that user and just save it. So that's around this once again. And if everything goes well, what we should have is the playbook copied So 2019 A. It's being about. Hold on. Oh, I'm not writing the right one. So 2019 a. And after the playbook West copied. What we can see is that if we shoot SS age surround name ls L We will have the use the playbook copied over there. So this is what this Ah is all about. So, in a previous studio, I have shown you how you can make it platform independent. I'm not doing this right now, but technically you could ah use that approach. So basically, what you need to do is to import the US module And you is the OS that path that Sepp, while variable which will be like, dependent on your operating system. Why is it failing? Come on. So now that's log off from our in those machine. Let's go back here. Control there, Administrator, The appropriate password. So now if you ask the stage to the center s machine, then Oh, boy. So I left me cold like this mistake for you. So, uh, V I see Windows system 32 drivers at sea hosts and I say that this is cold, but this this is called the appropriate way. So sent to us a onda we would like to deploy it. Oh, I think I know what's the issue. So basically what we have here on this is that we are deploying the user on host. Hold on 29 to May with password. And what we would like to do is to use See that so machine and the remotest. See that user? Uh huh. So the machine is going to be just a second. And the this is going to be to see that dash H and ah sound the US And they play you is Ah , Bash dash machine 2019 A with the past So currently we have in the centre West configured for name resolution. And, uh, if you go to the Cento s machine with the Leicestershire each and this dish l we have the provisioning user that demo So now what we need to do is to execute this playbook. So see that run And we have these, like, half string home fabric proxy use a demo and that we have the best e with the machine and this is going to be the half qd and and the dash e andi Uh, what do we have? So proxy user has arguments, user and password. And this is what we should follow you is that z cuatto curly braces user and that e password is equal to bus and we would like the cold is as an ends about playbook. All right? Now, if we go back and execute this one, we should see some meaningful output. So we have a template terror and 10 Anything unexpected String full. Great. Now we should be able to rerun it and provisioning user with password. So now we need to check this proxy user, and we should be able to travel. Shoot it. So we have the user, the password, and we have to use the password and it says the template Aurore template ing sting unexpected brackets. Why is that? Oh, uh, we are missing. Why here? So now? Ah, we should be able to look in to the machine with the as we're user and whatever Exclamation ! 12345 And if I log off Andi, I love this machine. Hands about what? Exclamation on the street for five. And I mean so Technically, that is all I wanted to show you in the studio, so it makes it easier for you to provisional accuse you could provision domain users off course, That is ah, little bit different stuff, but ah, in the last of the videos, you will get an idea as to how you can approach to solve that problem so to you in the next one. 19. Fabric & Ansible Ios Login Motd: welcome back in the city owned. We are going to walk around the task that you might face in a company. So let's say your boss do as you that we need to change the log in and the message of the day banners on our Tisco IOS devices. And you have your local machine. You have a jump server which reaches those that will be rices and you happen to know about fabric and danceable and how you can achieve that. So this is one way to do it. Ah and Zuba support more tipper, I am not a device types. So if you want, you can look for IOS Device and Johnny per Device and follower to device modules which come by default installed. And ah, currently we are going to use the IRS banner you're off answerable to achieve our task. So now what I would like to do is to create a script which is called IOS Banner that number p why? And basically we would like the port from fabric in the connection glass and the OS manual . And after that we define our playbook, which will come from the playbooks directory, and it is going to be called. Ah, how should we call it Banner that Yemen. And we need to add the OS that path that step to make it like platform in defendant. So is that part of that Sepp? And now we need to create or yeah, um, let's do it this way. And then we will transform the script toe. Ah, something like a fat file which you can use Oh, not, like, not like invoking by thoughts. Great. But with the fab come on. So what we need to do is to use the put. And we would like to put the playbook to the remote directory off home and see that user. And after that, we would like to run the as about playbook Benner that Thiemo with the argument device equal to device and that's basically it. Let's make it enough string. So it accepts the interpolation, and now we can create our banner that Thiemo So basically we only want to pass one arguments which is the horse that will come from the device. We do not need together facts and we will have two tasks. So the first task is named gone figure. Logan been there and gonna figure I m or d d been there. All right, Now we need to use the IOS Benner more. Your and the burner type is going to be logging, and the text is going to be a multi line text. So if you want, you can specify a single line text here after this, and this is going to get there. But if you have, like, a company template, you could say that welcome through the X Company is network device. Unauthorized? Excess is prohibited. All right, Now, the second is the message of the day. So we would like to use the banner type and t d with the text, and we will not be so creative. So welcome. Not where Come. This is the message off the they great. Now we can invoke the IOS banner that b y Whoa! Yeah. So I need to create the sea connection santo us? No, if everything goes well, Yeah, and the device is going to be Santos as well. If everything goes well, we should not face a roars. But we do connection type a sage is not really for this memorial. What? So I spend, uh and hold on. Hold on and should be hit 7200. Mm hmm. All right, now we almost succeeded. The ore, which I left intentionally here on this course, is that stating that the operation requires privilege escalation. So in order to fix this, we need to go to the Santo s machine and edit our and Zuber group wars IOS that gmo. So basically, we would like toa odd. The become yes, the ends of ah become method and a bow and the answerable become password fabric. Great. Now, if you go back, we should be able to successfully execute the script. But who knows? So it says that these two both have changed, and now we should test it. So in order to test this, I'm going to bring up terminal. And if I just simply tried toe ssh to this device on the 1 92 168 56 6 it will give me an ad or and we can solve these by specifying the dash. Oh, and it is going to need the tax key exchange. All go the the equals. Plus this one which is mentioned here. This is a pretty old device emulated so and the The next thing is the cipher. So let's the cipher as well. Desh. I see. And no, you can see that we are welcomed to the company's natural device. Unauthorized access is prohibited. Great. Come on, Fab Rick. But I'm using the wrong with that. So fab Rik and Fab Rik. Great. So first we have the logging manner than the message of the day banner. Now, what we need or should do is to transform this to ah, Fab Five. So last three name our current warm oil l the B y. Let's create the fine the B y, and from fabric we will import the task. Yeah, and we would also like to import the US manure, and we would like to steal the playbook on. And now we would like to create a task, and this is going to be in the corn figure, Logan M o d d. And we need an argument, which is the scene. The connection object. And we would like to specify a device and the now we can also steal these two lines. So basically, we would like to put the playbook to the remote system then execute. Let's make it lower case on the remote device. So fab list. And if we should a fab dish age sent us. Dash dash device C 7200. You worked. Come on. Oh, hold on. We need to specify the task that we would like to execute and then the device where we want to execute it. Mm. Oh, yeah. This is commented out. And now it is supposed to be working, but we will get back the okay because we already have configured it. If you want, you could transform this to a command which takes the log in and the motd. But ah, I would like to leave it. Us. Ah, practice for you. So see you in the next one. 20. Fabric & Ansible Ios Tshoot: Hello there. And welcome back in the studio We are going toe create Ah, file which is going toe Allow us toe troubleshoot issues when I was devices So let's create our file We just got a Fab Five that be why and from fabric We will import the task and we will import the U S when you're and we will create a playbook variable and let's just steal it from here. So basically, we would like to make it I wasin the abundant and it is going to be court t shoot that Yemen and ah, now we should define our task. Let's call it the shoot And we will say we need to add on argument which will be the device that we would like the troubleshoot so device and ah, now what we would like to do is to use to see that but on the playbook to the remote directory which is home, see, user and we would like to run dance about playbook. They shoot that Yemma with the argument device equals two device. Let's, uh, make it enough string so that it is able to run No, recreate the t shoot that the m O and ah, basically, this is just, like boilerplate for a playbook toe be used as troubleshooting. So hold on together Here. This is the device that we would like troubleshoot. So, based on your environment or infrastructure, you may use a different approach the troubleshoot if there is anything wrong with your natural device. But, um what I would like toa show you Is that how you can create the playbook that is executed toe execute remote commands for troubleshooting. So gather facts is no and the tasks is going to be What wrong with device And we were used IOS command module to execute the following co months. So first we would like to show i p int brief show version and being 1 92 168 56 that one. All right, this is really just the boilerplate for that. And let's ah, execute this. So if issued a fab that stash list, we see that the T shoot is available. So fab Dash H said the West Dash Dash device C 7200 and the shoot. Now we copy the playbook and that we have, like, successful, executed these. But how do we get the old put from this Komen's so there is something called Register and we can define a very able which is going to hold the old boot from the commands. So let's call it off put and we can you with now the results dusk to debug message and out put for now. So the divine when you come used to print out different messages contents of very Abel's unanswerable and this is what we would like to do. So now if you run it once again, we can see that. Ah, this seems to be working. So we have the STD outlines or that study out. Let's ah referenced the STD out. Now, if you're on this once again, we will see a different off. Great. Now we have the both put in Ah, like a row state and ah, what we can do here is to like further process. It's so check out for any relevant messages for our investigation and what not? But if you want, we can referenced the STD out lions, and these are going to provide us with, like, a little bit more broken down output. So this is the wrong message and technically, that's what I wanted to show you. Now we can see the interface status is the version and the status of the being off the gateway, which is supposed to be available. You could say that you assigned like a failed win or success when very able when you find a specific output in there. But maybe that's different video for a different time to you in the next room. 21. Fabric & Ansible The End: Hello there. And welcome back. I may just my back, um, so basically in the city or you're going to talk about the next steps. So, uh, throughout this course, you got to be familiar with the fabric and how you can utilize it to automate your task. You have got done to be familiar with how you can like proxy answerable playbooks to execute specifics, tasks on when those devices network device is line news devices. And, um, in my opinion, you have the foundation that is necessary to get by with this solution with the combination off answerable. Now, what you need to do is tow Inspect deeper the documentation as to how you can realize your ideas. And I also have the represent Torrey, which is going to support you throughout this journey. So I cannot guarantee that you will have everything that you need as a solution inside this repository. But it will give you, ah, heads up or ah, guiding line as to where you should go. And basically, that was all I wanted to Dave in this video. If you like the scores, please make sure to leave. Ah review. Tell me what was wrong what was good and just basically give me feedback so that I can improve on my next courses to you in the next time.