check_point / check_point.mgmt / 5.2.2 / module / cp_mgmt_hosts Manages HOSTS resource module | "added in version" 5.0.0 of check_point.mgmt" Authors: Ansible Security Automation Team (@justjais) <https://github.com/ansible-security>- This plugin has a corresponding action plugin.check_point.mgmt.cp_mgmt_hosts (5.2.2) — module
Install with ansible-galaxy collection install check_point.mgmt:==5.2.2
collections: - name: check_point.mgmt version: 5.2.2
This resource module allows for addition, deletion, or modification of CP MGMT Hosts.
This resource module also takes care of gathering Hosts config facts
# 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
state: choices: - merged - replaced - gathered - deleted description: - The state the configuration should be left in - The state I(gathered) will get the module API configuration from the device and transform it into structured data in the format as per the module argspec and the value is returned in the I(gathered) key within the result. type: str config: description: A dictionary of HOSTS options suboptions: auto_publish_session: description: - Publish the current session if changes have been performed after task completes. type: bool color: choices: - aquamarine - black - blue - crete blue - burlywood - cyan - dark green - khaki - orchid - dark orange - dark sea green - pink - turquoise - dark blue - firebrick - brown - forest green - gold - dark gold - gray - dark gray - light green - lemon chiffon - coral - sea green - sky blue - magenta - purple - slate blue - violet red - navy blue - olive - orange - red - sienna - yellow description: Color of the object. Should be one of existing colors. type: str comments: description: Comments string. type: str details_level: choices: - uid - standard - full description: The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed representation of the object. type: str groups: description: Collection of group identifiers. elements: str type: list host_servers: description: Servers Configuration. suboptions: dns_server: description: Gets True if this server is a DNS Server. type: bool mail_server: description: Gets True if this server is a Mail Server. type: bool web_server: description: Gets True if this server is a Web Server. type: bool web_server_config: description: Web Server configuration. suboptions: additional_ports: description: - Server additional ports. elements: str type: list application_engines: description: - Application engines of this web server. elements: str type: list listen_standard_port: description: - Whether server listens to standard port. type: bool operating_system: choices: - sparc linux - windows - other - x86 linux - sparc solaris description: - Operating System. type: str protected_by: description: - Network object which protects this server identified by the name or UID. type: str type: dict type: dict ignore_errors: description: Apply changes ignoring errors. You won't be able to publish such a changes. If ignore-warnings flag was omitted - warnings will also be ignored. type: bool ignore_warnings: description: Apply changes ignoring warnings. type: bool interfaces: description: Host interfaces. elements: dict suboptions: color: choices: - aquamarine - black - blue - crete blue - burlywood - cyan - dark green - khaki - orchid - dark orange - dark sea green - pink - turquoise - dark blue - firebrick - brown - forest green - gold - dark gold - gray - dark gray - light green - lemon chiffon - coral - sea green - sky blue - magenta - purple - slate blue - violet red - navy blue - olive - orange - red - sienna - yellow description: - Color of the object. Should be one of existing colors. type: str comments: description: - Comments string. type: str details_level: choices: - uid - standard - full description: - The level of detail for some of the fields in the response can vary from showing only the UID value of the object to a fully detailed representation of the object. type: str ignore_errors: description: - Apply changes ignoring errors. You won't be able to publish such a changes. - If ignore-warnings flag was omitted - warnings will also be ignored. type: bool ignore_warnings: description: - Apply changes ignoring warnings. type: bool mask_length: description: - IPv4 or IPv6 network mask length. If both masks are required use mask-length4 and mask-length6 fields explicitly. - Instead of IPv4 mask length it is possible to specify IPv4 mask itself in subnet-mask field. type: int mask_length4: description: - IPv4 network mask length. type: int mask_length6: description: - IPv6 network mask length. type: int name: description: - Interface name. type: str subnet: description: - IPv4 or IPv6 network address. - If both addresses are required use subnet4 and subnet6 fields explicitly. type: str subnet4: description: - IPv4 network address. type: str subnet6: description: - IPv6 network address. type: str subnet_mask: description: - IPv4 network mask. type: str type: list ip_address: description: IPv4 or IPv6 address. If both addresses are required use ipv4-address and ipv6-address fields explicitly. type: str ipv4_address: description: IPv4 address. type: str ipv6_address: description: IPv4 address. type: str limit: description: - The maximal number of returned results. - NOTE, this parameter is a valid parameter only for the GATHERED state, for config states like, MERGED, REPLACED, and DELETED state it won't be applicable. type: int name: description: Object name. Must be unique in the domain. type: str nat_settings: description: NAT settings. suboptions: auto_rule: description: - Whether to add automatic address translation rules. type: bool hide_behind: choices: - gateway - ip-address description: - Hide behind method. This parameter is not required in case "method" parameter is "static". type: str install_on: description: - Which gateway should apply the NAT translation. type: str ip_address: description: - IPv4 or IPv6 address. If both addresses are required use ipv4-address and ipv6-address fields explicitly. - This parameter is not required in case "method" parameter is "hide" and "hide-behind" parameter is "gateway". type: str ipv4_address: description: - IPv4 address. type: str ipv6_address: description: - IPv6 address. type: str method: choices: - hide - static description: - NAT translation method. type: str type: dict offset: description: - Number of the results to initially skip. - NOTE, this parameter is a valid parameter only for the GATHERED state, for config states like, MERGED, REPLACED, and DELETED state it won't be applicable. type: int order: description: - Sorts results by the given field. By default the results are sorted in the ascending order by name. This parameter is relevant only for getting few objects. - NOTE, this parameter is a valid parameter only for the GATHERED state, for config states like, MERGED, REPLACED, and DELETED state it won't be applicable. elements: dict suboptions: ASC: description: - Sorts results by the given field in ascending order. type: str DESC: description: - Sorts results by the given field in descending order. type: str type: list round_trip: description: - If set to True, the round trip will filter out the module parameters from the response param, which will enable the user to fire the config request using the structured gathered data. - NOTE, this parameter makes relevance only with the GATHERED state, as for config states like, MERGED, REPLACED, and DELETED state it won't make any config updates, as it's not a module config parameter. type: bool tags: description: Collection of tag identifiers. elements: str type: list version: description: - Version of checkpoint. If not given one, the latest version taken. type: str type: dict
after: description: The resulting configuration after module execution. returned: when changed sample: 'This output will always be in the same format as the module argspec. ' type: dict before: description: The configuration prior to the module execution. returned: when state is I(merged), I(replaced), I(deleted) sample: 'This output will always be in the same format as the module argspec. ' type: dict gathered: description: Facts about the network resource gathered from the remote device as structured data. returned: when state is I(gathered) sample: 'This output will always be in the same format as the module argspec. ' type: dict