fortinet.fortios.fortios_system_wccp 模块 – 在 Fortinet 的 FortiOS 和 FortiGate 中配置 WCCP。

注意

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

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

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

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

fortinet.fortios 2.0.0 中的新增功能

概要

  • 此模块能够通过允许用户设置和修改系统功能和 wccp 类别来配置 FortiGate 或 FortiOS (FOS) 设备。示例包括所有参数,需要在使用前将值调整为数据源。已在 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_wccp

字典

配置 WCCP。

assignment_bucket_format

字符串

WCCP 缓存引擎的分配桶格式。

选项

  • "wccp-v2"

  • "cisco-implementation"

assignment_dstaddr_mask

字符串

分配目标地址掩码。

assignment_method

字符串

哈希键分配优先级。

选项

  • "HASH"

  • "MASK"

  • "any"

assignment_srcaddr_mask

字符串

分配源地址掩码。

assignment_weight

整数

WCCP 缓存引擎的哈希权重/比率分配。

authentication

字符串

启用/禁用 MD5 身份验证。

选项

  • "enable"

  • "disable"

cache_engine_method

字符串

用于将流量转发到路由器或返回到缓存引擎的方法。

选项

  • "GRE"

  • "L2"

cache_id

字符串

所有路由器都已知的 IP 地址。如果地址相同,请使用默认值 0.0.0.0。

forward_method

字符串

用于将流量转发到缓存服务器的方法。

选项

  • "GRE"

  • "L2"

  • "any"

group_address

字符串

缓存路由器使用的 IP 多播地址。对于 FortiGate 忽略多播 WCCP 流量,请使用默认值 0.0.0.0。

password

字符串

MD5 身份验证的密码。

ports

列表 / 元素=字符串

服务端口。

ports_defined

字符串

匹配方法。

选项

  • "source"

  • "destination"

primary_hash

列表 / 元素=字符串

哈希方法。

选项

  • "src-ip"

  • "dst-ip"

  • "src-port"

  • "dst-port"

priority

整数

服务优先级。

protocol

整数

服务协议。

return_method

字符串

用于拒绝重定向的数据包并将其返回到 FortiGate 单元的方法。

选项

  • "GRE"

  • "L2"

  • "any"

router_id

字符串

所有缓存引擎都已知的 IP 地址。如果所有缓存引擎都连接到相同的 FortiGate 接口,请使用默认值 0.0.0.0。

router_list

列表 / 元素=字符串

一个或多个 WCCP 路由器的 IP 地址。

server_list

列表 / 元素=字符串

最多四个缓存服务器的 IP 地址和网络掩码。

server_type

字符串

缓存服务器类型。

选项

  • "forward"

  • "proxy"

service_id

字符串 / 必需

服务 ID。

service_type

字符串

缓存服务器用于流量的逻辑拦截和重定向的 WCCP 服务类型。

选项

  • "auto"

  • "standard"

  • "dynamic"

vdom

字符串

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

默认值: "root"

备注

注意

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

  • 此模块支持 check_mode。

示例

- name: Configure WCCP.
  fortinet.fortios.fortios_system_wccp:
      vdom: "{{ vdom }}"
      state: "present"
      access_token: "<your_own_value>"
      system_wccp:
          assignment_bucket_format: "wccp-v2"
          assignment_dstaddr_mask: "<your_own_value>"
          assignment_method: "HASH"
          assignment_srcaddr_mask: "<your_own_value>"
          assignment_weight: "0"
          authentication: "enable"
          cache_engine_method: "GRE"
          cache_id: "<your_own_value>"
          forward_method: "GRE"
          group_address: "<your_own_value>"
          password: "<your_own_value>"
          ports: "<your_own_value>"
          ports_defined: "source"
          primary_hash: "src-ip"
          priority: "0"
          protocol: "0"
          return_method: "GRE"
          router_id: "<your_own_value>"
          router_list: "<your_own_value>"
          server_list: "<your_own_value>"
          server_type: "forward"
          service_id: "<your_own_value>"
          service_type: "auto"

返回值

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

描述

build

字符串

FortiGate 镜像的构建编号

返回:始终

示例: "1547"

http_method

字符串

最后用于将内容置备到 FortiGate 的方法

返回:始终

示例: "PUT"

http_status

字符串

FortiGate 上次操作的最终结果

返回:始终

示例: "200"

mkey

字符串

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

返回: 成功

示例: "id"

name

字符串

用于完成请求的表名

返回:始终

示例: "urlfilter"

path

字符串

用于完成请求的表路径

返回:始终

示例: "webfilter"

revision

字符串

内部版本号

返回:始终

示例: "17.0.2.10658"

serial

字符串

设备序列号

返回:始终

示例: "FGVMEVYYQT3AB5352"

status

字符串

操作结果指示

返回:始终

示例: "success"

vdom

字符串

使用的虚拟域

返回:始终

示例: "root"

version

字符串

FortiGate 版本

返回:始终

示例: "v5.6.3"

作者

  • 郑凌 (@chillancezen)

  • 薛杰 (@JieX19)

  • 陆宏斌 (@fgtdev-hblu)

  • 沈峰 (@frankshen01)

  • Miguel Angel Munoz (@mamunozgonzalez)

  • Nicolas Thomas (@thomnico)