DEV Community

Group3-kb84
Group3-kb84

Posted on • Updated on

Introduction to Ansible

Hey here! If you prefer a video over text, we've got you covered!

Ever wondered how cloud providers create virtual machines that "just work" so easily? The secret is that they use tools to quickly spin up and configure virtual machines for you, using tools that automate configuring these machines.

We will be talking about one of these configuration tools in this post, Ansible.

What's Ansible?

Ansible is a tool that is able to automate repetitive tasks and configure multiple machines at the same time. Ansible works with Python and is executable via the command line.

Ansible is meant to replace the custom scripts that server admin's previously wrote by themselves. Usually these scripts were used once and needed to be rewritten and redistributed every time something needed to change to the environment.

Ansible solves this problem, by giving you a way to

  • describe how you want to configure machines
  • deploy these configuration changes on demand

For example, you can automate:

  • Installing new software
  • adjusting passwords
  • updating system OS
  • adjusting security policies

Diagram describing the architecture of Ansible

The image above gives you a general overview of the architecture of Ansible. You can see that there is a Ubuntu server with Ansible installed. Ansible reads the playbook you created, and uses the hosts file and required modules to connect to the Windows hosts you want to configure.

We will talk in greater detail about each of these parts of Ansible in future posts. Just keep in mind for now that Ansible connects to machines to configure them the way you describe in the playbook.

You might also have noticed that we are only connecting to Windows machines. This is part of the example that we are going to use for this tutorial, which we will introduce now.

The final goal

We think that the best way to learn how to work with Ansible is by working towards a goal. Therefore we have thought of a scenario that we will use as a goal for this series:

An organization has recently created a new department. The company has bought a bunch of new machines for the employees that are going to work in the new building for the department. We are responsible for configuring the windows machines so that they match the company policies.

  • only administrators are allowed to install software on the machines.
  • every machine must have Firefox installed
    • installing extensions must be disabled.
    • disable advanced settings on Firefox (about:config page)
    • default homepage of the browser is https://bbc.com so that employees can track news about our company.

Why this example? There is a lack of tutorials that explain both installing & configuring and how to then use Ansible. These tend to be separate tutorials. We also specifically target windows machines for this tutorial, since Windows machines are the norm in most companies.

You are free to use a different scenario for yourself of course, but you will need to adjust parts of these tutorials to your situation.

Next up

In the next few posts we will be covering the following subjects:

  • Installing Ansible on a Ubuntu machine.
  • Modules, what they are, and which ones are available
  • combining modules with playbooks, to automate configuring machines.

See you there!

Top comments (0)