hello everyone my name is calvin and welcome back today we're going to be revisiting our ansible awx install guide we had originally done this in a live stream format and which was great for communication back and forth asking questions and seeing things go wrong and how to troubleshoot but ultimately all that proved in my perspective to be a distraction from the actual installation guide so today i'm going to walk you through a bare bones install of ansible awx i'm going to be deviating from the developers installation guide for a specific reason i'll talk about here but instead of their preference for using minicube we're going to be deploying a actual kubernetes environment this is going to enable first of all the service to be available upon reboot second of all other users on the network can access it and honestly i just think it's an easier approach than to use something like minicube minicube is great for developers who need to spin something up and then change some code and then you know kind of redeploy it but for us in this case i need it to be accessible for by others on my environment and from external services like slack and servicenow gonna need to be able to hit that ansible awx so i feel like this approach by using rancher to deploy kubernetes is significantly better all right now a little bit about my environment i'm going to be using a virtual machine within vmware's vcenter now if you're using workstation vmware fusion kvm virtualbox vagrant doesn't matter but it's got to be a linux distribution to run kubernetes there are linuxy things that kubernetes expects things like system paths directories binaries etc so kubernetes does require you to be running inside of a linux environment so we're going to be doing this deployment based on a vanilla ubuntu 20.0.4 linux install nothing really done to it um so that you have a good enough context as to kind of what the order of operations is to be successful here so the first thing i'm going to do is i'm going to log into my vmware vcenter and i'm going to look at my virtual machine that we're going to be deploying ansible awx upon in this case my virtual machine's got 4 cpus it's got 8 gigs ram and a 60 gig hard drive which by today's standards is not really a whole lot you probably can find a mount that amount of resources to carve out of your system in order to kind of follow along here or you can just do the cloud that's always an option too if you've got the money for it so i'm going to log in here into my linux install my linux distribution here and there's an important piece of information i want us to kind of gather and that is this ip address that we have right here there's a whole lot of information that kind of is presented here in this message of the day banner that ubuntu provides you some of it is garbanzo beans don't need to relay about it but really this middle section here is the meat and potatoes and then specifically for our case we want to grab that ip address that's presented here because that's what we're going to be accessing when we or that's the ip address we're going to be sshing into and it's also going to be the ip address that we use to access ansible awx from a web browser so make a mental note of that iep address before you proceed now here's where i'm going to start recommending some alternative ideas to what we had done previously specifically i'm going to be using a product called microsoft visual studio code to not only handle the ssh connection to this virtual machine but also to create files that will be required for us to to spin up ansible in kubernetes and those types of things so the very next step that i'm going to take here is i'm going to reach out to my friend google and i'm going to look up microsoft visual studio code downloads and this is a product that's open source it's cross-platform so it doesn't really matter if you're on linux windows or or mac or anything else in between there will be a install binary here selected for you now in my case i'm on windows so i'm going to be using the windows install and actually already have it installed on my system so i'm just going to skip a few steps i'm going to take for granted that you know how to go through a standard microsoft install process as you can suspect it's a lot of next next next done type of things all right now after we have visual studio code open what i'm going to do is i'm going to look to the right hand side of my window here and i'm going to look for these little square boxes and that's where the extensions can be installed i'm specifically looking for an extension called remote ssh now this is owned and maintained and developed by microsoft so don't feel too nervous about installing the extension it is a microsoft extension into a microsoft product you can have a nice little warm comfort blanket that you know you're not going to download anything malicious here now this extension is critical for us what it enables us to do is have visual studio code connect to the remote server the linux server over that ip address that we had grabbed earlier and so what it does is it changes the entire context of visual studio code to make it look and feel like you're operating on your local machine but in reality visual studio code has an ssh connection to the remote server so what we get with this is that we have the ability to do things like open up a command line terminal bash issue all the commands on the remote server but just do it locally within our own environment so after installing it you're going to look to the bottom left of your screen here for the open remote window and in my case i like to select connect or connect current window to the windows host and there are a couple of different options there basically the connect current window to the remote host basically will prevent visual studio code from opening up another instance of visual studio code just to manage that remote session now in this case i'm going to select add a new ssh host we only have to do this one time as you can see the previous sessions that i've ssh into they stay cached here but in this case let's just walk through a vanilla install so i'm going to say add a new ssh host i type in my command ssh my username at and i look again at that ip address that we had captured after the vm had successfully booted up and we logged in i'm going to select my ssh key although it's not already on the remote system visual studio code just needs something to go off of and then in the very bottom right hand corner of our page after we've entered all the required information visual studio code will give us a pop-up and say hey there is a new host added would you like to open the configuration maybe make some changes or would you like to connect to it and that's what we're going to select we're going to say connect to that remote host which again will then have visual studio code build the ssh section to the remote device after you've entered your password here and will enable you to look around and feel like you're directly consoled into that remote host but you're just doing it through visual studio code super super slick really love this kind of workflow so the next thing for us to do is we're going to open up the the remote systems uh terminal by hitting the tilde which is underneath the escape key for all of these for those like me that just had a look where it was placed on the keyboard it's directly underneath the escape keys the tilde day if you're in another country it might be something else i just i don't know and so after you hit that key you're going to get a pop-up window at the bottom and it's going to take up about half of your screen by default now what i like to do is i like to maximize this by hitting the up arrow on the right hand side this will take the terminal and make it full screen and yes you can click the down arrow to kind of revert that and you can even click the x to close the terminal out but this is where we're going to be spending most of our time so it's good to at least kind of get comfortable with that now and the very first thing and this isn't required but this is the very first thing i like to do when i've got a brand new linux install is i like to just run an update and an upgrade on the system basically telling the linux system hey go ahead look to see if there are any new packages out there that i need to grab and then go ahead and perform the upgrade we do that by typing in sudo apt update and i like to concatenate the two commands together so two ampersands and then sudo apt upgrade dash y and you'll see in my case there's reaching out to all the remote packages and it looks like it had one which was lib firewall udp plug-in one needed uh or is telling me that it's uh was installed is no longer required all right so we're good to go i'm going to go ahead and clear the screen now and now for us to install kubernetes let's go ahead and move to the official documentation so back in my web browser i'm going to browse over into the rancher documentation and there is a single curl command that will get kubernetes up and running within your environment now let's pause timeout for a second this is not a kubernetes conversation kubernetes is a requirement for ansible awx there are good reasons for that specifically execution environments uh however we're going to be really sticking with a single host so non-clustered kubernetes uh it's very very lightweight and uh but it doesn't have like things like high availability or scale out functions or anything along those lines so just know that yes we're installing kubernetes but don't get too worried it's again as you can see it's just a single command and it's not going to be it's not going to be akin to some of the larger kubernetes scale out deployments which get pretty difficult all right so again we're just going to go ahead and copy this curl command here and we're going to return to visual studio code and paste it in here now what this does is this grabs a remote script uh from get.k3s.io and then it pipes the script to the output of a shell command so it's basically a way to download and execute a script all at once and what this is actually doing is amongst other things it's grabbing a bunch of kubernetes uh binaries that are required things like cubectl and others and it's also creating the right directories creating config files and probably most important at least i think so is that it creates the kubernetes process as a as associated to system d which is a fancy way of saying you can control whether or not kubernetes starts up on reboot or whether it's on or it's off you can disable it you can do all those things from the traditional system ctl within a linux distro so very very nice very very handy within that single curl command we've got kubernetes up and running so again not too difficult there's a there's a lot to kubernetes but we're not going to go down there now i want to check out the version of my kubernetes install just again just to validate that it's working properly so i'm going to type in this command cube ctl dash dash version and it looks like that is the incorrect command because i get some help context that comes back the kubernetes binary comes back and says hey listen you passed in dash dash version but we don't recognize that and it doesn't recognize it because it's not the right command the right command here is cube ctl version so we'll go ahead and update this and when we execute it we get an error message that comes into our screen that error message isn't to say that kubernetes isn't online and working or that something's broken instead it's saying hey look there's a file that kind of maps out your kubernetes environment it's stored in etsy rancher k3s k3s.yaml and your permissions as a user are not sufficient to operate that file so fair enough uh we will need to make some changes on the permissions of that file but first before we do that let me just make sure that we can use sudo to get elevated privileges again just to validate that kubernetes is actually up and operational so i'm going to run the same command this time with the word sudo in front of it to give me elevated privileges and we get some output that looks like it's all hunky-dory okay so the first thing let's do let's go ahead and look at the permissions of this file so if we type in ls dash lsa and the name of the file what it's going to do is it's going to present us with the path of the file but also all the permissions that are associated to it now when we issue this we can see that it's owned by the root user within the root group that's how you see the words root root right next to it and that's fine as long as you have root privileges but i don't natively so i want to actually change this file to be open and readable and editable by myself now your environment's going to be different your username is going to be different your groups are going to be different in my case i'm going to go ahead and type in the the who am i command and i'm going to get the name of my current user in this case it's c dot and i'm gonna look at groups and i'm gonna find out what groups my username is associated with and as you can see here c dot is one of those i'm gonna go ahead and make this etsy rancher k3s k3s yaml file i'm gonna make it uh edible edit and not edible edit a bowl by myself based on my permissions so i'm gonna type in a command sudo change ownership type in my username a colon and then my group and then the path of the file in my case that's c dot colon c dot and then the path of our etsy i'm sorry our kubernetes config file now when i issue the commands cube ctl version i get that same output that we got when we had issued it before within elevated privileges this is just a way of preventing you from having to type in sudo every single time i want to check the status of my environment so i'm going to say cube ctl get nodes and we can see the output here as i see my host name i see the status is ready i can see the role that this device plays and the version and how long it's been up and operational cool let's check to see if there's any workloads that are running right now on my kubernetes environment they're not should not be any but we'll just go ahead and type in this command here cubectl getpods and we can see that there are no resources found in the default namespace now i just want to focus on those last two words for a second default namespace think of this put your network engineer hat on for a second and think of a namespace as a vrf in the routing world right it's a virtual router so you can have things like overlapping objects or overlapping prefixes in a vrf and it's it's all just associated within this virtual context of a namespace same idea here within kubernetes we have a default namespace and you have the opportunity of creating other namespaces and then you can store your resources within those namespaces it greatly simplifies operating at scale in our case we're probably just going to be using the awx namespace but again it helps you keep things nice and clean helps you allocate resources to the appropriate spaces all right in our case again we had no no workloads currently in our our default namespace so the next thing for us to do is to revisit the documentation for ansible awx again we're going to skip through all their mini cube installs because i don't think it's it's necessarily fit for our purpose here but what they do have is they have a link to install customize customize is a tool that's going to help us build a kubernetes environment based on some parameters that we pass and what we're looking for specifically ansible awx is going to need to have what's called an awx operator and the operators is what's going to handle the actual download and installation and provisioning of ansible awx inside of your kubernetes environment the way that i like to think about this there's there's customize and then there's the awx operator and then there's the actual awx application that we're going to be hosting the awx operator to me is kind of like a um a an architect right it's like you you go out to an architect to say hey i want you to build something come over here the architect's like okay i'm over here i'm ready for some kind of instructions on what you're looking to build and then we will pass that operator a file and that which will tell it exactly how to build our ansible awx environment and at that point the operator will go and it'll download the necessary components it'll spin things up in the appropriate fashion connect things together and at the end of the day we've got a working building in terms of architect but in our case we'll have a working installation of ansible awx but before we can reach out and grab that architect or that operator for this analogy we need to have something like customize that will enable us to go out and grab that or reach out and grab that operator so customize is a part of the kubernetes package as well uh it's just an additional binary that we'll need to download from the internet so i highly recommend going to the first going to ansible awx click on the customize link go to the installation guide click on binaries and then grab this curl command i'm not going to read it all out because it's really long and then paste that back into your environment now that gives us the customized binary on our linux host but what i need to do is i need to move that binary to somewhere within my linux install that is within the path and basically uh if you've never worked in a linux world before there's a subset of directories that your linux operating system will look for an executable for a command that you type so i need to move customize into one of those directories and in my case i'm going to move it into user local bin so sudo move the customer uh the customized binary and then point to uh user local bin now when i type in a command which customized meaning i'm asking linux hey if i issue the customize command which which path are you going to use for that and it comes back and says use your local bin so we know we're good to go for issuing customized commands now our next step is going to find us using the other feature the other half of visual studio code we're going to now start managing text files here on our remote system so i'm going to start by clicking on a new file and i'm going to say new text file and i'm going to pass in our very first file here in order to build the ansible awx director remember to kind of pull in that architect to oversee our construction of awx so in order to do that i type in this command or paste in this text right here again this text is also available on the ansible awx in case you like to copy and paste like i do but it's critical it's critical that you save this file as customization dot yaml don't name it anything other than this i think you might be able to get away with customize customization.yml instead of dot y a ml but for for my sake it's just i i've worked with y a m l for the file extension for yaml for a long time so i'm kind of hardcoded that way but just make sure that the name of the file is customization just like i have it spelled here uh and then what we're going to do is we're going to kick off the customization binary point to our local directory and then pipe that output to the kubernetes binary called cubectl at the end of the day all this is going to do is this is going to kick off the the building of our ansible awx operator this is the second to last step before we have a working production environment all right so now i can see that we've created some resources within our kubernetes environment through customize if i run the command to look at our workloads now if i type in cubectl get pods and if i just hit enter right now it's going to say hey there's no resources found in the default namespace which is true because if you look back up to our customization file above we said we want the name of the namespace to be awx so what we need to do in with our command is we need to say cubectl getpods dash dash namespace and then the name of our namespace which is awx so i'm going to type in that right here and what we can see is that the ansible awx operator is currently being built specifically we can see it say that the container is in the creation phase and that if you look at the ready column ready is zero out of two so there's two resources two resources associated to the operator and neither of them are ready right now ultimately it takes about a minute for the operator to be online and operational so let's go ahead and hit our up arrow here we can see that now resources are two out of two ready and the status is running so the final step promise you the final step to getting the ansible awx commands over to the operator is we need to create one more file and we're going to call this file awx.yaml and we're going to pass it a few set of instructions the only thing that i really want you to to look at is the very last line what we're telling kubernetes is that we want the web service of ansible awx to be exposed on port 30 080 right now if you for some reason have a conflict something else is running on 30 080 on your linux machine wow what a coincidence but if you need to you can make an adjustment here and change it to any kind of a non-standard port you should be good to go all right again we're going to save this as awx.yaml you you can probably get away with yml again i'm just a little old-school i guess i'm hard-coded into why aml so i don't know if i'll ever change that either but now we have the awx instructions available what we now need to do is we need to pass them into that operator and the way that we do that is we revisit our customization.yaml file and we will add a new line where we'll give it the the name of the file that we just passed in here so let's go back over into the customization.yaml on the resources line let's go ahead and create a new line hit a a dash there to represent a new entry and then give it the name of the file in my case it was awx.yaml we're going to run that same customize build operation that we had done previously so you can probably just hit the up arrow inside of your terminal and and execute it and what you'll see is that more resources have been created now the the awx operator those resources were unchanged and they'll they'll list it here in this output they'll say hey it's unchanged but all the new stuff that we included in the awx file is now been incorporated and it will say configured here all right now this part of the process will take up to i don't know maybe 10 minutes or so for ansible awx to fully build it's going to build databases it's going to build web applications it's going to stitch all these things together it's going to create a destination nat again to let you access awx on that port of 30 080. there's a lot of things that will be ultimately going on here and so what i like to do is i like to take this opportunity to open up a new terminal here within vs code and i do that by moving to the right of the screen and you'll see a little plus arrow i'm going to go ahead and click that and then i'm going to watch all of the logs that come out of my kubernetes environment so specifically regarding the awx operator so we're this is a a mechanism for us to kind of sit and watch all the things that are taking place and and once it's complete we'll know that we're ready to access the system i like to do this in a separate console you don't have to but the command is super long so again i just highly recommend you go to the ansible awx hub copy the command that they use to to view the logs and you can just kind of follow along as well all right now this is the exact output that we're looking for specifically we want to see the words play recap and i'll have your local host underneath it and say how many were okay how many changed unreachable and failed i want you to pay attention to the to make sure that none of the the unreachable column is zero and the failed column is zero if either of those are greater than zero something wrong happened in the install and you might just have to kind of blow away your awx operator and redeploy it but now that we feel like it looks like it's completed i'm going to again look at the pods within my awx namespace and now i can see in addition to the operator we also have a postgres database and we have a an awx pod which has got four resources currently running inside of it that's going to be things like its message bus and the web applications and other things now there's one last thing it's not regarding the building we've got awx up and operational right now but there is a password that was generated during the build process and we need to ask kubernetes to reveal that to us the command is super long it looks pretty um unorthodox if you've never done this type of thing before so again go to the awx github and grab the actual command and paste it into your console and it's going to come back and present you with your admin password to log into the system in my case it starts right here it started on the same line as my command so it's a little difficult for us to kind of pull apart but it is this phrase that i've got listed here under the red highlighting so i'm going to go ahead and copy that to my clipboard and we'll use that as our admin password to log in to ansible awx now let's make sure that we can reach this and everything is up and operational i'm going to open up a new tab i'm going to type in the ip address of my linux virtual machine and again on port 30 080 here let me turn off dark mode for a second there we go now we can see that we've got a login prompt and type in admin i'm going to make sure that my password is in my clipboard because there's no way i'm going to be able to remember this or at least type it correctly so let me just go ahead and paste it here and log in voila okay very cool so we can see that we've got ansible awx up and operational um this we're going to probably end the video right here i'm not going to go into too much of a setup guide for ansible awx although i'll just leave you with this like usually my preferred way of building a new awx environment i start at credentials credentials are typically used uh in almost all the other aspects of of like a project or a template or you know all these things so i i create credentials for things like my ssh passwords my ssh keys my github account all that type of stuff and then i'll be able to start provisioning the rest of ansible awx out but that's it that's it everybody uh i know it took about half an hour for everything to get up and operational but hopefully this kind of streamlined approach is a little bit easier to digest than the live stream video we did last time as always if you run into any problems if you have any types of challenges feel free to comment down below share your experiences were you successful did you fail i'd like to know there's opportunities i have to help out sometimes so those comments can kind of help me understand whether or not things are blowing up for you again thanks for taking the time hang out with me my name is calvin and we'll see you in our next video where we actually go through the setup instantiation of ansible awx for production ready environment all right thanks everybody enjoy the rest of your day