ansible.builtin.eos_bgp (v2.9.27) — module

Configure global BGP protocol settings on Arista EOS.

| "added in version" 2.8 of ansible.builtin"

Authors: Nilashish Chakraborty (@NilashishC)

preview | supported by network

Install Ansible via pip

Install with pip install ansible==2.9.27

Description

This module provides configuration management of global BGP parameters on Arista EOS devices.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configure global bgp as 64496
  eos_bgp:
    config:
      bgp_as: 64496
      router_id: 192.0.2.1
      log_neighbor_changes: True
      neighbors:
        - neighbor: 203.0.113.5
          remote_as: 64511
          timers:
            keepalive: 300
            holdtime: 360
        - neighbor: 198.51.100.2
          remote_as: 64498
      networks:
        - prefix: 198.51.100.0
          route_map: RMAP_1
        - prefix: 192.0.2.0
          masklen: 23
      address_family:
        - afi: ipv4
          safi: unicast
          redistribute:
            - protocol: isis
              route_map: RMAP_1
    operation: merge
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure BGP neighbors
  eos_bgp:
    config:
      bgp_as: 64496
      neighbors:
        - neighbor: 192.0.2.10
          remote_as: 64496
          description: IBGP_NBR_1
          ebgp_multihop: 100
          timers:
            keepalive: 300
            holdtime: 360

        - neighbor: 192.0.2.15
          remote_as: 64496
          description: IBGP_NBR_2
          ebgp_multihop: 150
    operation: merge
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure root-level networks for BGP
  eos_bgp:
    config:
      bgp_as: 64496
      networks:
        - prefix: 203.0.113.0
          masklen: 27
          route_map: RMAP_1

        - prefix: 203.0.113.32
          masklen: 27
          route_map: RMAP_2
    operation: merge
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Configure BGP neighbors under address family mode
  eos_bgp:
    config:
      bgp_as: 64496
      address_family:
        - afi: ipv4
          neighbors:
            - neighbor: 203.0.113.10
              activate: yes
              default_originate: True

            - neighbor: 192.0.2.15
              activate: yes
              graceful_restart: True
    operation: merge
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: remove bgp as 64496 from config
  eos_bgp:
    config:
      bgp_as: 64496
    operation: delete

Inputs

    
config:
    description:
    - Specifies the BGP related configuration.
    suboptions:
      address_family:
        description:
        - Specifies BGP address family related configurations.
        suboptions:
          afi:
            choices:
            - ipv4
            - ipv6
            description:
            - Type of address family to configure.
            required: true
          neighbors:
            description:
            - Specifies BGP neighbor related configurations in Address Family configuration
              mode.
            suboptions:
              activate:
                description:
                - Enable the Address Family for this Neighbor.
                type: bool
              default_originate:
                description:
                - Originate default route to this neighbor.
                type: bool
              graceful_restart:
                description:
                - Enable/disable graceful restart mode for this neighbor.
                type: bool
              neighbor:
                description:
                - Neighbor router address.
                required: true
              weight:
                description:
                - Assign weight for routes learnt from this neighbor.
                - The range is from 0 to 65535
                type: int
          networks:
            description:
            - Specify Networks to announce via BGP.
            - For operation replace, this option is mutually exclusive with root level
              networks option.
            suboptions:
              masklen:
                description:
                - Subnet mask length for the Network to announce(e.g, 8, 16, 24, etc.).
              prefix:
                description:
                - Network ID to announce via BGP.
                required: true
              route_map:
                description:
                - Route map to modify the attributes.
          redistribute:
            description:
            - Specifies the redistribute information from another routing protocol.
            suboptions:
              protocol:
                description:
                - Specifies the protocol for configuring redistribute information.
                required: true
              route_map:
                description:
                - Specifies the route map reference.
      bgp_as:
        description:
        - Specifies the BGP Autonomous System (AS) number to configure on the device.
        required: true
        type: int
      log_neighbor_changes:
        description:
        - Enable/disable logging neighbor up/down and reset reason.
        type: bool
      neighbors:
        description:
        - Specifies BGP neighbor related configurations.
        suboptions:
          description:
            description:
            - Neighbor specific description.
          ebgp_multihop:
            description:
            - Specifies the maximum hop count for EBGP neighbors not on directly connected
              networks.
            - The range is from 1 to 255.
            type: int
          enabled:
            description:
            - Administratively shutdown or enable a neighbor.
          maximum_prefix:
            description:
            - Maximum number of prefixes to accept from this peer.
            - The range is from 0 to 4294967294.
            type: int
          neighbor:
            description:
            - Neighbor router address.
            required: true
          password:
            description:
            - Password to authenticate the BGP peer connection.
          peer_group:
            description:
            - Name of the peer group that the neighbor is a member of.
          remote_as:
            description:
            - Remote AS of the BGP neighbor to configure.
            required: true
            type: int
          remove_private_as:
            description:
            - Remove the private AS number from outbound updates.
            type: bool
          route_reflector_client:
            description:
            - Specify a neighbor as a route reflector client.
            type: bool
          timers:
            description:
            - Specifies BGP neighbor timer related configurations.
            suboptions:
              holdtime:
                description:
                - Interval (in seconds) after not receiving a keepalive message that device
                  declares a peer dead.
                - The range is from 3 to 7200.
                - Setting this value to 0 will not send keep-alives (hold forever).
                required: true
                type: int
              keepalive:
                description:
                - Frequency (in seconds) with which the device sends keepalive messages
                  to its peer.
                - The range is from 0 to 3600.
                required: true
                type: int
          update_source:
            description:
            - Source of the routing updates.
      networks:
        description:
        - Specify Networks to announce via BGP.
        - For operation replace, this option is mutually exclusive with networks option
          under address_family.
        - For operation replace, if the device already has an address family activated,
          this option is not allowed.
        suboptions:
          masklen:
            description:
            - Subnet mask length for the Network to announce(e.g, 8, 16, 24, etc.).
          prefix:
            description:
            - Network ID to announce via BGP.
            required: true
          route_map:
            description:
            - Route map to modify the attributes.
      redistribute:
        description:
        - Specifies the redistribute information from another routing protocol.
        suboptions:
          protocol:
            description:
            - Specifies the protocol for configuring redistribute information.
            required: true
          route_map:
            description:
            - Specifies the route map reference.
      router_id:
        default: null
        description:
        - Configures the BGP routing process router-id value.

operation:
    choices:
    - merge
    - replace
    - override
    - delete
    default: merge
    description:
    - Specifies the operation to be performed on the BGP process configured on the device.
    - In case of merge, the input configuration will be merged with the existing BGP configuration
      on the device.
    - In case of replace, if there is a diff between the existing configuration and the
      input configuration, the existing configuration will be replaced by the input configuration
      for every option that has the diff.
    - In case of override, all the existing BGP configuration will be removed from the
      device and replaced with the input configuration.
    - In case of delete the existing BGP configuration will be removed from the device.

Outputs

commands:
  description: The list of configuration mode commands to send to the device
  returned: always
  sample:
  - router bgp 64496
  - bgp router-id 192.0.2.1
  - bgp log-neighbor-changes
  - neighbor 203.0.113.5 remote-as 64511
  - neighbor 203.0.113.5 timers 300 360
  - neighbor 198.51.100.2 remote-as 64498
  - network 198.51.100.0 route-map RMAP_1
  - network 192.0.2.0 mask 255.255.254.0
  - address-family ipv4
  - redistribute isis route-map RMAP_1
  - exit-address-family
  type: list