nxos_bgp_neighbor – Manages BGP neighbors configurations — Ansible Documentation

- AnsibleFest
- Products
- Community
- Webinars & Training
- Blog

Documentation

# nxos_bgp_neighbor – Manages BGP neighbors configurations

- Synopsis
- Parameters
- Notes
- Examples
- Return Values
- Status

## Synopsis

- Manages BGP neighbors configurations on NX-OS switches.

## Parameters

Parameter | Choices/Defaults | Comments
--- | --- | ---
asn - / required |  | BGP autonomous system number. Valid values are string, Integer in ASPLAIN or ASDOT notation.
bfd string added in 2.9 | Choices: enable disable | Enables/Disables BFD for a given neighbor. Dependency: 'feature bfd'
capability_negotiation boolean | Choices: no yes | Configure whether or not to negotiate capability with this neighbor.
connected_check boolean | Choices: no yes | Configure whether or not to check for directly connected peer.
description - |  | Description of the neighbor.
dynamic_capability boolean | Choices: no yes | Configure whether or not to enable dynamic capability.
ebgp_multihop - |  | Specify multihop TTL for a remote peer. Valid values are integers between 2 and 255, or keyword 'default' to disable this property.
local_as - |  | 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 - | Choices: enable disable inherit | Specify whether or not to enable log messages for neighbor up/down event.
low_memory_exempt boolean | Choices: no yes | Specify whether or not to shut down this neighbor under memory pressure.
maximum_peers - |  | Specify Maximum number of peers for this neighbor prefix Valid values are between 1 and 1000, or 'default', which does not impose the limit. Note that this parameter is accepted only on neighbors with address/prefix.
neighbor - / required |  | Neighbor Identifier. Valid values are string. Neighbors may use IPv4 or IPv6 notation, with or without prefix length.
provider dictionary |  | Deprecated Starting with Ansible 2.5 we recommend using `connection: network_cli`. This option is only required if you are using NX-API. For more information please see the NXOS Platform Options guide. A dict object containing connection details.
| auth_pass string added in 2.5.3 |  | Specifies the password to use if required to enter privileged mode on the remote device. If authorize is false, then this argument does nothing. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTH_PASS` will be used instead.
| authorize boolean added in 2.5.3 | Choices: no ← yes | Instructs the module to enter privileged mode on the remote device before sending any commands. If not specified, the device will attempt to execute all commands in non-privileged mode. If the value is not specified in the task, the value of environment variable `ANSIBLE_NET_AUTHORIZE` will be used instead.
| host string / required |  | 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.
| password string |  | 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 integer | Default: "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).
| ssh_keyfile string |  | 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.
| timeout integer | Default: 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).
| transport string / required | Choices: cli ← nxapi | 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.
| use_proxy boolean added in 2.5 | Choices: no yes ← | If `no`, the environment variables `http_proxy` and `https_proxy` will be ignored.
| use_ssl boolean | Choices: no ← yes | Configures the transport to use SSL if set to `yes` only when the `transport=nxapi`, otherwise this value is ignored.
| username string |  | 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.
| validate_certs boolean | Choices: no yes ← | If `no`, SSL certificates will not be validated. This should only be used on personally controlled sites using self-signed certificates. If the transport argument is not nxapi, this value is ignored.
pwd - |  | Specify the password for neighbor. Valid value is string.
pwd_type - | Choices: 3des cisco_type_7 default | Specify the encryption type the password will use. Valid values are '3des' or 'cisco_type_7' encryption or keyword 'default'.
remote_as - |  | 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 - | Choices: 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 boolean | Choices: no yes | Configure to administratively shutdown this neighbor.
state - | Choices: present ← absent | Determines whether the config should be present or not on the device.
suppress_4_byte_as boolean | Choices: no yes | Configure to suppress 4-byte AS Capability.
timers_holdtime - |  | Specify holdtime timer value. Valid values are integers between 0 and 3600 in terms of seconds, or 'default', which is 180.
timers_keepalive - |  | Specify keepalive timer value. Valid values are integers between 0 and 3600 in terms of seconds, or 'default', which is 60.
transport_passive_only boolean | Choices: no yes | 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.
update_source - |  | Specify source interface of BGP session and updates.
vrf - | Default: "default" | Name of the VRF. The name 'default' is a valid VRF representing the global bgp.

## Notes

Note

- Tested against NXOSv 7.3.(0)D1(1) on VIRL
- `state=absent` removes the whole BGP neighbor configuration.
- Default, where supported, restores params default value.
- For information on using CLI and NX-API see the NXOS Platform Options guide
- For more information on using Ansible to manage network devices see the Ansible Network Guide
- For more information on using Ansible to manage Cisco devices see the Cisco integration page.

## Examples

    # create a new neighbor
    - nxos_bgp_neighbor:
        asn: 65535
        neighbor: 192.0.2.3
        local_as: 20
        remote_as: 30
        bfd: enable
        description: "just a description"
        update_source: Ethernet1/3
        state: present

## Return Values

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

Key | Returned | Description
--- | --- | ---
commands list | always | commands sent to the device Sample: ['router bgp 65535', 'neighbor 192.0.2.3', 'remote-as 30', 'update-source Ethernet1/3', 'description just a description', 'local-as 20']

## Status

- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Network Team. [network]

### Red Hat Support

More information about Red Hat’s support of this module is available from this Red Hat Knowledge Base article.

### Authors

- Gabriele Gerbino (@GGabriele)

Hint

If you notice any issues in this documentation, you can edit this document to improve it.