fortinet.fortimanager.fmgr_dvmdb_device 模块 – 设备表,大多数属性是只读的,只能在内部更改。

注意

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

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

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

要在 playbook 中使用它,请指定: fortinet.fortimanager.fmgr_dvmdb_device

fortinet.fortimanager 1.0.0 中的新增功能

概要

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

  • 示例包含所有参数和值,在使用前需要根据数据源进行调整。

参数

参数

注释

access_token

字符串

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

adom

字符串 / 必需

请求 URL 中的参数 (adom)。

bypass_validation

布尔值

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

选项

  • false ← (默认)

  • true

device

字符串 / 必需

请求 URL 中的参数 (device)。

dvmdb_device

字典

设置的顶级参数。

adm_pass

任意

(列表) 管理员密码。

adm_usr

字符串

管理员用户名。

app_ver

字符串

应用程序版本。

av_ver

字符串

反病毒版本。

beta

整数

Beta 版本。

branch_pt

整数

分支点。

build

整数

版本号。

checksum

字符串

校验和。

cluster_worker

字符串

集群工作节点。

conf_status

字符串

配置状态。

选项

  • "unknown"

  • "insync"

  • "outofsync"

conn_mode

字符串

连接模式。

选项

  • "active"

  • "passive"

conn_status

字符串

连接状态。

选项

  • "UNKNOWN"

  • "up"

  • "down"

db_status

字符串

数据库状态。

选项

  • "unknown"

  • "nomod"

  • "mod"

desc

字符串

描述。

dev_status

字符串

设备状态。

选项

  • "none"

  • "unknown"

  • "checkedin"

  • "inprogress"

  • "installed"

  • "aborted"

  • "sched"

  • "retry"

  • "canceled"

  • "pending"

  • "retrieved"

  • "changed_conf"

  • "sync_fail"

  • "timeout"

  • "rev_revert"

  • "auto_updated"

eip

字符串

EIP 地址。

fap_cnt

整数

FAP 计数。

faz_full_act

别名:faz.full_act

整数

FAZ 全部活动。

faz_perm

别名:faz.perm

整数

FAZ 全部活动。

faz_quota

别名:faz.quota

整数

FAZ 全部活动。

faz_used

别名:faz.used

整数

FAZ 全部活动。

fex_cnt

整数

FEX 计数。

first_tunnel_up

整数

首次隧道启动时间。

flags

列表 / 元素=字符串

标志。

选项

  • "has_hdd"

  • "vdom_enabled"

  • "discover"

  • "reload"

  • "interim_build"

  • "offline_mode"

  • "is_model"

  • "fips_mode"

  • "linked_to_model"

  • "ip-conflict"

  • "faz-autosync"

  • "need_reset"

  • "backup_mode"

  • "azure_vwan_nva"

  • "fgsp_configured"

  • "cnf_mode"

  • "sase_managed"

  • "override_management_intf"

  • "sdwan_management"

  • "deny_api_access"

foslic_cpu

整数

虚拟机计量 vCPU 数量。

foslic_dr_site

字符串

虚拟机计量 DR 站点状态。

选项

  • "disable"

  • "enable"

foslic_inst_time

整数

虚拟机计量首次部署时间

foslic_last_sync

整数

虚拟机计量上次同步时间

foslic_ram

整数

虚拟机计量设备 RAM 大小

foslic_type

字符串

虚拟机计量许可证类型。

选项

  • "temporary"

  • "trial"

  • "regular"

  • "trial_expired"

foslic_utm

列表 / 元素=字符串

虚拟机计量服务

fw - 防火墙

av - 反病毒

ips - 入侵防御

app - 应用控制

url - 网页过滤

utm - 全功能 UTM

fwb - FortiWeb

选项

  • "fw"

  • "av"

  • "ips"

  • "app"

  • "url"

  • "utm"

  • "fwb"

fsw_cnt

整数

FSW 计数。

ha_group_id

整数

高可用性组 ID。

ha_group_name

字符串

高可用性组名称。

ha_mode

字符串

启用 - 为非 FOS HA 设备保留的值。

选项

  • "standalone"

  • "AP"

  • "AA"

  • "ELBC"

  • "DUAL"

  • "enabled"

  • "unknown"

  • "fmg-enabled"

  • "autoscale"

ha_slave

列表 / 元素=字典

高可用性从设备。

conf_status

整数

配置状态。

idx

整数

索引。

name

字符串

名称。

prio

整数

优先级。

role

字符串

角色。

选项

  • "slave"

  • "master"

sn

字符串

序列号。

status

整数

状态。

ha_upgrade_mode

整数

高可用性升级模式。

ha_vsn

别名:ha.vsn

字符串

高可用性版本。

hdisk_size

整数

硬盘大小。

hostname

字符串

主机名。

hw_generation

整数

硬件代数。

hw_rev_major

整数

硬件主版本。

hw_rev_minor

整数

硬件次版本。

hyperscale

整数

超大规模。

ip

字符串

IP 地址。

ips_ext

整数

IPS 扩展。

ips_ver

字符串

IPS 版本。

last_checked

整数

上次检查时间。

last_resync

整数

上次重新同步时间。

latitude

字符串

纬度。

lic_flags

整数

许可证标志。

lic_region

字符串

许可证区域。

location_from

字符串

位置来源。

logdisk_size

整数

日志磁盘大小。

longitude

字符串

经度。

maxvdom

整数

最大 vdom 数量。

meta_fields

别名:meta fields

字典

默认元字段

mgmt_id

整数

管理 ID。

mgmt_if

字符串

管理接口。

mgmt_mode

字符串

管理模式。

选项

  • "unreg"

  • "fmg"

  • "faz"

  • "fmgfaz"

mgmt_uuid

字符串

管理 UUID。

mgt_vdom

字符串

管理 vdom。

module_sn

字符串

模块序列号。

mr

整数

MR。

name

字符串

设备的唯一名称。

nsxt_service_name

字符串

NSX-T 服务名称。

os_type

字符串

操作系统类型。

选项

  • "unknown"

  • "fos"

  • "fsw"

  • "foc"

  • "fml"

  • "faz"

  • "fwb"

  • "fch"

  • "fct"

  • "log"

  • "fmg"

  • "fsa"

  • "fdd"

  • "fac"

  • "fpx"

  • "fna"

  • "fdc"

  • "ffw"

  • "fsr"

  • "fad"

  • "fap"

  • "fxt"

  • "fts"

  • "fai"

  • "fwc"

  • "fis"

  • "fed"

  • "fpa"

  • "fca"

  • "ftc"

  • "fss"

os_ver

字符串

操作系统版本。

选项

  • "unknown"

  • "0.0"

  • "1.0"

  • "2.0"

  • "3.0"

  • "4.0"

  • "5.0"

  • "6.0"

  • "7.0"

  • "8.0"

  • "9.0"

patch

整数

补丁版本。

platform_str

字符串

平台字符串。

首选镜像版本

字符串

首选镜像版本。

prio

整数

优先级。

私钥

字符串

私钥。

私钥状态

整数

私钥状态。

预共享密钥 (PSK)

字符串

预共享密钥。

版本信息

字符串

版本信息。

role

字符串

角色。

选项

  • "master"

  • "ha-slave"

  • "autoscale-slave"

sn

字符串

每个设备的唯一值。

虚拟域 (VDOM)

列表 / 元素=字典

虚拟域。

注释

字符串

注释。

元数据字段

别名:meta fields

字典

元数据字段。

name

字符串

名称。

操作模式

字符串

操作模式。

选项

  • "nat"

  • "transparent"

路由表管理配置文件ID

整数

路由表管理配置文件ID。

status

字符串

状态。

虚拟域类型

字符串

虚拟域类型。

选项

  • "traffic"

  • "admin"

VPN ID

整数

VPN ID。

版本

整数

版本。

虚拟机CPU

整数

虚拟机CPU。

虚拟机CPU限制

整数

虚拟机CPU限制。

虚拟机许可证过期时间

整数

虚拟机许可证过期时间。

虚拟机许可证逾期时间

整数

虚拟机许可证逾期时间。

虚拟机内存

整数

虚拟机内存。

虚拟机内存限制

整数

虚拟机内存限制。

虚拟机按需付费状态

整数

虚拟机按需付费状态。

虚拟机状态

任意

(整数或字符串) 虚拟机状态。

启用日志

布尔值

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

选项

  • false ← (默认)

  • true

FortiCloud访问令牌

字符串

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

建议的方法

字符串

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

选项

  • "update"

  • "set"

  • "add"

失败的RC代码

列表 / 元素=整数

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

成功的RC代码

列表 / 元素=整数

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

工作区锁定ADOM

字符串

在工作区模式下运行FortiManager时要锁定的ADOM,值可以是global和其他包括root。

工作区锁定超时

整数

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

默认值: 300

备注

注意

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

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

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

示例

- name: Delete first FOS devices from FMG In a specific adom
  hosts: fortimanagers
  gather_facts: false
  connection: httpapi
  vars:
    ansible_httpapi_use_ssl: true
    ansible_httpapi_validate_certs: false
    ansible_httpapi_port: 443
    device_adom: "root"
  tasks:
    - name: Fetch all devices
      fortinet.fortimanager.fmgr_fact:
        facts:
          selector: "dvmdb_device"
          params:
            adom: "{{ device_adom }}"
            device: "your_value"
      register: alldevices
    - name: No name
      when: alldevices.meta.response_data != []
      ansible.builtin.debug:
        msg:
          - "We are going to delete device: {{ alldevices.meta.response_data[0].name }}"
          - "IP of the device is: {{ alldevices.meta.response_data[0].ip }}"
    - name: Create The Task To Delete The Device
      when: alldevices.meta.response_data != [] and False
      fortinet.fortimanager.fmgr_dvm_cmd_del_device:
        dvm_cmd_del_device:
          device: "{{ alldevices.meta.response_data[0].name }}"
          adom: "{{ device_adom }}"
          flags:
            - "create_task"
            - "nonblocking"
      register: uninstalling_task
    - name: Poll the task
      when: alldevices.meta.response_data != [] and False
      fortinet.fortimanager.fmgr_fact:
        facts:
          selector: "task_task"
          params:
            task: "{{ uninstalling_task.meta.response_data.taskid }}"
      register: taskinfo
      until: taskinfo.meta.response_data.percent == 100
      retries: 30
      delay: 5
      failed_when: taskinfo.meta.response_data.state == 'error'

返回值

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

描述

元数据

字典

请求的结果。

返回值:始终

请求URL

字符串

请求的完整URL。

返回值:始终

示例: "/sys/login/user"

响应代码

整数

API请求的状态。

返回值:始终

示例: 0

响应数据

列表 / 元素=字符串

API响应。

返回值:始终

响应消息

字符串

API响应的描述性消息。

返回值:始终

示例: "OK."

系统信息

字典

目标系统的信息。

返回值:始终

RC代码

整数

请求的状态。

返回值:始终

示例: 0

版本检查警告

列表 / 元素=字符串

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

返回值:复杂类型

作者

  • 杜欣伟 (@dux-fortinet)

  • 李星 (@lix-fortinet)

  • 薛杰 (@JieX19)

  • 郑琳 (@chillancezen)

  • 沈峰 (@fshen01)

  • 陆宏斌 (@fgtdev-hblu)