Let’s talk about Ansible for a minute because besides all the hype these days, it’s actually pretty cool and can save you a lot of time and effort.
Before diving into Ansible too much, we should begin by setting the table and defining an ideal automation solution. In the webinar, Using Ansible to Modernize and Automate Workflows, Red Hat’s Walter Bentley (Automation Practice Lead) and Branden Pleines (Automation Consultant), identify four hallmark themes of what makes an Automation engine:
- A true automation engine gets rid of all the time between the traditionally manual process of switching between operating environments; thus, increasing speed.
- A true automation engine possesses a “write once and forget” capability which works to increase efficiency.
- A true automation engine focuses on increasing productivity by focusing on business improvement rather than infrastructure.
- Lastly, a true true automation engine abstracts code/commands away from the end user to improve accuracy.
For further clarification on the definition of automation, we suggest checking out an article called, “The Principles of Automation” by Matt Oswalt. In his article, Matt outlines three rules that define automation: The Rule of Algorithmic Thinking, The Rule of Bottlenecks, and The Rule of Autonomy.
- Roughly, The Rule of Algorithmic Thinking is defined as understanding that everything is a system and further, that humans are actually a component of a given system. The rule involves recognizing each part of a system and realizing that everything is simply an abstraction layer, including the human.
- The Rule of Bottlenecks is roughly defined as the concept that bad ideas typically propagate themselves (I think this is true for life itself, no?) and as a system matures bottlenecks are inevitable. The goal is not to eliminate bottlenecks but to have them be calculated, or planned.
- The Rule of Autonomy can likewise be defined as disproving the idea that automation means complete removal of the human element. Circling back to the rule of Algorithmic Thinking, humans are simply another abstraction layer in the system, and automation actually creates more opportunities for humans as it creates new opportunities for employees to focus on other aspects of the system that they normally wouldn’t have time for.
So why is automation so hot right now? It plays pretty big into that famous buzzword called DevOps. Just like you, I hate buzzwords.
As Albert Einstein said, “If you can’t explain it simply, you don’t understand it well enough.” so let’s translate DevOps into normal people speak because to be honest, it really isn’t that complicated. If you already know what DevOps is by the way, feel free to skip this section if you haven’t already done so. That said, we’re going to go ahead and lay down the law here:
- DevOps: A compound of the words “Development” and “Operations”. This term was coined to describe a relationshipbetween IT Operations and Development, with the intention of increasing collaboration and communication between Product Management, Development and Operations. It is important to note that DevOps is a methodology and as so, maybe be in different stages in every company. In this sense, DevOps can be thought of as a linear scale. At “company A”, no DevOps philosophies may be used at all, while in “company B”, Development, Management, and Operations may work closely together in their jobs. In “company C”, there may be a department called “DevOps”.
- Why is DevOps even useful? Well, just like many other philosophies, it can save time and money. Because Development, Management, and Operations would presumably work together on the sliding scale that is DevOps, “Agile Methodologies” (more buzzwords!) are achieved, which results in a decreased time to market. In achieving a decreased time to market, DevOps focuses on improving IT Automation, which comes right back to our main subject, using Ansible.
- For further breakdown on DevOps visit RackSpace’s YouTube video. Rackspace won our 2017 Innovator of The Year Award!
And now, the moment you’ve all been waiting for (maybe…). It’s time to finally start talking about Ansible! Let’s talk about it at a high level to set the table for some use cases.
The Ansible project is an open source community sponsored by Red Hat. It’s also a simple and agentless automation language that describes IT application environments in something called Ansible Playbooks, which you can think of as little premade packages of ready-to-roll automation commands. Red Hat has a two products around the Ansible Project: Ansible Engine is a supported command line interface product built upon the Ansible community project that’s great for small teams, developer, and engineers. Ansible Tower is an enterprise framework for designed for controlling, securing, managing and extending your Ansible automation (community or engine) with a super simplistic GUI and RESTful API. Ansible Tower allows for role-based access control, job scheduling, and more cool tools that you’d need for running larger operations. We know that keeping these two products separate can get a little bit confusing so here’s a page that explains this difference more in depth.
In general, automated tasks run linearly against an inventory in Ansible, and that’s basically nothing more than a fancy way of saying that tasks run in order – end to end. There are a couple exceptions to this where Ansible can employ a free strategy, where tasks are run simultaneously, but generally a linear strategy is a good way to think of how Ansible executes. With Ansible, commands are handled separately. To this end, Ansible offers loops but looping over shell commands doesn’t necessarily preserve the stuff in between because connections are independent from one another. Future commands can also act on the result of other commands with Ansible, which is pretty useful to be honest, and any changes can be applied conditionally.
We already touched a tad bit on Ansible playbooks, but because that’s kind of the backbone of Ansible, I’ll elaborate a little bit on them. As mentioned previously, you can think of Ansible as ready-to-go Automation packages that you can get right out of the box. You can also think of Ansible playbooks being like football playbooks – X’s and O’s. These playbooks are written as tasks, which are fully-vetted state-focused Python for Linux/Unix, or Powershell for Windows. The modules themselves can detect change. Playbooks also include traditional concepts like variables and conditionals, and leverage jinja2, which is a super powerful templating tool.
Use Cases for Ansible
So let’s say you’re a company with repetitive manual reboots of multiple servers (a hundred or so on a weekly basis), you’re probably aware that this causes a time suck,waiting until each server has no active user sessions. On top of that, every time your servers reboot, you’ve got to log on to the thing all over again, and you could probably be spending your time doing better things than that (maybe not, who knows…). You could also be forgetting certain servers, in which case you’ll likely extend this long and tedious process to other days. How does doing the same thing for about eight hours per day sound? Yeah, it’s not my idea of fun either.
The good news is that you can use Ansible to help remedy your job-time sufferings (For home-time sufferings I can’t help you – I’m not licensed for that.) With Ansible you can schedule shutdowns in the background to increase efficiency and allow you to focus on other tasks while you’re waiting on a lack of sessions.You can also set Ansible to reboot a certain percentage of servers certain servers, at a given time. Oh, and you’re not going to forget to reboot a server either because that’s done for you by Ansible.
Enforcing security standards is easier using Ansible, too. Let’s say your company has hundreds of virtual machines that need to be updated to be compliant with certain standards. Playbooks can be run on a schedule, and you can write these rules once (we may even have some of those rules in a ready-made playbook!) and apply them to as many of your environments as you’d like. As you can probably imagine, in much of the same way Ansible can help with configuration drift too, just run a playbook to help eliminate the problem.
You can watch Using Ansible to Modernize and Automate Workflows for more use cases (Walter and Branden run through about eight of them) but for the sake of your interest, let’s move on and talk about how you can start automating with Ansible.
Red Hat Consulting is a global service that can help you with everything from your initial strategy to hands-on-keyboard activity. Think of Red Hat Consulting as your mentor in your automation journey. Beginning with a Smart Start from Red Hat is a great first step to implementing Ansible. A Smart Start will summon Red Hat consultants to your job site to help you both install and implement Ansible for one of your processes (Y’know, so you can show your boss that it’s worth the company’s time and money).
Red Hat Consulting also offers a three phase rollout for your Automation initiative that starts with a free personalized Discovery Session. A typical Red Hat Discovery Session starts with a focus on uses cases and identification of challenges. Along with Red Hat Consulting, you’ll create an action plan together to address any opportunities for automation. Red Hat Consulting is a great way to see your automation transformation through from beginning to end, while being supported by the experts. Check out the Red Hat Consulting datasheet to learn more about Red Hat’s Discovery Sessions, and when you’re ready click here to talk to a Red Hat consultant.
As always, feel free to let us know your thoughts on automation, and any initiatives your organization might be involved in, in the comments section below.
Connect with Red Hat Services
Learn more about Red Hat Consulting
Learn more about Red Hat Training
Learn more about Red Hat Certification
Subscribe to the Training Newsletter
Follow Red Hat Services on Twitter
Follow Red Hat Open Innovation Labs on Twitter
Like Red Hat Services on Facebook
Watch Red Hat Training videos on YouTube
Follow Red Hat Certified Professionals on LinkedIn