Documentation

nxos_bgp_neighbor - Manages BGP neighbors configurations.

New in version 2.2.

Synopsis

  • Manages BGP neighbors configurations on NX-OS switches.

Options

parameter required default choices comments
asn
yes
BGP autonomous system number. Valid values are string, Integer in ASPLAIN or ASDOT notation.
capability_negotiation
no
  • true
  • false
Configure whether or not to negotiate capability with this neighbor.
connected_check
no
  • true
  • false
Configure whether or not to check for directly connected peer.
description
no
Description of the neighbor.
dynamic_capability
no
  • true
  • false
Configure whether or not to enable dynamic capability.
ebgp_multihop
no
Specify multihop TTL for a remote peer. Valid values are integers between 2 and 255, or keyword 'default' to disable this property.
host
yes
Specifies the DNS host name or address for connecting to the remote device over the specified transport. The value of host is used as the destination address for the transport.
local_as
no
Specify the local-as number for the eBGP neighbor. Valid values are String or Integer in ASPLAIN or ASDOT notation, or 'default', which means not to configure it.
log_neighbor_changes
no
  • enable
  • disable
  • inherit
Specify whether or not to enable log messages for neighbor up/down event.
low_memory_exempt
no
  • true
  • false
Specify whether or not to shut down this neighbor under memory pressure.
maximum_peers
no
Specify Maximum number of peers for this neighbor prefix Valid values are between 1 and 1000, or 'default', which does not impose the limit.
neighbor
yes
Neighbor Identifier. Valid values are string. Neighbors may use IPv4 or IPv6 notation, with or without prefix length.
password
no
Specifies the password to use to authenticate the connection to the remote device. This is a common argument used for either cli or nxapi transports. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_PASSWORD will be used instead.
port
no 0 (use common port)
Specifies the port to use when building the connection to the remote device. This value applies to either cli or nxapi. The port value will default to the appropriate transport common port if none is provided in the task. (cli=22, http=80, https=443).
provider
no
Convenience method that allows all nxos arguments to be passed as a dict object. All constraints (required, choices, etc) must be met either by individual arguments or values in this dict.
pwd
no
Specify the password for neighbor. Valid value is string.
pwd_type
no
  • 3des
  • cisco_type_7
Specify the encryption type the password will use. Valid values are '3des' or 'cisco_type_7' encryption.
remote_as
no
Specify Autonomous System Number of the neighbor. Valid values are String or Integer in ASPLAIN or ASDOT notation, or 'default', which means not to configure it.
remove_private_as
no
  • enable
  • disable
  • all
  • replace-as
Specify the config to remove private AS number from outbound updates. Valid values are 'enable' to enable this config, 'disable' to disable this config, 'all' to remove all private AS number, or 'replace-as', to replace the private AS number.
shutdown
no
  • true
  • false
Configure to administratively shutdown this neighbor.
ssh_keyfile
no
Specifies the SSH key to use to authenticate the connection to the remote device. This argument is only used for the cli transport. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_SSH_KEYFILE will be used instead.
state
no present
  • present
  • absent
Determines whether the config should be present or not on the device.
suppress_4_byte_as
no
  • true
  • false
Configure to suppress 4-byte AS Capability.
timeout
(added in 2.3)
no 10
Specifies the timeout in seconds for communicating with the network device for either connecting or sending commands. If the timeout is exceeded before the operation is completed, the module will error. NX-API can be slow to return on long-running commands (sh mac, sh bgp, etc).
timers_holdtime
no
Specify holdtime timer value. Valid values are integers between 0 and 3600 in terms of seconds, or 'default', which is 180.
timers_keepalive
no
Specify keepalive timer value. Valid values are integers between 0 and 3600 in terms of seconds, or 'default', which is 60.
transport
yes cli
Configures the transport connection to use when connecting to the remote device. The transport argument supports connectivity to the device over cli (ssh) or nxapi.
transport_passive_only
no
  • true
  • false
Specify whether or not to only allow passive connection setup. Valid values are 'true', 'false', and 'default', which defaults to 'false'. This property can only be configured when the neighbor is in 'ip' address format without prefix length. This property and the transport_passive_mode property are mutually exclusive.
update_source
no
Specify source interface of BGP session and updates.
use_ssl
no
  • yes
  • no
Configures the transport to use SSL if set to true only when the transport=nxapi, otherwise this value is ignored.
username
no
Configures the username to use to authenticate the connection to the remote device. This value is used to authenticate either the CLI login or the nxapi authentication depending on which transport is used. If the value is not specified in the task, the value of environment variable ANSIBLE_NET_USERNAME will be used instead.
vrf
no default
Name of the VRF. The name 'default' is a valid VRF representing the global bgp.

Examples

# create a new neighbor
- nxos_bgp_neighbor:
    asn: 65535
    neighbor: 3.3.3.3
    local_as: 20
    remote_as: 30
    description: "just a description"
    update_source: Ethernet1/3
    shutdown: default
    state: present
    username: "{{ un }}"
    password: "{{ pwd }}"
    host: "{{ inventory_hostname }}"

Return Values

Common return values are documented here Return Values, the following are the fields unique to this module:

name description returned type sample
end_state k/v pairs of BGP neighbor configuration after module execution verbose mode dict {'update_source': 'Ethernet1/3', 'maximum_peers': '', 'timers_holdtime': '180', 'local_as': '20', 'pwd_type': '', 'timers_keepalive': '60', 'dynamic_capability': True, 'vrf': 'default', 'shutdown': False, 'low_memory_exempt': False, 'log_neighbor_changes': '', 'remove_private_as': 'disable', 'suppress_4_byte_as': False, 'connected_check': False, 'remote_as': '30', 'ebgp_multihop': '', 'description': 'just a description', 'pwd': '', 'asn': '65535', 'transport_passive_only': False, 'capability_negotiation': False, 'neighbor': '3.3.3.3'}
changed check to see if a change was made on the device always boolean True
updates commands sent to the device always list ['router bgp 65535', 'neighbor 3.3.3.3', 'remote-as 30', 'update-source Ethernet1/3', 'description just a description', 'local-as 20']
proposed k/v pairs of parameters passed into module verbose mode dict {'update_source': 'Ethernet1/3', 'remote_as': '30', 'shutdown': 'default', 'local_as': '20', 'vrf': 'default', 'neighbor': '3.3.3.3', 'asn': '65535', 'description': 'just a description'}
existing k/v pairs of existing BGP neighbor configuration verbose mode dict {}


Notes

Note

  • state=absent removes the whole BGP neighbor configuration.
  • Default, where supported, restores params default value.

Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Support

This module is community maintained without core committer oversight.

For more information on what this means please read Module Support

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Helping Testing PRs and Developing Modules.