kayobe/ansible/roles/arista-switch
Michal Nasiadka 32489a4587 arista-switch: Fix eos_config call
eos_config does not support provider, nor connection: local from at
least 2022 [1] - since ansible>=7 (ansible-core 2.14).

[1]: 588d94b2ed

Closes-Bug: #2058365
Change-Id: Ief37b7bee758e34dddb881a9e68728013861c0ec
2024-09-06 17:55:08 +02:00
..
defaults Add support for Arista switches 2019-08-22 16:20:40 +02:00
tasks arista-switch: Fix eos_config call 2024-09-06 17:55:08 +02:00
templates Add support for Arista switches 2019-08-22 16:20:40 +02:00
README.md Add support for Arista switches 2019-08-22 16:20:40 +02:00

Arista Switch

This role configures Arista switches using the eos Ansible modules. It provides a fairly minimal abstraction of the configuration interface provided by the eos modules, allowing for application of arbitrary switch configuration options.

Requirements

The Ansible network modules for Arista require EOS 4.15 or later.

The switches should be configured to allow SSH access.

Role Variables

arista_switch_provider is authentication provider information passed as the provider argument to the eos modules.

arista_switch_config is a list of configuration lines to apply to the switch, and defaults to an empty list.

arista_switch_interface_config contains interface configuration. It is a dict mapping switch interface names to configuration dicts. Each dict may contain the following items:

  • description - a description to apply to the interface.
  • config - a list of per-interface configuration.

Dependencies

None

Example Playbook

The following playbook configures hosts in the arista-switches group. It assumes host variables for each switch holding the host, username and passwords. It applies global configuration for LLDP, and enables two 10G ethernet interfaces as switchports.

---
- name: Ensure Arista switches are configured
  hosts: arista-switches
  gather_facts: no
  roles:
    - role: arista-switch
      arista_switch_provider:
        host: "{{ switch_host }}"
        username: "{{ switch_user }}"
        password: "{{ switch_password }}"
        transport: cli
        authorize: yes
        auth_pass: "{{ switch_auth_pass }}"
        timeout: 60
      arista_switch_config:
        - "lldp run"
        - "lldp tlv-select system-name"
        - "lldp tlv-select management-address"
        - "lldp tlv-select port-description"
      arista_switch_interface_config:
        Et4/5:
          description: server-1
          config:
            - "no shutdown"
            - "switchport"
        Et4/7:
          description: server-2
          config:
            - "no shutdown"
            - "switchport"

Author Information

Based on the dell-switch role by Mark Goddard (mark@stackhpc.com)