fortinet.fortios.fortios_system_virtual_switch 模块 – 配置 Fortinet 的 FortiOS 和 FortiGate 中的虚拟硬件交换机接口。

注意

此模块是 fortinet.fortios 集合 (版本 2.3.8) 的一部分。

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

要安装它,请使用:ansible-galaxy collection install fortinet.fortios。您需要其他要求才能使用此模块,有关详细信息,请参见 要求

要在 playbook 中使用它,请指定:fortinet.fortios.fortios_system_virtual_switch

fortinet.fortios 2.0.0 中的新增功能

概要

  • 此模块能够配置 FortiGate 或 FortiOS (FOS) 设备,允许用户设置和修改系统功能和 virtual_switch 类别。示例包括所有参数,在使用前需要将值调整到数据源。已在 FOS v6.0.0 上测试。

要求

执行此模块的主机需要以下要求。

  • ansible>=2.15

参数

参数

注释

access_token

字符串

基于令牌的身份验证。从 FortiGate 的 GUI 生成。

enable_log

布尔值

启用/禁用任务日志记录。

选项

  • false ← (默认)

  • true

member_path

字符串

要操作的成员属性路径。

如果有多个属性,则用斜杠字符分隔。

标有 member_path 的参数对于执行成员操作是合法的。

member_state

字符串

在指定的属性路径下添加或删除成员。

指定 member_state 时,将忽略 state 选项。

选项

  • "present"

  • "absent"

state

字符串 / 必需

指示是创建还是删除对象。

选项

  • "present"

  • "absent"

system_virtual_switch

字典

配置虚拟硬件交换机接口。

name

字符串 / 必需

虚拟交换机的名称。

physical_switch

字符串

物理交换机父级。来源 system.physical-switch.name。

port

列表 / 元素=字典

配置成员端口。

alias

字符串

别名。

mediatype

字符串

选择 SFP 媒体接口类型。

选项

  • "cfp2-sr10"

  • "cfp2-lr4"

name

字符串 / 必需

物理接口名称。来源 system.interface.name。

speed

字符串

接口速度。

选项

  • "auto"

  • "10full"

  • "10half"

  • "100full"

  • "100half"

  • "1000full"

  • "1000half"

  • "1000auto"

  • "10000full"

  • "10000auto"

  • "40000full"

  • "100Gfull"

status

字符串

接口状态。

选项

  • "up"

  • "down"

span

字符串

启用/禁用 SPAN。

选项

  • "disable"

  • "enable"

span_dest_port

字符串

SPAN 目标端口。

span_direction

字符串

SPAN 方向。

选项

  • "rx"

  • "tx"

  • "both"

span_source_port

字符串

SPAN 源端口。

vlan

整数

VLAN。

vdom

字符串

虚拟域,在先前定义的那些虚拟域中。vdom 是 FortiGate 的虚拟实例,可以将其配置并用作不同的单元。

默认值: "root"

注释

注意

  • 旧版 fortiosapi 已弃用,httpapi 是运行 playbook 的首选方法。

  • 此模块支持 check_mode。

示例

- name: Configure virtual hardware switch interfaces.
  fortinet.fortios.fortios_system_virtual_switch:
      vdom: "{{ vdom }}"
      state: "present"
      access_token: "<your_own_value>"
      system_virtual_switch:
          name: "default_name_3"
          physical_switch: "<your_own_value> (source system.physical-switch.name)"
          port:
              -
                  alias: "<your_own_value>"
                  mediatype: "cfp2-sr10"
                  name: "default_name_8 (source system.interface.name)"
                  speed: "auto"
                  status: "up"
          span: "disable"
          span_dest_port: "<your_own_value>"
          span_direction: "rx"
          span_source_port: "<your_own_value>"
          vlan: "0"

返回值

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

描述

build

字符串

FortiGate 镜像的版本号

返回: 始终

示例: "1547"

http_method

字符串

上次用于将内容置备到 FortiGate 的方法

返回: 始终

示例: "PUT"

http_status

字符串

FortiGate 在上次应用的操作中给出的最后结果

返回: 始终

示例: "200"

mkey

字符串

上次调用 FortiGate 时使用的主密钥 (ID)

返回: 成功

示例: "id"

name

字符串

用于完成请求的表名

返回: 始终

示例: "urlfilter"

path

字符串

用于完成请求的表格路径

返回: 始终

示例: "webfilter"

版本号

字符串

内部版本号

返回: 始终

示例: "17.0.2.10658"

序列号

字符串

设备的序列号

返回: 始终

示例: "FGVMEVYYQT3AB5352"

status

字符串

操作结果指示

返回: 始终

示例: "success"

vdom

字符串

使用的虚拟域

返回: 始终

示例: "root"

版本

字符串

FortiGate 的版本

返回: 始终

示例: "v5.6.3"

作者

  • 郑 link (@chillancezen)

  • 薛杰 (@JieX19)

  • 卢洪斌 (@fgtdev-hblu)

  • 沈弗兰克 (@frankshen01)

  • 米格尔·安赫尔·穆诺兹 (@mamunozgonzalez)

  • 尼古拉斯·托马斯 (@thomnico)