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