Start course
1h 17m

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


Welcome back. In this lesson I'll be configuring the Windows Host so that Ansible can connect to it.

To start, there's a Python module that needs to exist on the control machine. It's called pywinrm. And it can be installed with Pip. So with that installed, you need to create and configure a group variable that contains the connection information.

So I'm gonna paste in some basic information from the documentation and then change the password. And there we go. And now I'll just save this file. WinRM requires port 5986 by default. Now you may recall that's not a port that I opened up when I created the Windows server in the previous lesson. So I need to go open that up in the firewall.

Okay. The final step is to run a PowerShell configuration script on the Windows Host. This is gonna configure WinRM so that Ansible can connect. So I need to connect to the Windows machine and I'm gonna use RDP for that. Then I'll copy the setup script from GitHub. I'll paste it into a new notepad file and I'll save that on the desktop as ansible.ps1. Now I'll start a PowerShell terminal as an admin and then drag that file onto the terminal and then click enter to run it.

Great, with this done let's test the connection by trying to ping the Windows Server with Ansible. Now previously I've used the ping module. However, Windows has its own separate ping module named win_ping. So if I test it out...there we go, it returns a success message. So that's a simple way to get started using Ansible for Windows.

Okay, I've mentioned modules dozens of times throughout the course so far and I haven't gone into much detail. However, that's gonna change in the next lesson. So if you're ready to learn about modules then let's get started in the next lesson.

About the Author
Learning Paths

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.