Check out a free preview of the full Developer Productivity course
The "Ansible Overview" Lesson is part of the full, Developer Productivity course featured in this preview video. Here's what you'd learn in this lesson:
The Primeagen introduces the cloud configuration platform Ansible and briefly discusses the structure of Ansible files and tasks which are written in YAML. Ansible is an automation engine that can help streamline the process of setting up a new computer.
Transcript from the "Ansible Overview" Lesson
[00:00:00]
>> So actually, I'm gonna change the problem statement. I have a new computer, this is legitimately the problem. You are now gonna spend the next two days of your life, setting up your machine being partially productive. And for the next month to two months of your life, you're gonna remember all these little scripts, all these little things, these little libraries that you had to help you build.
[00:00:18]
Everything that's just kinda gone into your system you're gonna go, yeah I gotta go do that, I gotta go remember what is the thing I need to go download to get my system working the way I want it to be working. And so that's what we want kinda fix right now, and I find this one to be huge because the average tenure at a tech company right now somewhere between 18 months to two years.
[00:00:39]
So in the next year and a half you're guaranteed pretty much to be getting a new computer, this is gonna be very painful experience. You don't want it let's just solve that now. So you in the future can look back at you in the present, and go wow, what that's so smart.
[00:00:56]
I was just the smartest person that ever lived on earth and it just feels really good. You can pat yourself on the back everything, the worst part though about a new computer is, SSH keys. SSH keys are single handling the worst thing now here's the thing is, I'm not one of those psychics that stand up on stage, and call out into the audience.
[00:01:14]
But I'm pretty sure that there's someone in this audience, right? I can see it, hold on. Yeah, I can feel it. There's someone in this audience right now. That has an email, probably titled something like Davy Jones's Locker found, and it actually contains your actual SSH keys because you wanna be really tricky.
[00:01:31]
You're gonna throw off hackers if they ever get your email account. But nonetheless, you have your SSH key either emailed to you, or on a private GitHub in a repo. No public facing companies have ever been hacked, I'm positive, you're never gonna be in trouble having your SSH keys out there.
[00:01:47]
Everything is gonna be great, right? So, SSH keys, they're terrible, right? So if only there was a solution to all these problems, man it's like someone should be talking about it right now. So we're gonna talk about Ansible. Ansible is the solution, at least as far as I can tell, it's one of the better solutions I've ever used.
[00:02:08]
If anyone's familiar with it, the first thing you're probably saying is, isn't that some sort of cloud configuration thing? Something like Koobernetes, yes, it is a cloud configuration tool, as I've heard of ones best described, at least as far as I can tell, the best description. It is the thing that carries the Leviathan to Tokyo.
[00:02:28]
And Kubernetes is the thing that destroys Tokyo, it's the Leviathan. And so that's how I heard someone describe it once, it's fantastic. But yes, Ansible is a cloud configuration platform. So we're gonna talk about Ansible for a second I'm gonna show you how we use it. And we're gonna even take that previous example, and extend it to make a system.
[00:02:45]
Where I could instantly get up a brand new Docker container within the speed of my internet, and the installation process time to be up and running, and ready to be used. And so here's really the anatomy of an Ansible task, all right? Or an Ansible file. It's just gonna look like this, It's gonna have hosts.
[00:03:03]
We don't need to worry about that. We're just using our local host. We're just building it for ourselves. It's not a complicated version. Become simply means you're gonna become the user that's using it. So hopefully you have all the privileges on your system you need. You can even pass in your password at execution time.
[00:03:18]
So can do all the pseudo operations at the correct level, and installed in the correct places. You can do pre tasks, you can say, hey, I need to run these tasks, before everything else. You can set up variables so just in case you want to be able to say like, here is where my dot files are.
[00:03:31]
Well, you can set it as a variable. So instead of having to manually type out that path all the time, you can have it defined on the top level. And then of course, a list of tasks to do. It's in yamo, which I don't really understand yamo that well, I can kinda use it It feels like fake JSON.
[00:03:46]
I don't really know what to do with it, but it's kinda fun to use. And then of course, the task looks something like this. It has a name, that's a string, it performs some action, and then you can give it a list of tags. There's other options as well but that's pretty much what you'll be doing.
Learn Straight from the Experts Who Shape the Modern Web
- In-depth Courses
- Industry Leading Experts
- Learning Paths
- Live Interactive Workshops