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 插件。
参数
参数 |
注释 |
---|---|
HOSTS 选项的字典 |
|
如果在任务完成后执行了更改,则发布当前会话。 选项
|
|
对象的颜色。应为现有颜色之一。 选项
|
|
注释字符串。 |
|
响应中某些字段的详细程度可能会有所不同,从仅显示对象的 UID 值到对象的完整详细表示。 选项
|
|
组标识符的集合。 |
|
服务器配置。 |
|
如果此服务器是 DNS 服务器,则获取 True。 选项
|
|
如果此服务器是邮件服务器,则获取 True。 选项
|
|
如果此服务器是 Web 服务器,则获取 True。 选项
|
|
Web 服务器配置。 |
|
服务器附加端口。 |
|
此 Web 服务器的应用程序引擎。 |
|
服务器是否侦听标准端口。 选项
|
|
操作系统。 选项
|
|
通过名称或 UID 标识的保护此服务器的网络对象。 |
|
应用更改时忽略错误。您将无法发布此类更改。如果忽略了 ignore-warnings 标志,则也会忽略警告。 选项
|
|
应用更改时忽略警告。 选项
|
|
主机接口。 |
|
对象的颜色。应为现有颜色之一。 选项
|
|
注释字符串。 |
|
响应中某些字段的详细程度可能会有所不同,从仅显示对象的 UID 值到对象的完整详细表示。 选项
|
|
应用更改时忽略错误。您将无法发布此类更改。 如果忽略了 ignore-warnings 标志,则也会忽略警告。 选项
|
|
应用更改时忽略警告。 选项
|
|
IPv4 或 IPv6 网络掩码长度。如果需要两个掩码,请显式使用 mask-length4 和 mask-length6 字段。 除了 IPv4 掩码长度外,还可以在 subnet-mask 字段中指定 IPv4 掩码本身。 |
|
IPv4 网络掩码长度。 |
|
IPv6 网络掩码长度。 |
|
接口名称。 |
|
IPv4 或 IPv6 网络地址。 如果需要两个地址,请显式使用 subnet4 和 subnet6 字段。 |
|
IPv4 网络地址。 |
|
IPv6 网络地址。 |
|
IPv4 网络掩码。 |
|
IPv4 或 IPv6 地址。如果需要两个地址,请显式使用 ipv4-address 和 ipv6-address 字段。 |
|
IPv4 地址。 |
|
IPv4 地址。 |
|
返回结果的最大数量。 注意,此参数仅对 GATHERED 状态有效,对于 MERGED、REPLACED 和 DELETED 等配置状态不适用。 |
|
对象名称。在域中必须唯一。 |
|
NAT 设置。 |
|
是否添加自动地址转换规则。 选项
|
|
隐藏在后面的方法。如果“method”参数为“static”,则不需要此参数。 选项
|
|
哪个网关应应用 NAT 转换。 |
|
IPv4 或 IPv6 地址。如果需要两个地址,请显式使用 ipv4-address 和 ipv6-address 字段。 如果“method”参数为“hide”并且“hide-behind”参数为“gateway”,则不需要此参数。 |
|
IPv4 地址。 |
|
IPv6 地址。 |
|
NAT 转换方法。 选项
|
|
初始跳过的结果数量。 注意,此参数仅对 GATHERED 状态有效,对于 MERGED、REPLACED 和 DELETED 等配置状态不适用。 |
|
按给定字段对结果进行排序。默认情况下,结果按名称升序排序。此参数仅在获取少量对象时相关。 注意,此参数仅对 GATHERED 状态有效,对于 MERGED、REPLACED 和 DELETED 等配置状态不适用。 |
|
按给定字段升序排序结果。 |
|
按给定字段降序排序结果。 |
|
如果设置为 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
返回值
常见的返回值记录在此处,以下是此模块特有的字段
键 |
描述 |
---|---|
模块执行后的结果配置。 返回:当发生更改时 示例: |
|
模块执行之前的配置。 返回:当状态为 已合并、已替换、已删除时 示例: |
|
从远程设备收集的关于网络资源的结构化数据。 返回:当状态为 已收集时 示例: |