community.network.ce_vrf_af 模块 – 管理华为 CloudEngine 交换机上的 VPN 实例地址族。

注意

此模块是 community.network 集合(版本 5.1.0)的一部分。

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

要安装它,请使用:ansible-galaxy collection install community.network

要在剧本中使用它,请指定:community.network.ce_vrf_af

注意

community.network 集合已被弃用,并将从 Ansible 12 中删除。有关更多信息,请参阅讨论线程

已弃用

在以下版本中删除:

版本 6.0.0

原因:

此集合及其中的所有内容均未维护且已弃用。

替代方案:

未知。

概要

  • 管理华为 CloudEngine 交换机的 VPN 实例地址族。

别名:network.cloudengine.ce_vrf_af

参数

参数

注释

evpn

布尔值

是扩展 vpn 还是普通 vpn。

选择

  • false ← (默认)

  • true

route_distinguisher

字符串

VPN 实例路由区分符,用于区分来自不同 vpn 的相同路由前缀的 RD。必须在设置 vpn_target_value 之前设置 RD。

state

字符串

管理 af 的状态。

选择

  • "present" ← (默认)

  • "absent"

vpn_target_state

字符串

管理 vpn 目标的状态。

选择

  • "present"

  • "absent"

vpn_target_type

字符串

VPN 实例 vpn 目标类型。

选择

  • "export_extcommunity"

  • "import_extcommunity"

vpn_target_value

字符串

VPN 实例目标值。例如 X.X.X.X:number<0-65535> 或 number<0-65535>:number<0-4294967295> 或 number<0-65535>.number<0-65535>:number<0-65535> 或 number<65536-4294967295>:number<0-65535>,但不支持 0:0 和 0.0:0。

vrf

字符串 / 必需

VPN 实例。

vrf_aftype

字符串

VPN 实例地址族。

选择

  • "v4" ← (默认)

  • "v6"

注意

注意

  • 如果 *state=absent*,无论非必需参数如何,都将删除 vrf。

  • 此模块需要在被管理的远程设备上启用 netconf 系统服务。

  • 推荐的连接方式是 netconf

  • 此模块也适用于旧版剧本的 local 连接。

示例

- name: Vrf af module test
  hosts: cloudengine
  connection: local
  gather_facts: false
  vars:
    cli:
      host: "{{ inventory_hostname }}"
      port: "{{ ansible_ssh_port }}"
      username: "{{ username }}"
      password: "{{ password }}"
      transport: cli

  tasks:

  - name: Config vpna, set address family is ipv4
    community.network.ce_vrf_af:
      vrf: vpna
      vrf_aftype: v4
      state: present
      provider: "{{ cli }}"
  - name: Config vpna, delete address family is ipv4
    community.network.ce_vrf_af:
      vrf: vpna
      vrf_aftype: v4
      state: absent
      provider: "{{ cli }}"
  - name: Config vpna, set address family is ipv4,rd=1:1,set vpn_target_type=export_extcommunity,vpn_target_value=2:2
    community.network.ce_vrf_af:
      vrf: vpna
      vrf_aftype: v4
      route_distinguisher: 1:1
      vpn_target_type: export_extcommunity
      vpn_target_value: 2:2
      vpn_target_state: present
      state: present
      provider: "{{ cli }}"
  - name: Config vpna, set address family is ipv4,rd=1:1,delete vpn_target_type=export_extcommunity,vpn_target_value=2:2
    community.network.ce_vrf_af:
      vrf: vpna
      vrf_aftype: v4
      route_distinguisher: 1:1
      vpn_target_type: export_extcommunity
      vpn_target_value: 2:2
      vpn_target_state: absent
      state: present
      provider: "{{ cli }}"

返回值

常见的返回值在此处 记录,以下是此模块特有的字段

描述

changed

布尔值

检查设备上是否进行了更改

返回: 始终

示例: true

end_state

字典

模块执行后交换机的键/值对

返回: 始终

示例: {"route_distinguisher": ["1:1", "2:2"], "vpn_target_type": ["import_extcommunity", "3:3"], "vpn_target_value": [], "vrf": "vpna", "vrf_aftype": ["ipv4uni", "ipv6uni"]}

existing

字典

现有交换机的键/值对

返回: 始终

示例: {"route_distinguisher": ["1:1", "2:2"], "vpn_target_type": [], "vpn_target_value": [], "vrf": "vpna", "vrf_aftype": ["ipv4uni", "ipv6uni"]}

proposed

字典

传递到模块的参数的键/值对

返回: 始终

示例: {"evpn": "none", "state": "present", "vpn_targe_state": "absent", "vpn_target_type": "none", "vpn_target_value": "none", "vrf": "vpna", "vrf_aftype": "v4"}

updates

列表 / 元素=字符串

发送到设备的命令列表

返回: 始终

示例: ["ip vpn-instance vpna", "vpn-target 3:3 import_extcommunity"]

状态

  • 此模块将在 6.0.0 版本中移除。 [已弃用]

  • 更多信息请参阅 已弃用

作者

  • 杨阳 (@QijunPan)