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.3.0).
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 |
|---|---|
A list of interface options, to configure bfd. |
|
Enable or disable bfd for the interface. Default value for appliance might impact idempotency. Choices:
|
|
Use echo adjunct as bfd detection mechanism. Choices:
|
|
Transmit interval between BFD packets |
|
Interval between transmitted BFD control packets 50 - 9999 Milliseconds |
|
Minimum receive interval capability 50 - 9999 Milliseconds |
|
Detection multiplier 3 - 50 |
|
Enable BFD interval transmit jittering. Choices:
|
|
BFD local address. |
|
Full name of interface, e.g. GigabitEthernet0/2, loopback999. Short interface names like Gi0/2, Lo999 may impact idempotency. |
|
BFD template (might impact other BFD configuration), Ansible won’t guarantee state operations. |
|
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 |
|
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.htmlThe 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 |
|---|---|
The resulting configuration after module execution. Returned: when changed Sample: |
|
The configuration prior to the module execution. Returned: when state is Sample: |
|
The set of commands pushed to the remote device. Returned: when state is Sample: |
|
Facts about the network resource gathered from the remote device as structured data. Returned: when state is Sample: |
|
The device native config provided in running_config option parsed into structured data as per module argspec. Returned: when state is Sample: |
|
The provided configuration in the task rendered in device-native format (offline). Returned: when state is Sample: |