Skip to content

arista-netdevops-community/arista_eos_automation_with_ansible

Repository files navigation

GitHub

Table of content

About this repository
Playbooks description
Repository structure
Network topology

About this repository

This repository has Ansible playbooks examples to automate Arista EOS.

Playbooks description

The playbooks are at the root of this repository. The playbooks name is playbook_*.yml.

These playbooks update devices configuration:

These playbooks collect data from devices:

These playbooks validate the devices states:

  • playbook_validate_states.yml validates the devices states.
    It is used to validate this lab.
    The validation covers HW model, SW release, environment (cooling, temperature, power), interfaces status, LLDP topology, BGP sessions, IP reachability tests.
    It compares the actual states with the desired states, and reports mismatches.

    • The desired states are described in variables (host_vars and group_vars directories). So we reuse the same variables we already used to generate the configuration files.
    • The actual states are the states on the devices. To get the actual states, it runs show commands with a json output, and parses the output.
    • This playbook is interresting for CI because if a test fails, the pipeline will fail (either all the tests pass, or, the pipeline fails).
  • playbook_generate_audit_report.yml audits the devices and generates this humans readable report.
    It is used to audit this lab.
    The audit covers HW model, SW release, environment (cooling, temperature, power), interfaces status, LLDP topology, BGP sessions, IP reachability tests.
    It compares the actual states with the desired states and generates a report:

    • The desired states are described in variables (host_vars and group_vars directories). So we reuse the same variables we already used to generate the configuration files.
    • The actual states are the states on the devices.
    • It runs show commands with a json representation and registers the outputs in variables. It doesnt process the data collected.
    • Then it renders a template to generate the report. The data processing (data parsing and data comparaison) is done by the template (not by the playbook).
    • This playbook doesnt fail if a test fails (because this playbook doesn’t run the tests itself, the tests are ran by the template). So as example if a bgp session is not established the playbook will not fail but the report generated by the template will highlight this issue.

Repository structure

  • The playbooks are at the root of this repository. The playbooks name is playbook_*.yml.
  • The inventory file is inventory.ini
  • The variables are defined in the host_vars and group_vars directories
  • The directory templates has the jinja templates used by the playbooks
  • The directory roles has the roles used by the playbooks
  • The directory outputs has the playbooks output
  • The requirements file is requirements.txt
  • The Ansible config file is ansible.cfg

Network topology

3 EOS devices connected in a triangle topology and configured with EBGP

topology.png