The important terminologies which we have in an Ansible Architecture:
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.
- Controller node refers this
ansible.cfg
to connect and work with ansible client nodes. - Ansible will use SSH to connect to all the remote servers and executes the tasks in parallel
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.
- Since we are not installing any agent or additional software on the client nodes, ansible is referred as agent less
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.
Modules
- Ansible ships with a number of modules (called the module library) that can be executed directly on remote hosts or through playbooks.
- Tasks in playbooks call modules to do the work.
- 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. For an idea of how many modules Ansible includes, take a look at the list of all modules.
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.
Lab Environment
This is the design architecture of my lab environment which I will use to demonstrate this Ansible Tutorial
I am using AWS Ec2 Instances to setup my environment for this Ansible Tutorial. You can easily signup with AWS Free Tier account which can help you setup your own environment and learn Ansible. I am not affiliated with AWS in any manner and this is just a signup link which you may choose to use.
Resources | Instance-1 | Instance-2 | Instance-3 | Instance-4 |
---|---|---|---|---|
Hostname | controller | server1 | server2 | server3 |
IP Address | 172.31.7.253 | 172.31.4.189 | 172.31.23.18 | 172.31.14.46 |
RAM | 1GB | 1GB | 1GB | 1GB |
Storage | 10GB | 10GB | 10GB | 10GB |
During the initial stage of tutorial I will be only using server1
and server2
while server3
will be added later during the course of this tutorial. Any how over the course of this Ansible tutorial I will be creating multiple instances.
What's Next
In the next section of our Ansible Tutorial we will prepare our setup before we install and configure Ansible