How industries are solving challenges using Ansible.

What is ansible?

Ansible is an open-source software provisioning, configuration management, and application-deployment tool enabling infrastructure as code

How Ansible works

In Ansible, there are two categories of computers: the control node and managed nodes. The control node is a computer that runs Ansible. There must be at least one control node, although a backup control node may also exist. A managed node is any device being managed by the control node.

Benefits of Using Ansible :

  1. Agentless: As long as a connection can be SSHed and it has Python, it can be configured with Ansible; No agent/software or additional firewall ports are required to install on our client or host systems for automation. Also, we don’t have to worry about setting up and managing the infrastructure.
    2. Simple: As we’ve seen, Ansible uses a very simple syntax written in YAML known as playbooks — YAML (Yet Another Markup Language) is a human-readable data serialization language. We don’t need special coding skills to code and understand playbooks. It is very easy to install and execute tasks in order.
    3. Modular: Ansible is modular as we require only one program per script. This way, we can spread our programs across different servers.
    4. Efficient: Not requiring any extra software on our servers means that there is more space for our resources.
    5. Powerful and flexible: Having powerful features gives us the capability to model even complex IT workflows in lesser time, along with managing infrastructure, networks, operating systems, and services that are already in use.

Ansible components


The “inventory” is a configuration file where you define the host information. In the above /etc/ansible/hosts example, we declared two servers under test-hosts.


In most cases — especially in enterprise environments — you should use Ansible playbooks. A playbook is where you define how to apply policies, declare configurations, orchestrate steps and launch tasks either synchronously or asynchronously on your servers. Each playbook is composed of one or more “plays”. Playbooks are normally maintained and managed in a version control system like Git. They are expressed in YAML (Yet Another Markup Language).


Playbooks contain plays. Plays are essentially groups of tasks that are performed on defined hosts to enforce your defined functions. Each play must specify a host or group of hosts. For example, using:

– hosts: all


Tasks are actions carried out by playbooks. One example of a task in an Apache playbook is:

- name: Install Apache httpd


A role is the Ansible way of bundling automation content and making it reusable. Roles are organizational components that can be assigned to a set of hosts to organize tasks. Therefore, instead of creating a monolithic playbook, we can create multiple roles, with each role assigned to complete a unit of work. For example a webserver role can be defined to install Apache and Varnish on a specified group of servers.


Handlers are similar to tasks except that a handler will be executed only when it is called by an event. For example, a handler that will start the httpd service after a task installed httpd. The handler is called by the [notify] directive. Important: the name of the notify directive and the handler must be the same.


Templates files are based on Python’s Jinja2 template engine and have a .j2 extension. You can, if you need, place contents of your index.html file into a template file. But the real power of these files comes when you use variables. You can use Ansible’s [facts] and even call custom variables in these template files.


As the name suggests, you can include custom-made variables in your playbooks. Variables can be defined in five different ways:

- "/path/to/var/file"
# ansible-playbook apache-install.yml -e "http-port=80"
vars: http_port: 80

Sample Playbook:

- hosts: all
- name: Install Apache httpd
yum: pkg=httpd state=installed
- Start Httpd
- name: Start httpd
service: name=httpd state=started
# ansible-playbook apache-install.yml  --ask-pass -u "ansibleadmin"

Use cases of Ansible




Arista’s software driven cloud networking model is helping to redefine cloud architectures as data centers adapt to achieve better agility and economy. Arista enables the use of standard provisioning and automation systems such as Ansible through our open Linux approach, bringing Net-Ops and Dev-Ops unification.

Integrated Solution

Arista has been committed to open standards and to modern software from the inception of the company. We believe that innovation within these frameworks drives customer success and permits our customers to build true multi-vendor networks. Our customers want choices, not proprietary lock-in.

  • Ansible can communicate with your Arista switch using using CLI or eAPI. The CLI-based connection utilizes SSH to securely manage your device.
  • Leverages existing EOS CLI or TACACS users which provides built-in authorization.
  • Add vEOS instances and a build tool like Jenkins to create an end to end continuous testing solution.
  • Arista EOS modules include: eAPI, command, config and template.

Solution Benefits

The combined Ansible and Arista solution provides:

  • No third-party EOS extensions required
  • No additional switch configuration required
  • Complete control of your configuration with idempotency built in
  • Make intelligent, dynamic decisions in your playbooks
  • Enables continuous compliance of EOS configuration


  • Patching updates went from a multi-day process to 45 minutes
  • Achieving near real-time RAM and disk monitoring (accomplished without agents)
  • Provisioning OS Accounts across entire environment in under 10 minutes
  • Baselining standard AMIs went from 1 hour of manual configuration to becoming an invisible and seamless background process
  • Application stack set up from 1–2 hours to under 10 minutes per stack


The National Aeronautics and Space Administration (NASA) is the agency of the United States government that is responsible for the nation’s civilian space program and for aeronautics and aerospace research.

Thanks, for reading…

Keep Learning Keep Sharing !!!