cisco.nxos.nxos_hsrp_interfaces 模块 – HSRP 接口资源模块
注意
此模块是 cisco.nxos 集合 (版本 9.2.1) 的一部分。
如果您使用的是 ansible 包,则可能已安装此集合。它不包含在 ansible-core 中。要检查它是否已安装,请运行 ansible-galaxy collection list。
要安装它,请使用: ansible-galaxy collection install cisco.nxos。
要在 playbook 中使用它,请指定: cisco.nxos.nxos_hsrp_interfaces。
cisco.nxos 1.0.0 中的新增功能
概要
- 管理热备份路由协议 (HSRP) 接口属性。 
参数
| 参数 | 注释 | 
|---|---|
| 提供的配置 | |
| 启用/禁用接口上的 HSRP 双向转发检测 (BFD)。 选项 
 | |
| 接口的名称。 | |
| 此选项仅与 state 为 parsed 时使用。 此选项的值应是从 NX-OS 设备执行命令 **show running-config | section ‘^interface’** 收到的输出。 state 为 parsed 时,会从  | |
| 配置应保留的状态 选项 
 | 
备注
注意
- 针对 NX-OS 7.0(3)I5(1) 进行测试。 
- 此模块应启用 bfd 功能。 
- 不支持 Cisco MDS 
示例
# Using deleted
- name: Configure hsrp attributes on interfaces
  cisco.nxos.nxos_hsrp_interfaces:
    config:
      - name: Ethernet1/1
      - name: Ethernet1/2
    operation: deleted
# Using merged
- name: Configure hsrp attributes on interfaces
  cisco.nxos.nxos_hsrp_interfaces:
    config:
      - name: Ethernet1/1
        bfd: enable
      - name: Ethernet1/2
        bfd: disable
    operation: merged
# Using overridden
- name: Configure hsrp attributes on interfaces
  cisco.nxos.nxos_hsrp_interfaces:
    config:
      - name: Ethernet1/1
        bfd: enable
      - name: Ethernet1/2
        bfd: disable
    operation: overridden
# Using replaced
- name: Configure hsrp attributes on interfaces
  cisco.nxos.nxos_hsrp_interfaces:
    config:
      - name: Ethernet1/1
        bfd: enable
      - name: Ethernet1/2
        bfd: disable
    operation: replaced
# Using rendered
- name: Use rendered state to convert task input to device specific commands
  cisco.nxos.nxos_hsrp_interfaces:
    config:
      - name: Ethernet1/800
        bfd: enable
      - name: Ethernet1/801
        bfd: enable
    state: rendered
# Task Output (redacted)
# -----------------------
# rendered:
#   - "interface Ethernet1/800"
#   - "hsrp bfd"
#   - "interface Ethernet1/801"
#   - "hsrp bfd"
# Using parsed
# parsed.cfg
# ------------
# interface Ethernet1/800
#   no switchport
#   hsrp bfd
# interface Ethernet1/801
#   no switchport
#   hsrp bfd
- name: Use parsed state to convert externally supplied config to structured format
  cisco.nxos.nxos_hsrp_interfaces:
    running_config: "{{ lookup('file', 'parsed.cfg') }}"
    state: parsed
# Task output (redacted)
# -----------------------
# parsed:
#   - name: Ethernet1/800
#     bfd: enable
#   - name: Ethernet1/801
#     bfd: enable
# Using gathered
# Existing device config state
# -------------------------------
# interface Ethernet1/1
#   no switchport
#   hsrp bfd
# interface Ethernet1/2
#   no switchport
#   hsrp bfd
# interface Ethernet1/3
#   no switchport
- name: Gather hsrp_interfaces facts from the device using nxos_hsrp_interfaces
  cisco.nxos.nxos_hsrp_interfaces:
    state: gathered
# Task output (redacted)
# -----------------------
# gathered:
#   - name: Ethernet1/1
#     bfd: enable
#   - name: Ethernet1/2
#     bfd: enable
返回值
常见的返回值已在 此处 记录,以下是此模块特有的字段
| 键 | 描述 | 
|---|---|
| 生成的配置模型调用。 返回:已更改时 示例:  | |
| 模型调用之前的配置。 返回:始终返回 示例:  | |
| 推送到远程设备的命令集。 返回:始终返回 示例:  | 
