arista.eos-bgp
BGP Role for EOS
The arista.eos-bgp
role simplifies the setup of BGP on EOS devices. With this role, you don’t need to write any specific Ansible tasks. Just create an object with the required information below, and this role will handle the configuration for you.
This role allows configurations for BGP routers, timers, neighbors, networks, and listeners.
Installation
To install the role, run:
ansible-galaxy install arista.eos-bgp
Requirements
You need an SSH connection to your Arista device. You can use existing EOS connection variables or the provider
dictionary for convenience.
Role Variables
The role uses two main objects to control tasks: bgp
, eos_purge_bgp_networks
, and eos_purge_bgp_neighbors
.
eos_purge_bgp_networks
Key | Type | Notes |
---|---|---|
eos_purge_bgp_networks | boolean: true, false* | Turns on/off the purging feature for BGP Networks. |
eos_purge_bgp_neighbors
Key | Type | Notes |
---|---|---|
eos_purge_bgp_neighbors | boolean: true, false* | Turns on/off the purging feature for BGP Neighbors. |
bgp (dictionary) - each entry has the following keys:
Key | Type | Notes |
---|---|---|
bgp_as | string (required) | BGP autonomous system number. |
enable | boolean: true, false* | Enables or disables the BGP routing process. |
maximum_paths | int | Maximum number of parallel routes (default is 1). |
maximum_ecmp_paths | int | Maximum number of ECMP paths (check your Arista docs). |
log_neighbor_changes | boolean: true*, false | Log neighbor changes. |
redistribute | list | Types of routes to redistribute. |
timers | dictionary | Configuration for timers. |
timers.keep_alive | int: 0-15 | Keep-alive value in seconds (default is 60). |
timers.hold | string | Hold timer value (0 or 3 to 7200, default is 180). |
state | choices: present*, absent | Set BGP router configuration state. |
neighbors | list | Configuration for neighbors. |
listeners | list | Configuration for listeners. |
networks | list | Configuration for networks. |
Note: Asterisk (*) means it's the default value if none specified.
Configuration Variables
Key | Choices | Description |
---|---|---|
eos_save_running_config | true*, false | Whether to save changes to the running-config in memory. |
Note: Asterisk (*) means it's the default value if none specified.
Connection Variables
Ansible EOS roles need the following connection details:
Key | Required | Description |
---|---|---|
host | yes | DNS hostname or address of the remote device. |
port | no | Port number for the connection (defaults to standard ports if not provided). |
username | no | Username for connection authentication. |
password | no | Password for connection authentication. |
ssh_keyfile | no | SSH keyfile for connection authentication. |
authorize | no | Enter privileged mode before running commands. |
auth_pass | no | Password for entering privileged mode. |
transport | yes | Connection method: cli (ssh) or eapi. |
use_ssl | no | Use SSL for eapi connections only if set to true. |
provider | no | Pass all connection arguments as a dictionary. |
Note: Asterisk (*) means it's the default value if none specified.
Ansible Variables
Key | Choices | Description |
---|---|---|
no_log | true, false* | Prevents logging of module arguments and output. |
Note: Asterisk (*) means it's the default value if none specified.
Dependencies
The eos-bgp role uses core Ansible modules, added in Ansible version 2.1.
- Ansible 2.1.0
Example Playbook
Here's an example of using the arista.eos-bgp
role to set up BGP configurations without writing tasks. Create a hosts
file with your switch, a host_vars
file, and a simple playbook that references the eos-bgp
role.
Sample hosts file:
[leafs]
leaf1.example.com
Sample host_vars/leaf1.example.com:
provider:
host: "{{ inventory_hostname }}"
username: admin
password: admin
use_ssl: no
authorize: yes
transport: cli
bgp:
enable: true
bgp_as: 65001
maximum_paths: 25
maximum_ecmp_paths: 100
redistribute:
- connected
- aggregate
log_neighbor_changes: yes
timers:
keep_alive: 0
hold: 0
neighbors:
- name: 10.1.1.1
remote_as: 65002
peer_group: demoleaf
enable: true
fall_over_bfd: true
- name: 10.1.1.3
remote_as: 65002
peer_group: demoleaf
enable: true
listeners:
- name: 10.1.0.0/16
peer_group: demoleaf
remote_as: 65003
eos_purge_bgp_networks: no
eos_purge_bgp_neighbors: no
Simple playbook (leaf.yml):
- hosts: leafs
roles:
- arista.eos-bgp
To run the playbook, use:
ansible-playbook -i hosts leaf.yml
Developer Information
Contributions are welcome. For more details, refer to the Arista Roles for Ansible - Development Guidelines.
License
Copyright (c) 2015, Arista Networks EOS+ All rights reserved.
Redistribution and modifications are allowed under certain conditions.
Author Information
For issues or feedback, use our GitHub repository or email us at ansible-dev@arista.com.
Role for managing EOS BGP configuration
ansible-galaxy install arista.eos-bgp