Introduction to Ansible - Part 1

Introduction to Ansible - Part 1

Written by Bobby Iliev on May 4th, 2020 Views Report Post

Introduction

When it comes to automation nowadays Ansible seems to be everyone's choice. By using Ansible you can automate and simplify repetitive and complex tasks and it is easy to get started with compared to other automation tools like Puppet for example.

In the next few blog posts, I would try to give a brief Ansible introduction and how to get started with Ansible. I strongly recommend that you follow through and test the things that you learn on your own!


Prerequisites

In order for you to be able to follow along you would need 3 servers:

    - 1 would be our 'master' node where we would install Ansible.

    - 1 Webserver

    - 1 Database server

I would be using DigitalOcean. To make things even better you can use my referral link to get a free $50 credit that you could use to deploy your virtual machines and test the guide yourself on a few DigitalOcean servers:

Digital Ocean $50 Free Credit


What is Ansible?

Ansible is an open-source agentless automation tool that enables you to easily configure and deploy systems.  It provides large productivity benefits to a wide variety of automation challenges.

Ansible is quite simple but yet really powerful. One of the main benefits of Ansible is that it operates over SSH so you don't need to rely on obscure protocols.

You can install Ansible on a single control server where you would have your host inventory files as well as your playbooks. And then you would use this server to control, configure and manage many different machines as long as you have SSH access.

The actual 'work' is done on the remote hosts so you don't need a massively overpowered master node.

Compared to other automation tools Ansible uses a simple syntax written in YAML called. YAML is a human-readable data serialization language so the learning curve is not as steep.


Ansible Documentation

If you want to be successful with Ansible, it is really important to know where to find the Ansible documentation as there are a lot of Ansible modules with different specifications and you should be able to find the documentation for those modules.

You can find the official documentation here:

https://docs.ansible.com

There is a lot of useful information on this page but the most important one is the Modules Index one:

https://docs.ansible.com/ansible/latest/modules/modules_by_category.html

There are thousands of well-documented modules and how to use them.


ansible-doc

You can also get the documentation directly via your terminal by using the ansible-doc command which is a plugin documentation tool.

It provides you with similar information as the docs.ansible.com site but the cool thing is that you would have that information right in your terminal. 

For example if you wanted to get information for the lineinfile module, you can just run the following command:

ansible-doc lineinfile

That way you would get the documentation regarding the module and all of its different parameters.

You can take a look at the man page for the ansible-doc command as well to see the different parameters that you could use:

https://docs.ansible.com/ansible/latest/cli/ansible-doc.html


Conclusion

Now you know what Ansible is and how to get to the Ansible documentation!

In the next post, I will go ahead and set up my three Virtual Machines on DigitalOcean and install Ansible on the master node.

Link to Part 2:

https://devdojo.com/articles/introduction-to-ansible-part-2

I hope that this was helpful! Let me know in case you have any questions!

Bobby

Comments (0)