Difficulty: Beginner
Estimated Time: 10 minutes

Ansible is one of the easiest yet powerful configuration management tool you will come across. It helps you to document your infrastructure as code. This helps us to replicate mirror of our infrastructure whenever and wherever we want with ease. Ansible also comes with more than 450 modules (just like plug ins) which does the actual work. Enough with the introduction, Now let's get our hands dirty.

Don’t stop now! The next scenario will only take about 10 minutes to complete.

Ansible Introduction

Create a configuration for Ansible

Ansible, by default, uses /etc/ansible/ansible.cfg as its configuration file. This can be overridden by having our own configuration file in the project directory. Create a file name ansible.cfg in the editor and add the following content.

[defaults] inventory=myhosts.ini

Now create a file called myhosts.ini, which is an inventory file. The inventory file is more like a list of hosts file dedicated for Ansible.
The myhosts.ini file should contain the following content.

[local] localhost ansible_connection=local

Here [local] represents the group name of the hosts. Since we are testing Ansible on a single machine, the inventory file a has only one entry (localhost).

Terminal Host 2