DEV Community

Cover image for ANSIBLE ARCHITECTURE & WORKING
Jobin Keecheril
Jobin Keecheril

Posted on

ANSIBLE ARCHITECTURE & WORKING

Alt Text

Hey guys! Let's look on Ansible architecture and it's working.

Terminologies in Ansible:

Control node

Any machine with Ansible installed. You can run commands and playbooks, invoking /usr/bin/ansible or /usr/bin/ansible-playbook, from any control node. You can use any computer that has Python installed on it as a control node - laptops, shared desktops, and servers can all run Ansible. However, you cannot use a Windows machine as a control node. You can have multiple control nodes.

Managed nodes

The network devices (and/or servers) you manage with Ansible. Managed nodes are also sometimes called โ€œhostsโ€. Ansible is not installed on managed nodes.

Inventory

A list of managed nodes. An inventory file is also sometimes called a โ€œhostfileโ€. Your inventory can specify information like IP address for each managed node. An inventory can also organize managed nodes, creating and nesting groups for easier scaling. Inventories can be of two types static and dynamic, dynamic inventory can be covered while you go through Ansible thoroughly.

Modules

The units of code Ansible executes. Each module has a particular use, from administering users on a specific type of database to managing VLAN interfaces on a specific type of network device. You can invoke a single module with a task, or invoke several different modules in a playbook.

Tasks

The units of action in Ansible. You can execute a single task once with an ad-hoc command.

Playbooks

Ordered lists of tasks, saved so you can run those tasks in that order repeatedly. Playbooks can include variables as well as tasks. Playbooks are written in YAML and are easy to read, write, share and understand.

WORKING:

We can classify the Ansible architecture into 3 sections

  1. Ansible Users and Playbooks
  2. Ansible Engine
  3. Hosts and Networking

    The Ansible Engine consists of Inventory, API, Modules and Plugins. A user writes playbooks i.e. set of tasks, then the playbook scans the inventory and matches for the listed hosts or IP addresses where the tasks must be executed. Ansible copies all the modules to the managed node and using Python API calls and plugins Ansible completes the given tasks. Once the tasks are completed/executed all the modules are destroyed on the Managed Nodes. Ansible on linux executes the modules on managed hosts using SSH.

Please feel free to correct ;)

automation #devops #ansible #discuss #linux

Top comments (0)