The course is part of these learning paths
Getting Started With Ansible
Cloud platforms, on-prem servers, dozens of operating systems, more language and frameworks than you can count, and you have to manage it all!
These days even the "simple" application infrastructures have a lot of moving parts. Managing all of this stuff effectively takes some effort, and configuration management tools such as Ansible can help.
Ansible is an automation engine that can help with provisioning infrastructure, configuring operating systems, deploying applications, and much more.
The goal of this course is to teach you how to get started using Ansible for automation. By then end of this course you should be able to create playbooks to automate basic tasks. You won't know everything there is to know about Ansible, however you'll know enough of the basics to start using Ansible. You'll understand how Ansible manages inventory, how to create simple modules, how to create playbooks, how to deal with errors and more.
Understanding a tool such as Ansible has a lot of value to developers and operations engineers. Especially since it's agentless, because that means you can start managing hosts without needing to install an agent on them first. Well, assuming Python is installed. Developers can use Ansible to automate the creation of development environments that mirror production. And operations can use the same playbooks to automate the creation of staging and production environments. This level of consistency between environments tends to reduce bugs; especially those caused from environmental differences.
One of the features of Ansible that makes it so appealing is that it allows you to create modules with whatever language you want. Another appealing feature is the YAML based playbooks. The reason this is so appealing is that YAML tends to be a very simple format for expressing tasks. And that makes it easier to get started using it.
What You'll Learn
|Lecture||What you'll learn|
|Intro||What will be covered in this course|
|What is Ansible?||An introduction to Ansible|
|Concepts||An overview of the Ansible concepts|
|Installation||How to install Ansible|
|Inventory||How Ansible knows which servers to manage|
|Windows||How Ansible connects to Windows servers|
|Modules||What modules are and how to create one|
|Playbook||What playbooks are and how to create them|
|Handlers, Facts, Variables, and Templates||Handlers, Facts, Variables, and Templates|
|Roles||How to bundle functionality in a role|
|Errors and Debugging||How to deal with errors and how to use the debug module|
|Next Steps||How to keep learning|
If you have thoughts or suggestions for this course, please contact Cloud Academy at email@example.com.
About the Author
Ben Lambert is the Director of Engineering and was previously the lead author for DevOps and Microsoft Azure training content at Cloud Academy. His courses and learning paths covered Cloud Ecosystem technologies such as DC/OS, configuration management tools, and containers. As a software engineer, Ben’s experience includes building highly available web and mobile apps.
When he’s not building the first platform to run and measure enterprise transformation initiatives at Cloud Academy, he’s hiking, camping, or creating video games.
Welcome back, in this lesson I'll be presenting an overview of Ansible. I'll cover what it is, some of its common use cases, and how it compares to other configuration management tools.
So let's start out by talking about what it is. Ansible is basically an automation engine, which is a rather simple description for something that's so powerful. It allows you to specify the tasks that you want to run on one or more servers in a fairly simple format. Ansible uses the YAML syntax. If you're not familiar with YAML it's a human friendly data serialisation format, which I'll cover more in depth later in the course.
With Ansible you can provision environments. You can configure your operating systems, you can deploy applications, you can even perform compliance checks, and these are just a few of the common use cases.
Let's go through these each a bit more. If your application requires infrastructure to support it, someone needs to set that up, and if you could automate it you'd save a lot of time and effort. Ansible allows you to specify how your infrastructure should look and it will create it for you. So if you're using a Cloud platform such as AWS, and you need auto scaling groups and RDS database, a load balancer and everything in between you could automate the creation and set up with Ansible.
If you're using virtual machines then you'll likely need to be configuring the operating system of those VMs, and that's another area that Ansible can help with. It allows you to specify the state that services and settings should be in, and it takes care of making sure that happens. For example, you could ensure that the Apache2 service is running. You could also ensure that a service such as Telnet is not running.
Another common use case is for application deployment, which Ansible makes fairly easy. You can specify the individual tasks that are required to deploy your app, and Ansible will execute them, and it will let you know the status of each task.
For example, you could have one task to download your application artifact, another to install it, and so on. And when Ansible executes these task it tells you if the task is changed since the last execution, you could also use Ansible for compliance checks. You can create tasks to do things such as setting firewall rules, enable and disable services, etcetera, and because Ansible is idempotent you can run the tasks as often as needed and report on the changes.
Idempotency means that the tasks are only run if the state you specify isn't currently met. An example of idempotency would be if you have a task that installs MySQL the first time it runs on a new server it will install MySQL the next time you run it nothing will happen, because MySQL is already installed.
Ansible isn't the only option when it comes to IT automation, there are quite a few tools out there that accomplish the same thing in different ways, and two popular options are Chef and Puppet. Ansible is a bit different than both of these in that it doesn't require an agent to be installed on the system that you're going to configure, however, it does require Python on any Linux servers you want to manage and PowerShell on any Windows servers.
Ansible uses the YAML syntax as we've mentioned, where Chef and Puppet use a Ruby Domain Specific Language, though Puppet also offers its own syntax that you can use, and none of these differences make either one intrinsically better. All three options are great tools and which one you select will come down to the features they support and the ease of use for your specific team. If your team already has Python skills then using Ansible may be a good option, because Ansible is written in Python and if your team is already familiar with it then custom development becomes easier.
Okay let's wrap up the lesson here. In the next lesson I'll run through the high level terms and concepts of Ansible. So if you're ready to keep learning then let's get started in the next lesson.