cisco.nxos.nxos_vrf_global 模块 – 用于配置 VRF 定义的资源模块。

注意

此模块是 cisco.nxos 集合(版本 9.2.1)的一部分。

如果您使用的是 ansible 包,则可能已经安装了此集合。它不包含在 ansible-core 中。要检查是否已安装,请运行 ansible-galaxy collection list

要安装它,请使用:ansible-galaxy collection install cisco.nxos

要在 playbook 中使用它,请指定:cisco.nxos.nxos_vrf_global

cisco.nxos 8.1.0 中的新增功能

概要

  • 此模块提供 Cisco NXOS 上 VRF 定义的声明式管理。

参数

参数

注释

config

字典

包含 VRF 设备配置的列表。

vrfs

列表 / 元素=字典

VRF 定义的列表。

description

字符串

VRF 的描述。

ip

字典

为指定的 vrf 配置 IP 功能。

auto_discard

布尔值

自动 0.0.0.0/0 丢弃路由。

选择

  • false

  • true

domain_list

列表 / 元素=字符串

添加域名列表。

domain_name

字符串

指定默认域名。

icmp_err

字典

启用 ICMP 错误消息。

source_interface

字典

为应用程序配置源地址。

interface

字符串

ICMP 错误消息的源接口。

选择

  • "loopback"

  • "ethernet"

  • "port-channel"

interface_value

字符串

ICMP 错误消息的源接口值。

igmp

字典

IGMP 全局配置命令

ssm_translate

列表 / 元素=字典

将 IGMPv1/v2 报告转换为 (S,G) 路由条目。

group

字符串

源地址。

source

字符串

组地址。

mroutes

列表 / 元素=字典

配置组播路由。

group

字符串

组播组地址。

preference

整数

首选项值。

source

字符串

源地址。

vrf

字符串

VRF 名称。

multicast

字典

配置 IP 组播全局参数。

group_range_prefix_list

字符串

用于组播边界的组范围前缀列表策略。

multipath

字典

配置 ECMP 组播负载分担。

resilient

布尔值

配置弹性 RPF 接口。

选择

  • false

  • true

splitting_type

字典

配置组播负载分担类型。

legacy

布尔值

根据源和组配置哈希。

选择

  • false

  • true

nbm

布尔值

配置 NBM 控制的 RPF 接口。

选择

  • false

  • true

none

布尔值

禁用组播负载分担。

选择

  • false

  • true

sg_hash

布尔值

根据源和组地址配置哈希。

选择

  • false

  • true

sg_hash_next_hop

布尔值

根据源地址、组地址和下一跳配置哈希。

选择

  • false

  • true

rpf

列表 / 元素=字典

配置 RPF 检查。

group_list_range

字符串

用于 RPF 选择的组范围。

vrf_name

字符串

用于 RPF 查找的 VRF。

name_server

字典

指定名称服务器地址。

address_list

列表 / 元素=字符串

配置组播名称服务器地址。

use_vrf

字典

显示每个 VRF 的信息。

source_address

字符串

用于配置名称服务器的源地址。

vrf

字符串

VRF 名称。

route

列表 / 元素=字典

配置静态路由。

destination

字符串

下一跳地址。

source

字符串

目标前缀。

tags

字典

路由标记。

route_pref

整数

路由首选项。

tag_value

整数

路由标记值。

track

字符串

配置跟踪对象。

vrf

字符串

将 vrf 添加到路由。

ipv6

字典

为指定的 vrf 配置 IPv6 功能。

mld_ssm_translate

列表 / 元素=字典

将 MLDv1/v2 报告转换为 (S,G) 路由条目。

group

字符串

源地址。

icmp

布尔值

使用 mld 配置 ICMP 参数。

选择

  • false

  • true

source

字符串

组地址。

multicast

字典

为 ipv6 配置 IP 组播全局参数。

group_range_prefix_list

字符串

用于组播边界的组范围前缀列表策略。

multipath

字典

配置 ECMP 组播负载分担。

resilient

布尔值

配置弹性 RPF 接口。

选择

  • false

  • true

splitting_type

字典

配置组播负载分担类型。

none

布尔值

禁用组播负载分担。

选择

  • false

  • true

sg_hash

布尔值

根据源和组地址配置哈希。

选择

  • false

  • true

sg_hash_next_hop

布尔值

根据源地址、组地址和下一跳配置哈希。

选择

  • false

  • true

multicast

字典

配置 IP 组播选项。

service_reflect

列表 / 元素=字典

配置服务反射选项。

map_to

字符串

映射到接口。

service_interface

字符串

配置服务接口。

name

字符串 / 必需

VRF 的名称。

vni

字典

虚拟网络标识符。

layer_3

布尔值

配置第 3 层 VNI。

选择

  • false

  • true

vni_number

整数

VNI 编号。

running_config

字符串

此选项仅与状态 parsed 一起使用。

此选项的值应是从 NX-OS 设备执行命令 show running-config | section ^vrf 收到的输出。

状态 parsedrunning_config 选项读取配置,并根据资源模块的 argspec 将其转换为 Ansible 结构化数据,然后在结果内的 parsed 键中返回该值。

state

字符串

配置应保持的状态

状态 renderedgatheredparsed 不会对设备执行任何更改。

状态 rendered 会将 config 选项中的配置转换为特定于平台的 CLI 命令,这些命令将在结果中的 rendered 键中返回。对于状态 rendered,不需要与远程主机的活动连接。

状态 gathered 将从设备获取运行配置,并将其转换为符合资源模块 argspec 格式的结构化数据,该值在结果中的 gathered 键中返回。

parsed 状态从 running_config 选项读取配置,并根据资源模块参数将其转换为 JSON 格式,该值在结果中的 parsed 键中返回。running_config 选项的值应与命令 show running-config | section ^vrf 的输出格式相同。不需要连接到远程主机。

选择

  • "parsed"

  • "gathered"

  • "deleted"

  • "merged" ←(默认)

  • "replaced"

  • "rendered"

  • "overridden"

  • "purged"

说明

注意

示例

# Using merged

# Before state:
# -------------
#
# nxos#show running-config | section ^vrf

- name: Merge provided VRF configuration
  cisco.nxos.vrf_global:
    config:
      vrfs:
        - name: testvrf
          description: this is description
          ip:
            auto_discard: true
            domain_list:
              - example.net
              - example.com
            domain_name: test.com
            icmp_err:
              source_interface:
                interface: port-channel
                interface_value: '1'
            igmp:
              ssm_translate:
                - group: 232.0.0.0/8
                  source: 10.1.1.1
                - group: 239.1.2.3/24
                  source: 192.168.1.1
            mroutes:
              - group: 192.168.1.0/24
                source: 192.168.1.1
              - group: 192.168.1.0/24
                preference: 2
                source: 192.168.1.2
                vrf: temp1
            multicast:
              multipath:
                resilient: true
                splitting_type:
                  legacy: true
              rpf:
                - group_list_range: 238.1.0.0/24
                  vrf_name: temp1
                - group_list_range: 239.1.0.0/24
                  vrf_name: temp1
            name_server:
              address_list:
                - 192.168.0.1
                - 192.168.0.2
                - 192.168.1.1
                - 192.169.1.3
              use_vrf:
                source_address: 192.168.0.1
                vrf: temp1
            route:
              - destination: 192.0.2.22
                source: 192.0.0.0/24
              - destination: 192.0.2.22
                source: 192.0.0.0/24
                vrf: temp1
              - destination: 192.0.2.22
                source: 192.0.2.0/24
                tags:
                  route_pref: 4
                  tag_value: 2
          ipv6:
            mld_ssm_translate:
              - group: 'ff28::/16'
                source: '2001:db8:0:abcd::2'
              - group: 'ff30::/16'
                source: '2001:db8:0:abcd::5'
            multicast:
              group_range_prefix_list: temp2
              multipath:
                resilient: true
                splitting_type:
                  none: true
          multicast:
            service_reflect:
              - map_to: Ethernet2/2
                service_interface: Ethernet1/1
              - map_to: Ethernet4/2
                service_interface: Ethernet2/1
          vni:
            vni_number: 5
    state: merged

# Task Output:
# ------------

# before: {}
# commands:
#   - vrf context test1
#   - description this is description
#   - ip auto-discard
#   - ip domain-name test.net
#   - ip name-server 192.168.0.1 192.168.0.2 192.168.1.1 192.169.1.3
#   - ip icmp-errors source-interface port-channel 1
#   - ip multicast multipath resilient
#   - ip multicast multipath legacy
#   - ip name-server 192.168.0.1 use-vrf temp1
#   - vni 5
#   - ipv6 multicast group-range prefix-list temp2
#   - ipv6 multicast multipath resilient
#   - ipv6 multicast multipath none
#   - ip domain-list test.org
#   - ip domain-list example.com
#   - ip domain-list example.net
#   - ip igmp ssm-translate 232.0.0.0/8 10.1.1.1
#   - ip igmp ssm-translate 239.1.2.3/24 192.168.1.1
#   - ip mroute 192.168.1.0/24 192.168.1.1
#   - ip mroute 192.168.1.0/24 192.168.1.2 2 vrf temp1
#   - ip multicast rpf select vrf temp1 group-list 238.1.0.0/24
#   - ip multicast rpf select vrf temp1 group-list 239.1.0.0/24
#   - ip route 192.0.0.0/24 192.0.2.22
#   - ip route 192.0.0.0/24 192.0.2.22 vrf temp1
#   - ip route 192.0.2.0/24 192.0.2.22 tag 2 4
#   - multicast service-reflect interface Ethernet1/1 map interface Ethernet2/2
#   - multicast service-reflect interface Ethernet2/1 map interface Ethernet4/2
#   - ipv6 mld ssm-translate ff28::/16 2001:db8:0:abcd::2
#   - ipv6 mld ssm-translate ff30::/16 2001:db8:0:abcd::5

# after:
#   vrfs:
#    - name: testvrf
#      description: this is description
#      ip:
#        auto_discard: true
#        domain_list:
#        - example.net
#        - example.com
#        domain_name: test.com
#        icmp_err:
#          source_interface:
#            interface: port-channel
#            interface_value: '1'
#        igmp:
#          ssm_translate:
#          - group: 232.0.0.0/8
#            source: 10.1.1.1
#          - group: 239.1.2.3/24
#            source: 192.168.1.1
#        mroutes:
#        - group: 192.168.1.0/24
#          source: 192.168.1.1
#        - group: 192.168.1.0/24
#          preference: 2
#          source: 192.168.1.2
#          vrf: temp1
#        multicast:
#          multipath:
#            resilient: true
#            splitting_type:
#              legacy: true
#          rpf:
#          - group_list_range: 238.1.0.0/24
#            vrf_name: temp1
#          - group_list_range: 239.1.0.0/24
#            vrf_name: temp1
#        name_server:
#          address_list:
#          - 192.168.0.1
#          - 192.168.0.2
#          - 192.168.1.1
#          - 192.169.1.3
#          use_vrf:
#            source_address: 192.168.0.1
#            vrf: temp1
#        route:
#        - destination: 192.0.2.22
#          source: 192.0.0.0/24
#        - destination: 192.0.2.22
#          source: 192.0.0.0/24
#           vrf: temp1
#        - destination: 192.0.2.22
#          source: 192.0.2.0/24
#          tags:
#            route_pref: 4
#            tag_value: 2
#      ipv6:
#        mld_ssm_translate:
#        - group: ff28::/16
#          source: 2001:db8:0:abcd::2
#        - group: ff30::/16
#          source: 2001:db8:0:abcd::5
#        multicast:
#          group_range_prefix_list: temp2
#          multipath:
#            resilient: true
#            splitting_type:
#              none: true
#      multicast:
#        service_reflect:
#         - map_to: Ethernet2/2
#           service_interface: Ethernet1/1
#         - map_to: Ethernet4/2
#           service_interface: Ethernet2/1
#      vni:
#        vni_number: 5

# After state:
# ------------
#
# nxos#show running-config | section ^vrf
# vrf context testvrf
#   description this is description
#   ip auto-discard
#   ip domain-name test.net
#   ip name-server 192.168.0.1 192.168.0.2 192.168.1.1 192.169.1.3
#   ip icmp-errors source-interface port-channel 1
#   ip multicast multipath resilient
#   ip multicast multipath legacy
#   ip name-server 192.168.0.1 use-vrf temp1
#   vni 5
#   ipv6 multicast group-range prefix-list temp2
#   ipv6 multicast multipath resilient
#   ipv6 multicast multipath none
#   ip domain-list test.org
#   ip domain-list example.com
#   ip domain-list example.net
#   ip igmp ssm-translate 232.0.0.0/8 10.1.1.1
#   ip igmp ssm-translate 239.1.2.3/24 192.168.1.1
#   ip mroute 192.168.1.0/24 192.168.1.1
#   ip mroute 192.168.1.0/24 192.168.1.2 2 vrf temp1
#   ip multicast rpf select vrf temp1 group-list 238.1.0.0/24
#   ip multicast rpf select vrf temp1 group-list 239.1.0.0/24
#   ip route 192.0.0.0/24 192.0.2.22
#   ip route 192.0.0.0/24 192.0.2.22 vrf temp1
#   ip route 192.0.2.0/24 192.0.2.22 tag 2 4
#   multicast service-reflect interface Ethernet1/1 map interface Ethernet2/2
#   multicast service-reflect interface Ethernet2/1 map interface Ethernet4/2
#   ipv6 mld ssm-translate ff28::/16 2001:db8:0:abcd::2
#   ipv6 mld ssm-translate ff30::/16 2001:db8:0:abcd::5

# Using deleted

# Before state:
# -------------
#
# nxos#show running-config | section ^vrf
# vrf context management
#  ip name-server 192.168.255.1
#  ip route 0.0.0.0/0 192.168.255.1
# vrf context test1
#  description this is description
#  ip domain-name test.net
#  ip domain-list example.net
#  ip domain-list example.com
#  ip domain-list test.org
#  vni 5
#  ip auto-discard
#  ip route 192.0.0.0/24 192.0.2.22
#  ip route 192.0.0.0/24 192.0.2.22 vrf temp1
#  ip route 192.0.2.0/24 192.0.2.22 tag 2 4
#  ip mroute 192.168.1.0/24 192.168.1.1
#  ip mroute 192.168.1.0/24 192.168.1.2 2 vrf temp1
#  ip icmp-errors source-interface po1
#  ip igmp ssm-translate 232.0.0.0/8 10.1.1.1
#  ip igmp ssm-translate 239.1.2.3/24 192.168.1.1
#  ip multicast multipath legacy
#  ip multicast multipath resilient
#  ip multicast rpf select vrf temp1 group-list 238.1.0.0/24
#  ip multicast rpf select vrf temp1 group-list 239.1.0.0/24
#  ip multicast group-range prefix-list temp2

- name: Delete VRF configuration
  cisco.nxos.vrf_global:
    config:
      vrfs:
        - name: test1
    state: deleted

# Task Output:
# ------------
#
# before:
#   vrfs:
#    - name: management
#      ip:
#        name_server:
#          address_list:
#          - 192.168.255.1
#        route:
#        - source: 0.0.0.0/0
#          destination: 192.168.255.1
#    - name: test1
#      description: this is description
#      ip:
#        domain_name: test.net
#        domain_list:
#        - test.org
#        - example.net
#        - example.com
#        auto_discard: true
#        route:
#        - source: 192.0.0.0/24
#          destination: 192.0.2.22
#        - source: 192.0.0.0/24
#          destination: 192.0.2.22
#          vrf: temp1
#        - source: 192.0.2.0/24
#          destination: 192.0.2.22
#          tags:
#            tag_value: 2
#            route_pref: 4
#        mroutes:
#        - group: 192.168.1.0/24
#          source: 192.168.1.1
#        - group: 192.168.1.0/24
#          source: 192.168.1.2
#          preference: 2
#          vrf: temp1
#        icmp_err:
#          source_interface:
#            interface: port-channel
#            interface_value: '1'
#        igmp:
#          ssm_translate:
#          - group: 232.0.0.0/8
#            source: 10.1.1.1
#          - group: 239.1.2.3/24
#            source: 192.168.1.1
#        multicast:
#          multipath:
#            splitting_type:
#              legacy: true
#            resilient: true
#          rpf:
#          - vrf_name: temp1
#            group_list_range: 238.1.0.0/24
#          - vrf_name: temp1
#            group_list_range: 239.1.0.0/24
#      vni:
#        vni_number: 5

# commands:
#   - vrf context test1
#   - no description this is description
#   - no ip auto-discard
#   - no ip domain-name test.net
#   - no ip icmp-errors source-interface port-channel 1
#   - no ip multicast multipath resilient
#   - no ip multicast multipath legacy
#   - no vni 5
#   - no ip domain-list example.net
#   - no ip domain-list test.org
#   - no ip domain-list example.com
#   - no ip igmp ssm-translate 232.0.0.0/8 10.1.1.1
#   - no ip igmp ssm-translate 239.1.2.3/24 192.168.1.1
#   - no ip mroute 192.168.1.0/24 192.168.1.1
#   - no ip mroute 192.168.1.0/24 192.168.1.2 2 vrf temp1
#   - no ip multicast rpf select vrf temp1 group-list 238.1.0.0/24
#   - no ip multicast rpf select vrf temp1 group-list 239.1.0.0/24
#   - no ip route 192.0.0.0/24 192.0.2.22
#   - no ip route 192.0.0.0/24 192.0.2.22 vrf temp1
#   - no ip route 192.0.2.0/24 192.0.2.22 tag 2 4
#
# after:
#   vrfs:
#    - name: management
#      ip:
#        name_server:
#          address_list:
#          - 192.168.255.1
#        route:
#        - source: 0.0.0.0/0
#          destination: 192.168.255.1
#    - name: test1

# Using deleted with empty config

# Before state:
# -------------
#
# nxos#show running-config | section ^vrf
# vrf context management
#  ip name-server 192.168.255.1
#  ip route 0.0.0.0/0 192.168.255.1
# vrf context test1
#  description this is description
#  ip domain-name test.net
#  ip domain-list example.net
#  ip domain-list example.com
#  ip domain-list test.org
#  vni 5

- name: Delete VRF configuration
  cisco.nxos.vrf_global:
    config:
      vrfs:
        - name: test1
    state: deleted

# Task Output:
# ------------
#
# before:
#   vrfs:
#    - name: management
#      ip:
#        name_server:
#          address_list:
#          - 192.168.255.1
#        route:
#        - source: 0.0.0.0/0
#          destination: 192.168.255.1
#    - name: test1
#      description: this is description
#      ip:
#        domain_name: test.net
#        domain_list:
#        - test.org
#        - example.net
#        - example.com
#      vni:
#        vni_number: 5

# commands:
#   - vrf context management
#   - no ip name-server 192.168.255.1
#   - no ip route 0.0.0.0/0 192.168.255.1
#   - vrf context test1
#   - no description this is description
#   - no ip domain-name test.net
#   - no vni 5
#   - no ip domain-list example.net
#   - no ip domain-list test.org
#   - no ip domain-list example.com

# after:
#   vrfs:
#     - name: management
#     - name: test1

# Using purged

# Before state:
# -------------
#
# nxos#show running-config | section ^vrf
# vrf context management
#   ip name-server 192.168.255.1
#   ip route 0.0.0.0/0 192.168.255.1
# vrf context test1
#   description this is description
#   ip domain-name example.com
#   ip domain-list example.net
#   ip domain-list example.org
#   vni 5
#   ip auto-discard
#   ip route 192.0.0.0/24 192.0.2.22
#   ip route 192.0.0.0/24 192.0.2.22 vrf temp1
#   ip route 192.0.2.0/24 192.0.2.22 tag 2 4
# vrf context test2
#   description test description
#   ip auto-discard
#   ip domain-name test.com

- name: Override VRF configuration
  cisco.nxos.vrf_global:
    config:
      vrfs:
        - name: test1
        - name: test2
    state: purged

# Task Output:
# ------------
#
# before:
#   vrfs:
#    - name: management
#      ip:
#        name_server:
#          address_list:
#          - 192.168.255.1
#        route:
#        - source: 0.0.0.0/0
#          destination: 192.168.255.1
#    - name: test1
#      description: this is description
#      ip:
#        domain_name: example.com
#        domain_list:
#        - example.net
#        - example.org
#        auto_discard: true
#        route:
#        - source: 192.0.0.0/24
#          destination: 192.0.2.22
#        - source: 192.0.0.0/24
#          destination: 192.0.2.22
#          vrf: temp1
#        - source: 192.0.2.0/24
#          destination: 192.0.2.22
#          tags:
#            tag_value: 2
#            route_pref: 4
#     vni:
#       vni_number: 5
#    - name: test2
#      description: test description
#      ip:
#        auto_discard: true
#        domain_name: test.com
#
# commands:
# - no vrf context test1
# - no vrf context test2
#
# after:
#   vrfs:
#    - name: management
#      ip:
#        name_server:
#          address_list:
#          - 192.168.255.1
#        route:
#        - source: 0.0.0.0/0
#          destination: 192.168.255.1

# Using overridden

# Before state:
# -------------
#
# nxos#show running-config | section ^vrf
# vrf context management
#   ip name-server 192.168.255.1
#   ip route 0.0.0.0/0 192.168.255.1
# vrf context test1
#   description this is description
#   ip domain-name example.com
#   ip domain-list example.net
#   ip domain-list example.org
#   vni 5
#   ip auto-discard
#   ip route 192.0.0.0/24 192.0.2.22
#   ip route 192.0.0.0/24 192.0.2.22 vrf temp1
#   ip route 192.0.2.0/24 192.0.2.22 tag 2 4
# vrf context test2
#   description test description
#   ip auto-discard
#   ip domain-name test.com

- name: Override VRF configuration
  cisco.nxos.vrf_global:
    config:
      vrfs:
        - name: management
          ip:
            name_server:
              address_list:
                - 192.168.255.1
            route:
              - source: 0.0.0.0/0
                destination: 192.168.255.1
        - name: test1
          ip:
            auto_discard: false
            name_server:
              address_list:
                - 192.168.255.1
            route:
              - source: 192.0.0.0/24
                destination: 192.0.2.22
    state: overridden

# Task Output:
# ------------
#
# before:
#   vrfs:
#    - name: management
#      ip:
#        name_server:
#          address_list:
#          - 192.168.255.1
#        route:
#        - source: 0.0.0.0/0
#          destination: 192.168.255.1
#    - name: test1
#      description: this is description
#      ip:
#        domain_name: example.com
#        domain_list:
#        - example.net
#        - example.org
#        auto_discard: true
#        route:
#        - source: 192.0.0.0/24
#          destination: 192.0.2.22
#        - source: 192.0.0.0/24
#          destination: 192.0.2.22
#          vrf: temp1
#        - source: 192.0.2.0/24
#          destination: 192.0.2.22
#          tags:
#            tag_value: 2
#            route_pref: 4
#      vni:
#        vni_number: 5
#    - name: test2
#      description: test description
#      ip:
#        auto_discard: true
#        domain_name: test.com
#
# commands:
# - vrf context test1
# - no description this is description
# - no ip domain-name example.com
# - no ip domain-list example.net
# - no ip domain-list example.org
# - ip name-server 192.168.255.1
# - no ip auto-discard
# - no vni 5
# - no ip route 192.0.0.0/24 192.0.2.22 vrf temp1
# - no ip route 192.0.2.0/24 192.0.2.22 tag 2 4
# - vrf context test2
# - no description test description
# - no ip auto-discard
# - no ip domain-name test.com
#
# after:
#   vrfs:
#    - name: management
#      ip:
#        name_server:
#          address_list:
#          - 192.168.255.1
#        route:
#        - source: 0.0.0.0/0
#          destination: 192.168.255.1
#    - name: test1
#      ip:
#        auto_discard: false
#        name_server:
#          address_list:
#          - 192.168.255.1
#        route:
#        - source: 192.0.0.0/24
#          destination: 192.0.2.22

# Using replaced

# Before state:
# -------------
#
# nxos# show running-config | section ^vrf
# vrf context management
#   ip name-server 192.168.255.1
#   ip route 0.0.0.0/0 192.168.255.1
# vrf context temp
#   ip domain-name test.org
#   ip domain-list example.net
#   ip domain-list example.com
#   ip domain-list test.org
#   ip name-server 192.168.0.1 192.169.1.3
#   ip name-server 192.168.0.1 use-vrf temp1
#   multicast service-reflect interface Ethernet1/1 map interface Ethernet2/2
#   multicast service-reflect interface Ethernet2/1 map interface Ethernet4/2
#   description this is descrition
#   vni 5
#   ip auto-discard
#   ip route 192.0.0.0/24 192.0.2.22
#   ip route 192.0.0.0/24 192.0.2.22 vrf temp1
#   ip route 192.0.2.0/24 192.0.2.22 tag 2 4
#   ip mroute 192.168.1.0/24 192.168.1.1
#   ip mroute 192.168.1.0/24 192.168.1.2 2 vrf temp1
#   ip icmp-errors source-interface po1
#   ip igmp ssm-translate 232.0.0.0/8 10.1.1.1
#   ip igmp ssm-translate 239.1.2.3/24 192.168.1.1
#   ip multicast multipath legacy
#   ip multicast multipath resilient
#   ip multicast rpf select vrf temp1 group-list 238.1.0.0/24
#   ip multicast rpf select vrf temp1 group-list 239.1.0.0/24
#   ip multicast group-range prefix-list temp2
#   ipv6 multicast multipath none
#   ipv6 multicast multipath resilient
#   ipv6 multicast group-range prefix-list temp2
#   ipv6 mld ssm-translate ff28::/16 2001:db8:0:abcd::2
#   ipv6 mld ssm-translate ff30::/16 2001:db8:0:abcd::1
#   ipv6 mld ssm-translate ff32::/16 2001:db8:0:abcd::2
#   ipv6 mld ssm-translate ff32::/16 2001:db8:0:abcd::3

- name: Replaced state for VRF configuration
  cisco.nxos.nxos_vrf_global:
    config:
      vrfs:
        - ip:
            name_server:
              address_list:
                - 192.168.255.1
            route:
              - destination: 192.168.255.1
                source: 0.0.0.0/0
          name: management
        - name: temp
          description: Test
          ip:
            auto_discard: true
            domain_list:
              - invalid.com
              - example.com
            domain_name: test.org
    state: replaced

# Task Output:
# ------------
#
# before:
#   vrfs:
#    - ip:
#        name_server:
#          address_list:
#          - 192.168.255.1
#        route:
#        - destination: 192.168.255.1
#          source: 0.0.0.0/0
#      name: management
#    - description: this is descrition
#      ip:
#        auto_discard: true
#        domain_list:
#        - example.net
#        - test.org
#        - example.com
#        domain_name: test.org
#        icmp_err:
#          source_interface:
#            interface: port-channel
#            interface_value: '1'
#        igmp:
#          ssm_translate:
#          - group: 232.0.0.0/8
#            source: 10.1.1.1
#          - group: 239.1.2.3/24
#            source: 192.168.1.1
#        mroutes:
#        - group: 192.168.1.0/24
#          source: 192.168.1.1
#        - group: 192.168.1.0/24
#          preference: 2
#          source: 192.168.1.2
#          vrf: temp1
#        multicast:
#          multipath:
#            resilient: true
#            splitting_type:
#              legacy: true
#          rpf:
#          - group_list_range: 238.1.0.0/24
#            vrf_name: temp1
#          - group_list_range: 239.1.0.0/24
#            vrf_name: temp1
#        name_server:
#          address_list:
#          - 192.168.0.1
#          - 192.169.1.3
#          use_vrf:
#            source_address: 192.168.0.1
#            vrf: temp1
#        route:
#        - destination: 192.0.2.22
#          source: 192.0.0.0/24
#        - destination: 192.0.2.22
#          source: 192.0.0.0/24
#          vrf: temp1
#        - destination: 192.0.2.22
#          source: 192.0.2.0/24
#          tags:
#            route_pref: 4
#            tag_value: 2
#      ipv6:
#        mld_ssm_translate:
#        - group: ff28::/16
#          source: 2001:db8:0:abcd::2
#        - group: ff30::/16
#          source: 2001:db8:0:abcd::1
#        - group: ff32::/16
#          source: 2001:db8:0:abcd::2
#        - group: ff32::/16
#          source: 2001:db8:0:abcd::3
#        multicast:
#          group_range_prefix_list: temp2
#          multipath:
#            resilient: true
#            splitting_type:
#              none: true
#      multicast:
#        service_reflect:
#        - map_to: Ethernet2/2
#          service_interface: Ethernet1/1
#        - map_to: Ethernet4/2
#          service_interface: Ethernet2/1
#      name: temp
#      vni:
#        vni_number: 5
#
# commands:
#   - vrf context temp
#   - description Test
#   - no ip name-server 192.168.0.1 192.169.1.3
#   - no ip icmp-errors source-interface port-channel 1
#   - no ip multicast multipath resilient
#   - no ip multicast multipath legacy
#   - no ip name-server 192.168.0.1 use-vrf temp1
#   - no vni 5
#   - no ipv6 multicast group-range prefix-list temp2
#   - no ipv6 multicast multipath resilient
#   - no ipv6 multicast multipath none
#   - ip domain-list invalid.com
#   - no ip domain-list example.net
#   - no ip domain-list test.org
#   - no ip igmp ssm-translate 232.0.0.0/8 10.1.1.1
#   - no ip igmp ssm-translate 239.1.2.3/24 192.168.1.1
#   - no ip mroute 192.168.1.0/24 192.168.1.1
#   - no ip mroute 192.168.1.0/24 192.168.1.2 2 vrf temp1
#   - no ip multicast rpf select vrf temp1 group-list 238.1.0.0/24
#   - no ip multicast rpf select vrf temp1 group-list 239.1.0.0/24
#   - no ip route 192.0.0.0/24 192.0.2.22
#   - no ip route 192.0.0.0/24 192.0.2.22 vrf temp1
#   - no ip route 192.0.2.0/24 192.0.2.22 tag 2 4
#   - no multicast service-reflect interface Ethernet1/1 map interface Ethernet2/2
#   - no multicast service-reflect interface Ethernet2/1 map interface Ethernet4/2
#   - no ipv6 mld ssm-translate ff28::/16 2001:db8:0:abcd::2
#   - no ipv6 mld ssm-translate ff30::/16 2001:db8:0:abcd::1
#   - no ipv6 mld ssm-translate ff32::/16 2001:db8:0:abcd::2
#   - no ipv6 mld ssm-translate ff32::/16 2001:db8:0:abcd::3
#
# after:
#   vrfs:
#    - ip:
#        name_server:
#          address_list:
#          - 192.168.255.1
#        route:
#        - destination: 192.168.255.1
#          source: 0.0.0.0/0
#      name: management
#    - description: Test
#      ip:
#        auto_discard: true
#        domain_list:
#        - invalid.com
#        - example.com
#        domain_name: test.org
#        multicast:
#          rpf:
#          - group_list_range: 238.1.0.0/24
#            vrf_name: temp1
#          - group_list_range: 239.1.0.0/24
#            vrf_name: temp1
#
# After state:
# ------------
# router-ios#show running-config | section ^vrf
# vrf context management
#   ip name-server 192.168.255.1
#   ip route 0.0.0.0/0 192.168.255.1
# vrf context temp
#   ip domain-name test.org
#   ip domain-list example.com
#   ip domain-list invalid.com
#   description Test
#   ip auto-discard
#   ip multicast rpf select vrf temp1 group-list 238.1.0.0/24
#   ip multicast rpf select vrf temp1 group-list 239.1.0.0/24
#   ip multicast group-range prefix-list temp2

返回值

通用返回值记录在此处,以下是此模块独有的字段

描述

after

字典

模块执行后的最终配置。

返回: 当发生更改时

示例: "此输出将始终与模块 argspec 的格式相同。\n"

before

字典

模块执行之前的配置。

返回:statemergedreplacedoverriddendeletedpurged

示例: "此输出将始终与模块 argspec 的格式相同。\n"

commands

列表 / 元素=字符串

推送到远程设备的一组命令。

返回:statemergedreplacedoverriddendeletedpurged

示例: ["vrf context management", "description this is management vrf", "ip domain-name example.com"]

gathered

字典

从远程设备收集的有关网络资源的事实,以结构化数据的形式呈现。

返回:stategathered

示例: "此输出将始终与模块 argspec 的格式相同。\n"

parsed

字典

running_config 选项中提供的设备原生配置,根据模块 argspec 解析为结构化数据。

返回:stateparsed

示例: "此输出将始终与模块 argspec 的格式相同。\n"

rendered

列表 / 元素=字符串

任务中提供的配置以设备原生格式呈现(离线)。

返回:staterendered

示例: ["vrf context test1", "description This is a test VRF", "ip route 192.0.0.0/24 192.0.2.22"]

作者

  • Vinay Mulugund (@roverflow)