Architecting Network Automation with Ansible and Arista EOS

The convergence of infrastructure as code and network engineering has transitioned from a luxury to a technical necessity in modern data center environments. At the center of this evolution is the synergy between the Red Hat Ansible Automation Platform and Arista Networks' Extensible Operating System (EOS). This integration allows network architects to treat their physical and virtual switching fabric as software, utilizing a declarative approach to manage complex topologies. Ansible, an open-source automation engine released in 2012 and subsequently acquired by Red Hat in 2015, provides a robust framework for server software provisioning, configuration management, and application deployment. When applied to Arista EOS, it eliminates the fragility of manual Command Line Interface (CLI) entries, replacing them with idempotent playbooks that ensure the network state remains consistent across hundreds of devices.

The operational power of this pairing lies in its agentless architecture. Unlike legacy management tools that require proprietary software agents to be installed on the target hardware—which can consume CPU cycles and introduce security vulnerabilities—Ansible utilizes standard communication protocols. For Arista devices, this typically involves the eAPI (extensible API) or the Arista CloudVision Portal. The Ansible server acts as the central control node, communicating directly with the network devices or through CloudVision, which then orchestrates the changes on the hardware. This decoupled architecture ensures that the management plane remains lightweight while providing the operator with a centralized point of control, typically accessed via an SSH terminal session.

The Arista EOS Ecosystem and Linux Foundations

Arista Networks, founded in 2004 by former Cisco employees, designed EOS to be fundamentally different from traditional monolithic network operating systems. While many vendors utilize proprietary kernels, EOS is built upon a standard Linux foundation. This architectural decision is critical because it allows the operating system to be extensible. Network engineers can access the underlying Linux shell to run standard Linux applications or deploy Docker containers directly on the switch.

This Linux-based approach creates a bridge between traditional network administration and modern DevOps practices. Because the CLI of Arista EOS is intentionally similar to Cisco's, the transition for engineers moving from Cisco-centric environments to Arista is seamless. This similarity extends to the automation layer, where playbooks designed for one may be adapted for the other with minimal friction. Arista hardware, ranging from high-density top-of-rack switches to high-capacity BGP-speaking edge and transit routers (supporting 10G, 40G, and 100G ports), is designed to be managed at scale, which is where the Ansible integration becomes indispensable.

Technical Deep Dive into the arista.eos Collection

The arista.eos collection is the primary set of Ansible content dedicated to the management of Arista EOS network appliances. This collection is a prepackaged group of components—including modules, plugins, and roles—distributed via Ansible Galaxy.

Collection Installation and Management

To integrate the arista.eos capabilities into an Ansible environment, the collection must be installed on the control node. This can be achieved through the Ansible Galaxy CLI using the following command:

bash ansible-galaxy collection install arista.eos

For enterprise environments requiring version control and reproducible builds, the collection should be defined in a requirements.yml file. This ensures that every member of the DevOps team is using the same version of the collection. The format for the requirements.yml file is as follows:

```yaml

collections: - name: arista.eos ```

Once the requirements file is created, the installation is executed with the following command:

bash ansible-galaxy collection install -r requirements.yml

Versioning and Compatibility

The stability of network automation depends on strict version alignment. The arista.eos collection has been rigorously tested against Arista EOS version 4.24.6F. Furthermore, the collection requires Ansible versions 2.16.0 or higher to function correctly. Because plugins and modules within a collection may be pinned to specific versions of the Ansible core, users must verify the metadata of the collection to ensure compatibility with their current automation engine.

Utilizing Fully Qualified Collection Namespaces (FQCN)

In modern Ansible development, the use of Fully Qualified Collection Namespaces (FQN) is mandatory to avoid naming collisions between different collections. For example, when managing Layer 2 interfaces, the module is called as arista.eos.eos_l2_interfaces.

A practical application of this is the replacement of configuration for specific L2 interfaces. The following YAML snippet demonstrates how to use the FQCN to configure a trunk port with specific VLANs:

```yaml

  • name: Replace device configuration of specified L2 interfaces with provided configuration. arista.eos.eosl2interfaces: config:
    • name: Ethernet1 trunk: nativevlan: 20 trunkvlans: 5-10, 15 state: replaced ```

In this scenario, the state: replaced parameter ensures that any existing configuration on Ethernet1 that does not match the provided specification is removed, bringing the device into the exact desired state.

Arista AVD: The Opinionated Automation Framework

While the arista.eos collection provides the raw tools (modules) to change settings, the arista.avd (Arista Validated Designs) collection provides the intelligence. AVD is described as an "opinionated" collection, meaning it does not just offer tools, but implements specific best-practice rules and guidelines derived from actual field experiences at Arista customer sites.

The Role of AVD in Fabric Design

When designing complex network fabrics, such as EVPN/VXLAN L3LS (Layer 3 Leaf Spine), engineers typically spend significant time studying Arista Design and Deployment Guides. AVD abstracts this complexity. Instead of manually translating a PDF guide into a series of CLI commands, the AVD collection implements those rules automatically. This allows users to deploy Data Center, Campus, and Wide Area Networks (WAN) without inventing the configuration from scratch.

Integration with CloudVision

AVD is fully integrated with Arista CloudVision, creating a powerful closed-loop automation cycle. This integration provides several advanced capabilities:

  • Change Control Workflow: Ensures that changes are vetted before being pushed to production.
  • Continuous Compliance Check: Monitors the network to ensure no "manual" changes have drifted from the Ansible-defined state.
  • Network Topology Overview: Provides a visual representation of the fabric.
  • Real-time Streaming Telemetry: Includes flow-based data and performance metrics.

Implementation and Configuration Workflow

Deploying Ansible for Arista requires a specific sequence of configuration on both the control node and the network hardware to ensure secure and reliable communication.

Device-Side Prerequisites

Before Ansible can manage an EOS device, the device must be prepared to accept connections. The following steps are required on the Arista switch:

  1. Create a dedicated user with administrative privileges (Privilege level 15).
  2. Set an enable password for privileged exec mode.
  3. Assign a unique hostname to the device.

The following commands demonstrate the setup process:

text arista> enable arista# conf t username ansible privilege 15 secret 0 $PASSWORD-HERE$ enable password 0 $ENABLE-PASSWORD$ hostname arista-01 arista-01(config)# end arista-01# copy running-config startup-config

It is critical to execute copy running-config startup-config to ensure that these settings persist after a reboot. Arista EOS uses SHA512 for password encryption by default and has SSH enabled out of the box.

Ansible Control Node Configuration

The connection between the Ansible server and the EOS device is governed by specific variables. These variables define how Ansible should authenticate and interact with the device.

Variable Required Value Purpose
ansible_user ansible The username used for SSH authentication
ansible_connection network_cli Specifies the use of the network CLI connection plugin
ansible_network_os eos Informs Ansible that the target is running Arista EOS
ansible_become yes Indicates that privilege escalation is required
ansible_become_method enable Specifies the enable command for escalation
ansible_become_password [PASSWORD] The password for the enable secret

Inventory and Verification

The inventory file maps the logical group name to the physical IP addresses of the devices. A typical inventory for Arista devices would look like this:

ini [arista] arista-01 ansible_host=10.15.30.43 arista-02 ansible_host=10.15.30.44

To verify connectivity and ensure that the arista.eos modules are working, the eos_facts module can be used. This module retrieves system information from the device. The following command tests connectivity by attempting to grep the hostname from the facts returned by the devices:

bash ansible arista -m eos_facts | grep -i hostname

The expected output for a successful connection would be: "ansible_net_hostname": "arista-01", "ansible_net_hostname": "arista-02",

Advanced Environmental Considerations: vEOS and Virtualization

When implementing Arista automation in a lab environment using vEOS (virtual EOS), certain technical limitations may arise. In specific deployments using KVM or Hyper-V, there are documented issues where vEOS images may fail to receive frames with tagged VLANs, even when the images are successfully sending them. This suggests a potential drop at the kernel level of the hypervisor or within the vEOS image itself.

To circumvent this limitation, the recommended architectural approach is to avoid VLAN bridges and instead utilize dedicated interfaces and bridges between the network server (e.g., netsvr-01) and the vEOS instances. This ensures that traffic flows without being dropped due to tagging issues, allowing the Ansible playbooks to be tested in a virtual environment before being deployed to physical hardware.

Idempotency and the Automation Philosophy

A core tenet of the Red Hat Ansible platform is idempotency. In the context of Arista network automation, idempotency means that the outcome of an operation is performed only once and only if necessary, regardless of how many times the playbook is executed.

For example, if a playbook defines that Ethernet1 should be in VLAN 20, and the device is already in VLAN 20, Ansible will report a status of "OK" and make no changes. If the device is in VLAN 10, Ansible will apply the change and report "Changed." This prevents unnecessary writes to the NVRAM of the switch and eliminates the risk of causing network flaps by repeatedly applying the same configuration.

Community Support and Contribution Channels

The arista.eos collection is a community-driven project. Users can engage with the ecosystem and seek technical assistance through several specialized channels:

  • Ansible Forum: The primary location for getting help or contributing knowledge.
  • Network-Tagged Posts: A specific stream for all collection-related conversations.
  • Ansible Network Automation Working Group: A dedicated team focused on the evolution of network modules.
  • Ansible Bullhorn Newsletter: The official channel for announcing new releases and critical changes.

Contributions to the collection are encouraged through the creation of Pull Requests (PRs) or by opening issues in the Arista EOS collection repository. All contributors are expected to adhere to the Ansible project's Code of Conduct.

Conclusion

The integration of Ansible with Arista EOS represents a shift from traditional "box-by-box" management to a holistic, fabric-wide orchestration model. By leveraging the arista.eos collection for granular control and the arista.avd collection for architectural best practices, organizations can deploy highly scalable, compliant, and predictable networks. The use of an agentless, idempotent framework ensures that the network remains stable and that the "source of truth" resides in the code rather than in the volatile memory of individual switches. As Arista continues to embrace its Linux foundations, the synergy with Ansible will likely expand to include more deep-level OS integration, further blurring the line between software engineering and network administration.

Sources

  1. GitHub - ansible-collections/arista.eos
  2. Arista AVD - Intro to Ansible and AVD
  3. YetiOps - Ansible for Networking Part 5: Arista EOS

Related Posts