fortinet.fortimanager.fmgr_firewall_ippool 模块 – 配置 IPv4 IP 池。

注意

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

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

要安装它,请使用:ansible-galaxy collection install fortinet.fortimanager

要在剧本中使用它,请指定:fortinet.fortimanager.fmgr_firewall_ippool

fortinet.fortimanager 1.0.0 中的新增功能

概要

  • 此模块能够配置 FortiManager 设备。

  • 示例包括所有参数和值,这些参数和值需要在使用前调整为数据源。

参数

参数

注释

access_token

字符串

无需使用用户名和密码即可访问 FortiManager 的令牌。

adom

字符串 / 必需

请求的 URL 中的参数 (adom)。

bypass_validation

布尔值

仅当模块模式与 FortiManager API 结构不同时才设置为 True,模块将继续执行而不验证参数。

选项

  • false ← (默认)

  • true

enable_log

布尔值

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

选项

  • false ← (默认)

  • true

firewall_ippool

字典

设置的顶级参数。

add_nat64_route

别名:add-nat64-route

字符串

启用/禁用添加 NAT64 路由。

选项

  • “禁用”

  • “启用”

arp_intf

别名:arp-intf

字符串

从可用选项中选择一个将回复 ARP 请求的接口。

arp_reply

别名:arp-reply

字符串

当 IP 池添加到策略时,启用/禁用回复 ARP 请求

选项

  • “禁用”

  • “启用”

associated_interface

别名:associated-interface

字符串

关联的接口名称。

block_size

别名:block-size

整数

一个块中的地址数

cgn_block_size

别名:cgn-block-size

整数

一个块中的端口数

cgn_client_endip

别名:cgn-client-endip

字符串

最终客户端 IPv4 地址

cgn_client_ipv6shift

别名:cgn-client-ipv6shift

整数

固定分配的 IPv6 偏移。

cgn_client_startip

别名:cgn-client-startip

字符串

第一个客户端 IPv4 地址

cgn_fixedalloc

别名:cgn-fixedalloc

字符串

启用/禁用固定分配模式。

选项

  • “禁用”

  • “启用”

cgn_overload

别名:cgn-overload

字符串

启用/禁用过载模式。

选项

  • “禁用”

  • “启用”

cgn_port_end

别名:cgn-port-end

整数

可以分配的结束公共端口。

cgn_port_start

别名:cgn-port-start

整数

可以分配的起始公共端口。

cgn_spa

别名:cgn-spa

字符串

启用/禁用单端口分配模式。

选项

  • “禁用”

  • “启用”

client_prefix_length

别名:client-prefix-length

整数

单个确定性 NAT64 客户端的子网长度

comments

字符串

评论。

dynamic_mapping

列表 / 元素=字典

动态映射。

_scope

列表 / 元素=字典

范围。

name

字符串

名称。

vdom

字符串

Vdom。

add_nat64_route

别名:add-nat64-route

字符串

启用/禁用添加 NAT64 路由。

选项

  • “禁用”

  • “启用”

arp_intf

别名:arp-intf

字符串

Arp intf。

arp_reply

别名:arp-reply

字符串

Arp reply。

选项

  • “禁用”

  • “启用”

associated_interface

别名:associated-interface

字符串

关联的接口。

block_size

别名:block-size

整数

块大小。

cgn_block_size

别名:cgn-block-size

整数

Cgn 块大小。

cgn_client_endip

别名:cgn-client-endip

字符串

Cgn 客户端结束 IP。

cgn_client_ipv6shift

别名:cgn-client-ipv6shift

整数

固定分配的 IPv6 偏移。

cgn_client_startip

别名:cgn-client-startip

字符串

Cgn 客户端起始 IP。

cgn_fixedalloc

别名:cgn-fixedalloc

字符串

Cgn 固定分配。

选项

  • “禁用”

  • “启用”

cgn_overload

别名:cgn-overload

字符串

Cgn 过载。

选项

  • “禁用”

  • “启用”

cgn_port_end

别名:cgn-port-end

整数

CGN 端口结束。

cgn_port_start

别名:cgn-port-start

整数

CGN 端口起始。

cgn_spa

别名:cgn-spa

字符串

CGN SPA。

选项

  • “禁用”

  • “启用”

client_prefix_length

别名:client-prefix-length

整数

单个确定性 NAT64 客户端的子网长度

comments

字符串

备注。

endip

字符串

结束 IP。

endport

整数

最终端口号

exclude_ip

别名: exclude-ip

any

(list) 排除 IP x。

icmp_session_quota

别名: icmp-session-quota

整数

每个客户端允许的最大并发 ICMP 会话数

nat64

字符串

启用/禁用 NAT64。

选项

  • “禁用”

  • “启用”

num_blocks_per_user

别名: num-blocks-per-user

整数

每个用户的块数。

pba_interim_log

别名: pba-interim-log

整数

端口块分配临时日志记录间隔

pba_timeout

别名: pba-timeout

整数

PBA 超时。

permit_any_host

别名: permit-any-host

字符串

允许任何主机。

选项

  • “禁用”

  • “启用”

port_per_user

别名: port-per-user

整数

每个用户的端口数

privileged_port_use_pba

别名: privileged-port-use-pba

字符串

启用/禁用从端口块分配中选择外部端口以用于特权端口的 NAT

选项

  • “禁用”

  • “启用”

source_endip

别名: source-endip

字符串

源结束 IP。

source_prefix6

别名: source-prefix6

字符串

要转换的源 IPv6 网络

source_startip

别名: source-startip

字符串

源起始 IP。

startip

字符串

起始 IP。

startport

整数

起始端口号

subnet_broadcast_in_ippool

别名: subnet-broadcast-in-ippool

字符串

启用/禁用在 NAT64 IP 池中包含子网地址和广播 IP 地址。

选项

  • “禁用”

  • “启用”

tcp_session_quota

别名: tcp-session-quota

整数

每个客户端允许的最大并发 TCP 会话数

type

字符串

类型。

选项

  • "overload"

  • "one-to-one"

  • "fixed-port-range"

  • "port-block-allocation"

  • "cgn-resource-allocation"

udp_session_quota

别名: udp-session-quota

整数

每个客户端允许的最大并发 UDP 会话数

utilization_alarm_clear

别名: utilization-alarm-clear

整数

利用率警报清除。

utilization_alarm_raise

别名: utilization-alarm-raise

整数

利用率警报触发。

endip

字符串

最终 IPv4 地址

endport

整数

最终端口号

exclude_ip

别名: exclude-ip

any

(list) 排除 IP x。

icmp_session_quota

别名: icmp-session-quota

整数

每个客户端允许的最大并发 ICMP 会话数

name

字符串 / 必需

IP 池名称。

nat64

字符串

启用/禁用 NAT64。

选项

  • “禁用”

  • “启用”

num_blocks_per_user

别名: num-blocks-per-user

整数

一个用户可以使用的地址块的数量

pba_interim_log

别名: pba-interim-log

整数

端口块分配临时日志记录间隔

pba_timeout

别名: pba-timeout

整数

端口块分配超时

permit_any_host

别名: permit-any-host

字符串

启用/禁用完全锥形 NAT。

选项

  • “禁用”

  • “启用”

port_per_user

别名: port-per-user

整数

每个用户的端口数

privileged_port_use_pba

别名: privileged-port-use-pba

字符串

启用/禁用从端口块分配中选择外部端口以用于特权端口的 NAT

选项

  • “禁用”

  • “启用”

source_endip

别名: source-endip

字符串

最终 IPv4 地址

source_prefix6

别名: source-prefix6

字符串

要转换的源 IPv6 网络

source_startip

别名: source-startip

字符串

起始 IPv4 地址

startip

字符串

起始 IPv4 地址

startport

整数

起始端口号

subnet_broadcast_in_ippool

别名: subnet-broadcast-in-ippool

字符串

启用/禁用在 NAT64 IP 池中包含子网地址和广播 IP 地址。

选项

  • “禁用”

  • “启用”

tcp_session_quota

别名: tcp-session-quota

整数

每个客户端允许的最大并发 TCP 会话数

type

字符串

IP 池类型

选项

  • "overload"

  • "one-to-one"

  • "fixed-port-range"

  • "port-block-allocation"

  • "cgn-resource-allocation"

udp_session_quota

别名: udp-session-quota

整数

每个客户端允许的最大并发 UDP 会话数

utilization_alarm_clear

别名: utilization-alarm-clear

整数

池利用率警报清除阈值

utilization_alarm_raise

别名: utilization-alarm-raise

整数

池利用率警报触发阈值

forticloud_access_token

字符串

使用 FortiCloud API 访问令牌验证 Ansible 客户端。

proposed_method

字符串

底层 Json RPC 请求的覆盖方法。

选项

  • "update"

  • "set"

  • "add"

rc_failed

list / elements=integer

将覆盖失败条件的 rc 代码列表。

rc_succeeded

list / elements=integer

将覆盖成功条件的 rc 代码列表。

state

字符串 / 必需

创建、更新或删除对象的指令。

选项

  • "present"

  • "absent"

workspace_locking_adom

字符串

在工作区模式下锁定的 FortiManager 的 ADOM,该值可以是全局的,也可以是包括 root 的其他值。

workspace_locking_timeout

整数

等待其他用户释放工作区锁的最长时间(秒)。

默认值: 300

备注

注意

  • 从 2.4.0 版本开始,所有输入参数均使用下划线命名约定 (snake_case)。 请将诸如“var-name”之类的参数更改为“var_name”。 旧的参数名称仍然可用,但您会收到弃用警告。 您可以通过在 ansible.cfg 中设置 deprecation_warnings=False 来忽略此警告。

  • 此 FortiManager 模块支持在工作区锁定模式下运行,顶级参数 workspace_locking_adom 和 workspace_locking_timeout 可以帮助完成工作。

  • 要创建或更新对象,请使用 state present 指令。

  • 要删除对象,请使用 state absent 指令。

  • 通常,当返回非零 rc 时,运行一个模块可能会失败。 您还可以使用参数 rc_failed 和 rc_succeeded 覆盖失败或成功的条件

示例

- name: Example playbook
  hosts: fortimanagers
  connection: httpapi
  vars:
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_httpapi_port: 443
  tasks:
    - name: Configure IPv4 IP pools.
      fortinet.fortimanager.fmgr_firewall_ippool:
        bypass_validation: false
        adom: ansible
        state: present
        firewall_ippool:
          comments: "ansible-comment"
          endip: "222.222.222.254"
          name: "ansible-test"
          startip: "222.222.222.0"
          type: overload # <value in [overload, one-to-one, fixed-port-range, ...]>

- name: Gathering fortimanager facts
  hosts: fortimanagers
  gather_facts: false
  connection: httpapi
  vars:
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_httpapi_port: 443
  tasks:
    - name: Retrieve all the IPv4 IP pools
      fortinet.fortimanager.fmgr_fact:
        facts:
          selector: "firewall_ippool"
          params:
            adom: "ansible"
            ippool: "your_value"

返回值

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

描述

meta

字典

请求的结果。

返回: 始终

request_url

字符串

请求的完整 URL。

返回: 始终

示例: "/sys/login/user"

response_code

整数

API 请求的状态。

返回: 始终

示例: 0

response_data

list / elements=string

API 响应。

返回: 始终

response_message

字符串

API 响应的描述性消息。

返回: 始终

示例: "OK."

system_information

字典

目标系统的信息。

返回: 始终

rc

整数

请求的状态。

返回: 始终

示例: 0

version_check_warning

list / elements=string

如果 playbook 中使用的参数不受当前 FortiManager 版本支持,则发出警告。

返回: complex

作者

  • Xinwei Du (@dux-fortinet)

  • Xing Li (@lix-fortinet)

  • Jie Xue (@JieX19)

  • Link Zheng (@chillancezen)

  • Frank Shen (@fshen01)

  • Hongbin Lu (@fgtdev-hblu)