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 firstname.lastname@example.org.
Welcome back, in this lesson, I'll be installing Ansible on an Ubuntu 16.04 operating system. Ansible has some good documentation which includes information on installation. Let's check it out.
I'm going to browse to the installation page. Notice here, the section labelled Installing the Control Machine, that's what you want to do. While Ansible has modules that can interact with all kinds of different operating system including Windows, the control machine needs to be a Unix-based system. The control machine just means that it's the machine you'll be running Ansible from.
There are several options here that you can look into, however, the option that I want is the Ubuntu one. So, what I'll do is run these commands one by one until Ansible is installed.
For this course, I'll be using an Ubuntu VM that's running on my Mac as that control machine and while Ansible works on a Mac, I'm using Ubuntu because Ansible is already installed and configured on my Mac. And I want you to be able to see how to set things up.
So, with these all installed, I'm going to run the Ansible command with the --version flag and it returns the version info, in this case, it's 2.2. If you're going to setup your own control machine, you can use Vagrant to make it easier.
While Vagrant is outside of the scope of this course, here's a look at the Vagrant file that I'm using. If you're not familiar with Vagrant, it's a virtual machine manager. It allows you to use a file called a Vagrant file to specify what operating system to boot up and which directories from your host operating system to mount inside the virtual machine. Having the directories mounted inside the VM allows you to edit the files on the host OS and the VM will see those changes.
Okay so, this was a quick lesson, however, now that Ansible is installed, it's time to start diving into some of the concepts more in-depth. So, let's get started with the concept of inventory in the next lesson.
About the Author
Ben Lambert is a software engineer 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 software, he’s hiking, camping, or creating video games.