cisco.ios.ios_bfd_interfaces module – Resource module to configure bfd in interfaces.
Note
This module is part of the cisco.ios collection (version 11.4.2).
You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.
To install it, use: ansible-galaxy collection install cisco.ios.
To use it in a playbook, specify: cisco.ios.ios_bfd_interfaces.
New in cisco.ios 11.3.0
Synopsis
- This module manages the bfd configuration in interface of Cisco IOS network devices.
Parameters
Parameter | Comments |
|---|---|
config list / elements=dictionary | A list of interface options, to configure bfd. |
|
bfd boolean |
Enable or disable bfd for the interface. Default value for appliance might impact idempotency. Choices:
|
|
echo boolean |
Use echo adjunct as bfd detection mechanism. Choices:
|
|
interval dictionary |
Transmit interval between BFD packets |
|
input integer |
Interval between transmitted BFD control packets 50 - 9999 Milliseconds |
|
min_rx integer |
Minimum receive interval capability 50 - 9999 Milliseconds |
|
multiplier integer |
Detection multiplier 3 - 50 |
|
jitter boolean |
Enable BFD interval transmit jittering. Choices:
|
|
local_address string |
BFD local address. |
|
name string / required |
Full name of interface, e.g. GigabitEthernet0/2, loopback999. Short interface names like Gi0/2, Lo999 may impact idempotency. |
|
template string |
BFD template (might impact other BFD configuration), Ansible won’t guarantee state operations. |
running_config string | This option is used only with state parsed. The value of this option should be the output received from the IOS XE device by executing the command show running-config | section ^interface. The state parsed reads the configuration from |
state string | The state the configuration should be left in The states rendered, gathered and parsed does not perform any change on the device. The state rendered will transform the configuration in The state gathered will fetch the running configuration from device and transform it into structured data in the format as per the resource module argspec and the value is returned in the gathered key within the result. The state parsed reads the configuration from Choices:
|
Notes
Note
- Tested against Cisco IOSXE Version 17.3 on CML.
- This module works with connection
network_cli. See https://docs.ansible.com/ansible/latest/network/user_guide/platform_ios.html - The module examples uses callback plugin (stdout_callback = yaml) to generate task output in yaml format.
Examples
# Using state: merged
# Before state:
# -------------
# router-ios#show running-config | section ^interface
# interface GigabitEthernet1
# ip address dhcp
# negotiation auto
# interface GigabitEthernet2
# no ip address
# shutdown
# negotiation auto
# interface GigabitEthernet3
# no ip address
# shutdown
# negotiation auto
# interface GigabitEthernet4
# no ip address
# shutdown
# negotiation auto
- name: Apply the provided BFD configuration to interfaces
cisco.ios.ios_bfd_interfaces:
config:
- name: GigabitEthernet1
bfd: true
jitter: false
interval:
input: 100
min_rx: 100
multiplier: 3
local_address: 10.0.1.2
template: ANSIBLE
- name: GigabitEthernet2
bfd: true
jitter: true
interval:
input: 100
min_rx: 100
multiplier: 3
- name: GigabitEthernet4
template: ANSIBLE_Tempalte
state: merged
# Commands Fired:
# ---------------
# after:
# - interval:
# input: 100
# min_rx: 100
# multiplier: 3
# jitter: false
# local_address: 10.0.1.2
# name: GigabitEthernet1
# - interval:
# input: 100
# min_rx: 100
# multiplier: 3
# name: GigabitEthernet2
# - name: GigabitEthernet3
# - name: GigabitEthernet4
# template: ANSIBLE_Tempalte
# before:
# - name: GigabitEthernet1
# - name: GigabitEthernet2
# - name: GigabitEthernet3
# - name: GigabitEthernet4
# changed: true
# commands:
# - interface GigabitEthernet1
# - bfd enable
# - bfd local-address 10.0.1.2
# - bfd interval 100 min_rx 100 multiplier 3
# - bfd template ANSIBLE
# - no bfd jitter
# - interface GigabitEthernet2
# - bfd enable
# - bfd jitter
# - bfd interval 100 min_rx 100 multiplier 3
# - interface GigabitEthernet4
# - bfd template ANSIBLE_Tempalte
# After state:
# ------------
# router-ios#show running-config | section ^interface
# interface GigabitEthernet1
# ip address dhcp
# negotiation auto
# bfd local-address 10.0.1.2
# bfd interval 100 min_rx 100 multiplier 3
# no bfd jitter
# interface GigabitEthernet2
# no ip address
# shutdown
# negotiation auto
# bfd interval 100 min_rx 100 multiplier 3
# interface GigabitEthernet3
# no ip address
# shutdown
# negotiation auto
# interface GigabitEthernet4
# no ip address
# shutdown
# negotiation auto
# bfd template ANSIBLE_Tempalte
# Using state: replaced
# Before state:
# -------------
# router-ios#show running-config | section ^interface
# interface GigabitEthernet1
# ip address dhcp
# negotiation auto
# bfd local-address 10.0.1.2
# bfd interval 100 min_rx 100 multiplier 3
# no bfd jitter
# interface GigabitEthernet2
# no ip address
# shutdown
# negotiation auto
# bfd interval 100 min_rx 100 multiplier 3
# interface GigabitEthernet3
# no ip address
# shutdown
# negotiation auto
# interface GigabitEthernet4
# no ip address
# shutdown
# negotiation auto
# bfd template ANSIBLE_Tempalte
- name: Replace BFD configuration for specified interfaces
cisco.ios.ios_bfd_interfaces:
config:
- name: GigabitEthernet1
bfd: true
echo: true
jitter: true
interval:
input: 100
min_rx: 100
multiplier: 3
local_address: 10.0.1.2
template: ANSIBLE
- name: GigabitEthernet2
bfd: true
echo: true
jitter: true
interval:
input: 100
min_rx: 100
multiplier: 3
- name: GigabitEthernet6
template: ANSIBLE_3Tempalte
state: replaced
# Commands Fired:
# ---------------
# "commands": [
# "interface GigabitEthernet1",
# "bfd enable",
# "bfd echo",
# "bfd jitter",
# "bfd local-address 10.0.1.2",
# "bfd interval 100 min_rx 100 multiplier 3",
# "bfd template ANSIBLE",
# "interface GigabitEthernet2",
# "bfd enable",
# "bfd echo",
# "bfd jitter",
# "bfd interval 100 min_rx 100 multiplier 3",
# "no bfd template OLD_TEMPLATE",
# "interface GigabitEthernet6",
# "bfd template ANSIBLE_3Tempalte"
# ]
# After state:
# ------------
# router-ios#show running-config | section ^interface
# interface GigabitEthernet1
# description Ansible UT interface 1
# no shutdown
# bfd enable
# bfd echo
# bfd jitter
# bfd local-address 10.0.1.2
# bfd interval 100 min_rx 100 multiplier 3
# bfd template ANSIBLE
# interface GigabitEthernet2
# description Ansible UT interface 2
# ip address dhcp
# bfd enable
# bfd echo
# bfd jitter
# bfd interval 100 min_rx 100 multiplier 3
# interface GigabitEthernet3
# description Ansible UT interface 3
# no ip address
# shutdown
# bfd jitter
# bfd local-address 10.0.1.2
# bfd interval 50 min_rx 50 multiplier 3
# interface GigabitEthernet6
# bfd template ANSIBLE_3Tempalte
# Using state: overridden
# Before state:
# -------------
# router-ios#show running-config | section ^interface
# interface GigabitEthernet1
# description Ansible UT interface 1
# no shutdown
# bfd local-address 10.0.0.1
# bfd interval 57 min_rx 66 multiplier 45
# interface GigabitEthernet2
# description Ansible UT interface 2
# ip address dhcp
# bfd template OLD_TEMPLATE
# interface GigabitEthernet3
# description Ansible UT interface 3
# no ip address
# shutdown
# bfd jitter
# bfd local-address 10.0.1.2
# bfd interval 50 min_rx 50 multiplier 3
- name: Override all BFD configuration with provided configuration
cisco.ios.ios_bfd_interfaces:
config:
- name: GigabitEthernet1
bfd: true
echo: true
jitter: true
interval:
input: 100
min_rx: 100
multiplier: 3
local_address: 10.0.1.2
template: ANSIBLE
- name: GigabitEthernet2
bfd: true
echo: true
jitter: true
interval:
input: 100
min_rx: 100
multiplier: 3
- name: GigabitEthernet6
template: ANSIBLE_3Tempalte
state: overridden
# Commands Fired:
# ---------------
# "commands": [
# "interface GigabitEthernet3",
# "no bfd jitter",
# "no bfd local-address 10.0.1.2",
# "no bfd interval 50 min_rx 50 multiplier 3",
# "interface GigabitEthernet1",
# "bfd enable",
# "bfd echo",
# "bfd jitter",
# "bfd local-address 10.0.1.2",
# "bfd interval 100 min_rx 100 multiplier 3",
# "bfd template ANSIBLE",
# "interface GigabitEthernet2",
# "bfd enable",
# "bfd echo",
# "bfd jitter",
# "bfd interval 100 min_rx 100 multiplier 3",
# "no bfd template OLD_TEMPLATE",
# "interface GigabitEthernet6",
# "bfd template ANSIBLE_3Tempalte"
# ]
# After state:
# ------------
# router-ios#show running-config | section ^interface
# interface GigabitEthernet1
# description Ansible UT interface 1
# no shutdown
# bfd enable
# bfd echo
# bfd jitter
# bfd local-address 10.0.1.2
# bfd interval 100 min_rx 100 multiplier 3
# bfd template ANSIBLE
# interface GigabitEthernet2
# description Ansible UT interface 2
# ip address dhcp
# bfd enable
# bfd echo
# bfd jitter
# bfd interval 100 min_rx 100 multiplier 3
# interface GigabitEthernet3
# description Ansible UT interface 3
# no ip address
# shutdown
# interface GigabitEthernet6
# bfd template ANSIBLE_3Tempalte
# Using state: deleted
# Before state:
# -------------
# router-ios#show running-config | section ^interface
# interface GigabitEthernet1
# description Ansible UT interface 1
# no shutdown
# bfd local-address 10.0.0.1
# bfd interval 57 min_rx 66 multiplier 45
# interface GigabitEthernet2
# description Ansible UT interface 2
# ip address dhcp
# bfd template OLD_TEMPLATE
# interface GigabitEthernet3
# description Ansible UT interface 3
# no ip address
# shutdown
# bfd jitter
# bfd local-address 10.0.1.2
# bfd interval 50 min_rx 50 multiplier 3
- name: Delete BFD configuration for specified interfaces
cisco.ios.ios_bfd_interfaces:
config:
- name: GigabitEthernet1
- name: GigabitEthernet2
state: deleted
# Commands Fired:
# ---------------
# "commands": [
# "interface GigabitEthernet1",
# "no bfd local-address 10.0.0.1",
# "no bfd interval 57 min_rx 66 multiplier 45",
# "interface GigabitEthernet2",
# "no bfd template OLD_TEMPLATE"
# ]
# After state:
# ------------
# router-ios#show running-config | section ^interface
# interface GigabitEthernet1
# description Ansible UT interface 1
# no shutdown
# interface GigabitEthernet2
# description Ansible UT interface 2
# ip address dhcp
# interface GigabitEthernet3
# description Ansible UT interface 3
# no ip address
# shutdown
# bfd jitter
# bfd local-address 10.0.1.2
# bfd interval 50 min_rx 50 multiplier 3
# Using state: gathered
# Before state:
# -------------
# router-ios#show running-config | section ^interface
# interface GigabitEthernet1
# description Ansible UT interface 1
# no shutdown
# bfd local-address 10.0.0.1
# bfd interval 57 min_rx 66 multiplier 45
# interface GigabitEthernet2
# description Ansible UT interface 2
# ip address dhcp
# bfd template OLD_TEMPLATE
# interface GigabitEthernet3
# description Ansible UT interface 3
# no ip address
# shutdown
# bfd jitter
# bfd local-address 10.0.1.2
# bfd interval 50 min_rx 50 multiplier 3
- name: Gather listed BFD interfaces config
cisco.ios.ios_bfd_interfaces:
state: gathered
# Module Execution Result:
# ------------------------
# "gathered": [
# {
# "name": "GigabitEthernet1",
# "local_address": "10.0.0.1",
# "interval": {
# "input": 57,
# "min_rx": 66,
# "multiplier": 45
# }
# },
# {
# "name": "GigabitEthernet2",
# "template": "OLD_TEMPLATE"
# },
# {
# "name": "GigabitEthernet3",
# "jitter": true,
# "local_address": "10.0.1.2",
# "interval": {
# "input": 50,
# "min_rx": 50,
# "multiplier": 3
# }
# }
# ]
# After state:
# -------------
# router-ios#show running-config | section ^interface
# interface GigabitEthernet1
# description Ansible UT interface 1
# no shutdown
# bfd local-address 10.0.0.1
# bfd interval 57 min_rx 66 multiplier 45
# interface GigabitEthernet2
# description Ansible UT interface 2
# ip address dhcp
# bfd template OLD_TEMPLATE
# interface GigabitEthernet3
# description Ansible UT interface 3
# no ip address
# shutdown
# bfd jitter
# bfd local-address 10.0.1.2
# bfd interval 50 min_rx 50 multiplier 3
# Using state: rendered
- name: Render the commands for provided configuration
cisco.ios.ios_bfd_interfaces:
config:
- name: GigabitEthernet1
local_address: 10.0.0.1
interval:
input: 57
min_rx: 66
multiplier: 45
- name: GigabitEthernet2
template: OLD_TEMPLATE
- name: GigabitEthernet3
jitter: true
local_address: 10.0.1.2
interval:
input: 50
min_rx: 50
multiplier: 3
state: rendered
# Module Execution Result:
# ------------------------
# "rendered": [
# "interface GigabitEthernet1",
# "bfd local-address 10.0.0.1",
# "bfd interval 57 min_rx 66 multiplier 45",
# "interface GigabitEthernet2",
# "bfd template OLD_TEMPLATE",
# "interface GigabitEthernet3",
# "bfd jitter",
# "bfd local-address 10.0.1.2",
# "bfd interval 50 min_rx 50 multiplier 3"
# ]
# Using state: parsed
# File: parsed.cfg
# ----------------
# interface GigabitEthernet1
# description Ansible UT interface 1
# no shutdown
# bfd local-address 10.0.0.1
# bfd interval 57 min_rx 66 multiplier 45
# interface GigabitEthernet2
# description Ansible UT interface 2
# ip address dhcp
# bfd template OLD_TEMPLATE
# interface GigabitEthernet3
# description Ansible UT interface 3
# no ip address
# shutdown
# no bfd jitter
# bfd local-address 10.0.1.2
# bfd interval 50 min_rx 50 multiplier 3
- name: Parse the provided configuration with the existing running configuration
cisco.ios.ios_bfd_interfaces:
running_config: "{{ lookup('file', 'parsed.cfg') }}"
state: parsed
# Module Execution Result:
# ------------------------
# "parsed": [
# {
# "name": "GigabitEthernet1",
# "local_address": "10.0.0.1",
# "interval": {
# "input": 57,
# "min_rx": 66,
# "multiplier": 45
# }
# },
# {
# "name": "GigabitEthernet2",
# "template": "OLD_TEMPLATE"
# },
# {
# "name": "GigabitEthernet3",
# "jitter": false,
# "local_address": "10.0.1.2",
# "interval": {
# "input": 50,
# "min_rx": 50,
# "multiplier": 3
# }
# }
# ]
Return Values
Common return values are documented here, the following are the fields unique to this module:
Key | Description |
|---|---|
after list / elements=string | The resulting configuration after module execution. Returned: when changed Sample: |
before list / elements=string | The configuration prior to the module execution. Returned: when state is Sample: |
commands list / elements=string | The set of commands pushed to the remote device. Returned: when state is Sample: |
gathered list / elements=string | Facts about the network resource gathered from the remote device as structured data. Returned: when state is Sample: |
parsed list / elements=string | The device native config provided in running_config option parsed into structured data as per module argspec. Returned: when state is Sample: |
rendered list / elements=string | The provided configuration in the task rendered in device-native format (offline). Returned: when state is Sample: |
Collection links
© 2012–2018 Michael DeHaan
© 2018–2025 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/projects/ansible/latest/collections/cisco/ios/ios_bfd_interfaces_module.html