Guide On Ansible Architecture Terminology & Functionalities – DS
Ansible is a powerful IT automation tool from which you can manage, configure, upgrade, etc.
Software/tasks on your remote machines like VMs, and servers, as well as your own local machines.
- The main advantage of an ansible tool is that it can do repetitive tasks on multiple machines.
- Ansible is idempotent means if tasks are already performed on the machine and then Ansible does not change the machine state on multiple calls. It first checks whether the task is already performed or not.
- Ansible is agentless means we don’t need to install any additional or specific software for working on the host’s machines.
- We can write our instructions in simple YAML data format.
- Ansible instructions are just like English imperative sentences.
Let’s quickly familiarize ourselves with Ansible Architecture. If we know the architecture well then working with ansible is comparatively easy. Ansible architecture consists of the following terminology.
- Public or Private Cloud
Modules are the scripts that is executed on the host machines by the Ansible. Ansible first sets the modules on the respective machines and get desired state of the system and pass these in the modules via parameters. Ansible then executes these modules (over SSH by default), and removes them when finished.
Each module calls another module via the API and it also serves as the connection between cloud services.
Plugins are also similar to modules but it executed by Ansible on the machine where it is installed so that all the reporting, controlling, fetching playbook, inventory, and config files are done by the Ansible engine.
Inventory is simple YAML or INI files. It contains the list of all host machines of their IP address or FQDN (Fully Qualified Domain Name) names. For Linux/Unix type machines, ansible uses the SSH connection and for Windows machines, it uses the Winrm connection type.
Playbooks are simple YAML files. Let’s understand the playbook with a sample –
In the above image text, instructions are written in YAML format. Playbooks mainly contain hosts, plays, tasks, and modules. These playbook keywords serve Ansible engine to understand our requirements and perform the desired job on the host machines.
Here the users are us who interact with Ansible. We write our instructions in the yaml playbook. Ansible then read our playbook and perform the task on the host machines.
7) CMDB (Configuration Management Database)
CMDB act as data warehouse of IT assets. It defines the relationships between various IT assets.
Networking helps ansible to connect the host machines which have different type of network hardware’s. Networking makes ansible agentless. Ansible is configured in this way that it can connect the host machines as per need. If host machines are window based then it uses winrm connection which invoke the window powershell and if host machines are linux/unix based then it connect with ssh, and similary so on.
Hosts are the machines on which we want to configure, manage, control or perform specific tasks on them. It may be physical machine or Virtual machine or cloud system, etc.
10) Public or Private Cloud
We can integrate the cloud to store, manage and process the data so that these are not done on the local machine where ansible is installed. From this way we can secure data and avoid data loss during failures if occurred.
Functionalities of Ansible Tool
First we have setup the inventory file and after then write the playbook. When playbook is run then ansible first organize the variables related to the host and then check the syntax of the playbook. If playbook syntax is correct then it makes the connection to the host. After successful connection establishment then it executes the task on the machines.