check_point.mgmt.cp_mgmt_hosts 模块 – 管理 HOSTS 资源模块

注意

此模块是 check_point.mgmt 集合(版本 6.2.1)的一部分。

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

要安装它,请使用:ansible-galaxy collection install check_point.mgmt

要在剧本中使用它,请指定:check_point.mgmt.cp_mgmt_hosts

check_point.mgmt 5.0.0 中的新增功能

概要

  • 此资源模块允许添加、删除或修改 CP MGMT 主机。

  • 此资源模块还负责收集主机配置信息

注意

此模块具有相应的 action 插件

参数

参数

注释

config

字典

HOSTS 选项的字典

auto_publish_session

布尔值

如果在任务完成后执行了更改,则发布当前会话。

选项

  • false

  • true

color

字符串

对象的颜色。应为现有颜色之一。

选项

  • "海蓝宝石"

  • "黑色"

  • "蓝色"

  • "克里特 蓝色"

  • "浅黄褐色"

  • "青色"

  • "深 绿色"

  • "卡其色"

  • "兰花色"

  • "深 橙色"

  • "深 绿色"

  • "粉红色"

  • "绿松石色"

  • "深 蓝色"

  • "耐火砖色"

  • "棕色"

  • "森林 绿色"

  • "金色"

  • "深 金色"

  • "灰色"

  • "深 灰色"

  • "浅 绿色"

  • "柠檬 雪纺"

  • "珊瑚色"

  • "海 绿色"

  • "天 蓝色"

  • "洋红色"

  • "紫色"

  • "板岩 蓝色"

  • "紫罗兰 红色"

  • "海军 蓝色"

  • "橄榄色"

  • "橙色"

  • "红色"

  • "赭色"

  • "黄色"

comments

字符串

注释字符串。

details_level

字符串

响应中某些字段的详细程度可能会有所不同,从仅显示对象的 UID 值到对象的完整详细表示。

选项

  • "uid"

  • "标准"

  • "完整"

groups

列表 / 元素=字符串

组标识符的集合。

host_servers

字典

服务器配置。

dns_server

布尔值

如果此服务器是 DNS 服务器,则获取 True。

选项

  • false

  • true

mail_server

布尔值

如果此服务器是邮件服务器,则获取 True。

选项

  • false

  • true

web_server

布尔值

如果此服务器是 Web 服务器,则获取 True。

选项

  • false

  • true

web_server_config

字典

Web 服务器配置。

additional_ports

列表 / 元素=字符串

服务器附加端口。

application_engines

列表 / 元素=字符串

此 Web 服务器的应用程序引擎。

listen_standard_port

布尔值

服务器是否侦听标准端口。

选项

  • false

  • true

operating_system

字符串

操作系统。

选项

  • "sparc linux"

  • "windows"

  • "其他"

  • "x86 linux"

  • "sparc solaris"

protected_by

字符串

通过名称或 UID 标识的保护此服务器的网络对象。

ignore_errors

布尔值

应用更改时忽略错误。您将无法发布此类更改。如果忽略了 ignore-warnings 标志,则也会忽略警告。

选项

  • false

  • true

ignore_warnings

布尔值

应用更改时忽略警告。

选项

  • false

  • true

interfaces

列表 / 元素=字典

主机接口。

color

字符串

对象的颜色。应为现有颜色之一。

选项

  • "海蓝宝石"

  • "黑色"

  • "蓝色"

  • "克里特 蓝色"

  • "浅黄褐色"

  • "青色"

  • "深 绿色"

  • "卡其色"

  • "兰花色"

  • "深 橙色"

  • "深 绿色"

  • "粉红色"

  • "绿松石色"

  • "深 蓝色"

  • "耐火砖色"

  • "棕色"

  • "森林 绿色"

  • "金色"

  • "深 金色"

  • "灰色"

  • "深 灰色"

  • "浅 绿色"

  • "柠檬 雪纺"

  • "珊瑚色"

  • "海 绿色"

  • "天 蓝色"

  • "洋红色"

  • "紫色"

  • "板岩 蓝色"

  • "紫罗兰 红色"

  • "海军 蓝色"

  • "橄榄色"

  • "橙色"

  • "红色"

  • "赭色"

  • "黄色"

comments

字符串

注释字符串。

details_level

字符串

响应中某些字段的详细程度可能会有所不同,从仅显示对象的 UID 值到对象的完整详细表示。

选项

  • "uid"

  • "标准"

  • "完整"

ignore_errors

布尔值

应用更改时忽略错误。您将无法发布此类更改。

如果忽略了 ignore-warnings 标志,则也会忽略警告。

选项

  • false

  • true

ignore_warnings

布尔值

应用更改时忽略警告。

选项

  • false

  • true

mask_length

整数

IPv4 或 IPv6 网络掩码长度。如果需要两个掩码,请显式使用 mask-length4 和 mask-length6 字段。

除了 IPv4 掩码长度外,还可以在 subnet-mask 字段中指定 IPv4 掩码本身。

mask_length4

整数

IPv4 网络掩码长度。

mask_length6

整数

IPv6 网络掩码长度。

name

字符串

接口名称。

subnet

字符串

IPv4 或 IPv6 网络地址。

如果需要两个地址,请显式使用 subnet4 和 subnet6 字段。

subnet4

字符串

IPv4 网络地址。

subnet6

字符串

IPv6 网络地址。

subnet_mask

字符串

IPv4 网络掩码。

ip_address

字符串

IPv4 或 IPv6 地址。如果需要两个地址,请显式使用 ipv4-address 和 ipv6-address 字段。

ipv4_address

字符串

IPv4 地址。

ipv6_address

字符串

IPv4 地址。

限制

整数

返回结果的最大数量。

注意,此参数仅对 GATHERED 状态有效,对于 MERGED、REPLACED 和 DELETED 等配置状态不适用。

name

字符串

对象名称。在域中必须唯一。

nat_settings

字典

NAT 设置。

auto_rule

布尔值

是否添加自动地址转换规则。

选项

  • false

  • true

hide_behind

字符串

隐藏在后面的方法。如果“method”参数为“static”,则不需要此参数。

选项

  • "网关"

  • "ip-address"

install_on

字符串

哪个网关应应用 NAT 转换。

ip_address

字符串

IPv4 或 IPv6 地址。如果需要两个地址,请显式使用 ipv4-address 和 ipv6-address 字段。

如果“method”参数为“hide”并且“hide-behind”参数为“gateway”,则不需要此参数。

ipv4_address

字符串

IPv4 地址。

ipv6_address

字符串

IPv6 地址。

method

字符串

NAT 转换方法。

选项

  • "隐藏"

  • "静态"

偏移量

整数

初始跳过的结果数量。

注意,此参数仅对 GATHERED 状态有效,对于 MERGED、REPLACED 和 DELETED 等配置状态不适用。

排序

列表 / 元素=字典

按给定字段对结果进行排序。默认情况下,结果按名称升序排序。此参数仅在获取少量对象时相关。

注意,此参数仅对 GATHERED 状态有效,对于 MERGED、REPLACED 和 DELETED 等配置状态不适用。

升序

字符串

按给定字段升序排序结果。

降序

字符串

按给定字段降序排序结果。

往返

布尔值

如果设置为 True,往返将从响应参数中过滤掉模块参数,这将使用户能够使用结构化的收集数据触发配置请求。

注意,此参数仅与“已收集”状态相关,因为对于诸如“已合并”、“已替换”和“已删除”之类的配置状态,它不会进行任何配置更新,因为它不是模块配置参数。

选项

  • false

  • true

标签

列表 / 元素=字符串

标签标识符的集合。

版本

字符串

检查点的版本。如果未给出,则取最新版本。

状态

字符串

配置应保留的状态

已收集状态将从设备获取模块 API 配置,并按照模块 argspec 的格式将其转换为结构化数据,该值将在结果中的 gathered 键中返回。

选项

  • "已合并"

  • "已替换"

  • "已收集"

  • "已删除"

示例

# Using MERGED state
# -------------------

- name: Merge MGMT Hosts config
  cp_mgmt_hosts:
    state: merged
    config:
      color: cyan
      ip_address: 192.0.2.1
      name: New Host 1
      auto_publish_session: true
      tags:
        - New Host
      round_trip: true

# RUN output:
# -----------

# mgmt_hosts:
#   after:
#     color: cyan
#     comments: ''
#     groups: []
#     icon: Objects/host
#     interfaces: []
#     ipv4-address: 192.0.2.1
#     name: New Host 1
#     nat_settings: {}
#     tags:
#     - New Host
#   before: {}

# Using REPLACED state
# --------------------

- name: Replace MGMT Host config
  cp_mgmt_hosts:
    state: replaced
    config:
      name: New Host 1
      tags:
        - New Replaced Host
      color: aquamarine
      ip_address: 198.51.110.0
      comments: REPLACED description
      ignore_warnings: true
      ignore_errors: false
      auto_publish_session: true
      round_trip: true

# RUN output:
# -----------

# mgmt_hosts:
#   after:
#     color: aquamarine
#     comments: REPLACED description
#     groups: []
#     icon: Objects/host
#     interfaces: []
#     ipv4-address: 198.51.110.0
#     name: New Host 1
#     nat_settings: {}
#     tags:
#     - New Replaced Host
#   before:
#     color: cyan
#     comments: ''
#     groups: []
#     icon: Objects/host
#     interfaces: []
#     ipv4-address: 192.0.2.1
#     name: New Host 1
#     nat_settings: {}
#     tags:
#     - New Host

# Using GATHERED state
# --------------------

# 1. With Round Trip set to True

- name: Gather MGMT Host config by Name
  cp_mgmt_hosts:
    state: gathered
    config:
      name: New Host 1

# RUN output:
# -----------

# gathered:
#   color: cyan
#   comments: REPLACED description
#   domain: SMC User
#   groups: []
#   icon: Objects/host
#   interfaces: []
#   ipv4-address: 192.0.2.1
#   name: New Host 1
#   nat_settings: {}
#   read-only: false
#   tags:
#   - New Host
#   uid: 63b868bb-d300-47f4-b97a-c465a56fe9c7

# 2. With Round Trip set to False which is the default behaviour

- name: Gather MGMT Host config by Name
  cp_mgmt_hosts:
    state: gathered
    config:
      name: New Host 1

# RUN output:
# -----------

# gathered:
#   color: cyan
#   comments: ''
#   domain:
#     domain-type: domain
#     name: SMC User
#     uid: 41e821a0-3720-11e3-aa6e-0800200c9fde
#   groups: []
#   icon: Objects/host
#   interfaces: []
#   ipv4-address: 192.0.2.1
#   meta-info:
#     creation-time:
#       iso-8601: 2022-11-21T08:31+0000
#       posix: 1669019480328
#     creator: admin
#     last-modifier: admin
#     last-modify-time:
#       iso-8601: 2022-11-21T08:31+0000
#       posix: 1669019480328
#     lock: unlocked
#     validation-state: ok
#   name: New Host 1
#   nat_settings: {}
#   read-only: false
#   tags:
#   - domain:
#       domain-type: domain
#       name: SMC User
#       uid: 41e821a0-3720-11e3-aa6e-0800200c9fde
#     name: New Host
#     type: tag
#     uid: 94d53896-3cee-4e1f-a83b-3abac80bf512
#   type: host
#   uid: 8f23a44b-d9d2-4242-8a9e-2a4cbb6723ff

# 3. Gather ALL threat-layer config with DESC order filter

- name: Gather All hosts on the MGMT instance
  cp_mgmt_hosts:
    config:
      details_level: full
    state: gathered

# RUN output:
# -----------

# gathered:
#   - domain:
#       domain-type: domain
#       name: SMC User
#       uid: 41e821a0-3720-11e3-aa6e-0800200c9fde
#     ipv4-address: 192.0.2.1
#     name: New Host 1
#     type: host
#     uid: 8f23a44b-d9d2-4242-8a9e-2a4cbb6723ff

# Using DELETED state
# -------------------

- name: Delete MGMT Host config by Name
  cp_mgmt_hosts:
    state: deleted
    config:
      name: New Host 1
      round_trip: true

# RUN output:
# -----------

# mgmt_hosts:
#   after: {}
#   before:
#     color: cyan
#     comments: REPLACED description
#     groups: []
#     icon: Objects/host
#     interfaces: []
#     ipv4-address: 192.0.2.1
#     name: New Host 1
#     nat_settings: {}
#     tags:
#     - New Host

返回值

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

描述

之后

字典

模块执行后的结果配置。

返回:当发生更改时

示例: “此 输出 始终 模块 argspec 的格式相同。\n”

之前

字典

模块执行之前的配置。

返回:当状态为 已合并已替换已删除

示例: “此 输出 始终 模块 argspec 的格式相同。\n”

已收集

字典

从远程设备收集的关于网络资源的结构化数据。

返回:当状态为 已收集

示例: “此 输出 始终 模块 argspec 的格式相同。\n”

作者