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

Configure global BGP protocol settings on Cisco IOS-XR

| "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 devices running Cisco IOS-XR

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: configure global bgp as 65000
  iosxr_bgp:
    bgp_as: 65000
    router_id: 1.1.1.1
    neighbors:
      - neighbor: 182.168.10.1
        remote_as: 500
        description: PEER_1
      - neighbor: 192.168.20.1
        remote_as: 500
        update_source: GigabitEthernet 0/0/0/0
    address_family:
      - name: ipv4
        cast: unicast
        networks:
          - network: 192.168.2.0/23
          - network: 10.0.0.0/8
        redistribute:
          - protocol: ospf
            id: 400
            metric: 110
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: remove bgp as 65000 from config
  ios_bgp:
    bgp_as: 65000
    state: absent

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
          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.).
              network:
                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:
              id:
                description:
                - Identifier for the routing protocol for configuring redistribute information.
                - Valid for protocols 'ospf', 'eigrp', 'isis' and 'ospfv3'.
              metric:
                description:
                - Specifies the metric for redistributed routes.
              protocol:
                choices:
                - ospf
                - ospfv3
                - eigrp
                - isis
                - static
                - connected
                - lisp
                - mobile
                - rip
                - subscriber
                description:
                - Specifies the protocol for configuring redistribute information.
                required: true
              route_map:
                description:
                - Specifies the route map reference.
          safi:
            choices:
            - flowspec
            - unicast
            - multicast
            - labeled-unicast
            default: unicast
            description:
            - Specifies the type of cast for the address family.
      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:
          advertisement_interval:
            description:
            - Specifies the minimum interval (in seconds) between sending BGP routing
              updates.
            - The range is from 0 to 600.
            type: int
          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 0 to 255.
            type: int
          enabled:
            description:
            - Administratively shutdown or enable a neighbor.
            type: bool
          neighbor:
            description:
            - Neighbor router address.
            required: true
          password:
            description:
            - Password to authenticate the BGP peer connection.
          remote_as:
            description:
            - Remote AS of the BGP neighbor to configure.
            required: true
            type: int
          tcp_mss:
            description:
            - Specifies the TCP initial maximum segment size to use.
            - The range is from 68 to 10000.
            type: int
          timers:
            description:
            - Specifies BGP neighbor timer related configurations.
            suboptions:
              holdtime:
                description:
                - Interval after not receiving a keepalive message that the software declares
                  a peer dead.
                - The range is from 3 to 65535.
                required: true
                type: int
              keepalive:
                description:
                - Frequency with which the Cisco IOS-XR software sends keepalive messages
                  to its peer.
                - The range is from 0 to 65535.
                required: true
                type: int
              min_neighbor_holdtime:
                description:
                - Interval specifying the minimum acceptable hold-time from a BGP neighbor.
                - The minimum acceptable hold-time must be less than, or equal to, the
                  interval specified in the holdtime argument.
                - The range is from 3 to 65535.
                type: int
          update_source:
            description:
            - Source of the routing updates.
      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 65000
  - bgp router-id 1.1.1.1
  - neighbor 182.168.10.1 remote-as 500
  - neighbor 182.168.10.1 description PEER_1
  - neighbor 192.168.20.1 remote-as 500
  - neighbor 192.168.20.1 update-source GigabitEthernet0/0/0/0
  - address-family ipv4 unicast
  - redistribute ospf 400 metric 110
  - network 192.168.2.0/23
  - network 10.0.0.0/8
  - exit
  type: list