Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_import_management.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3 #
4 # Ansible module to manage CheckPoint Firewall (c) 2019
5 #
6 # Ansible is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
10 #
11 # Ansible is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
18 #
19
20 from __future__ import (absolute_import, division, print_function)
21
22 __metaclass__ = type
23
24 ANSIBLE_METADATA = {'metadata_version': '1.1',
25 'status': ['preview'],
26 'supported_by': 'community'}
27
28 DOCUMENTATION = """
29 ---
30 module: cp_mgmt_import_management
31 short_description: Import the primary Security Management Server database or the primary Multi-Domain Server database or the single Domain database and the
32 applicable Check Point configuration.
33 description:
34 - Import the primary Security Management Server database or the primary Multi-Domain Server database or the single Domain database and the applicable
35 Check Point configuration. <br/>After the import starts, the session expires and you must login again.
36 - All operations are performed over Web Services API.
37 - Available from R81.10 management version.
38 version_added: "5.0.0"
39 author: "Eden Brillant (@chkp-edenbr)"
40 options:
41 file_path:
42 description:
43 - Path to the exported database file to be imported.
44 type: str
45 required: True
46 domain_name:
47 description:
48 - Domain name to be imported. Must be unique in the Multi-Domain Server.<br><font color="red">Required only for</font> importing the Security
49 Management Server into the Multi-Domain Server.
50 type: str
51 domain_ip_address:
52 description:
53 - IPv4 address for the imported Domain.<br><font color="red">Required only for</font> importing the Security Management Server into the
54 Multi-Domain Server.
55 type: str
56 domain_server_name:
57 description:
58 - Multi-Domain Server name for the imported Domain.<br><font color="red">Required only for</font> importing the Security Management Server into
59 the Multi-Domain Server.
60 type: str
61 include_logs:
62 description:
63 - Import logs without log indexes.
64 type: bool
65 include_logs_indexes:
66 description:
67 - Import logs with log indexes.
68 type: bool
69 keep_cloud_sharing:
70 description:
71 - Preserve the connection of the Management Server to Check Point's Infinity Portal.<br>Use this flag after ensuring that the original
72 Management Server does not communicate with Infinity Portal.<br>Note, resuming the connection is also possible after import with set-cloud-services.
73 - Available from R81.20 management version.
74 type: bool
75 include_endpoint_configuration:
76 description:
77 - Include import of the Endpoint Security Management configuration files.
78 type: bool
79 include_endpoint_database:
80 description:
81 - Include import of the Endpoint Security Management database.
82 type: bool
83 verify_domain_restore:
84 description:
85 - If true, verify that the restore operation is valid for this input file and this environment. <br>Note, Restore operation will not be executed.
86 type: bool
87 pre_import_verification_only:
88 description:
89 - If true, only runs the pre-import verifications instead of the full import.
90 type: bool
91 ignore_warnings:
92 description:
93 - Ignoring the verification warnings. By Setting this parameter to 'true' import will not be blocked by warnings.
94 type: bool
95 extends_documentation_fragment: check_point.mgmt.checkpoint_commands
96 """
97
98 EXAMPLES = """
99 - name: import-management
100 cp_mgmt_import_management:
101 file_path: /var/log/domain1_exported.tgz
102 """
103
104 RETURN = """
105 cp_mgmt_import_management:
106 description: The checkpoint import-management output.
107 returned: always.
108 type: dict
109 """
110
111 from ansible.module_utils.basic import AnsibleModule
112 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command
113
114
115 def main():
116 argument_spec = dict(
117 file_path=dict(type='str', required=True),
118 domain_name=dict(type='str'),
119 domain_ip_address=dict(type='str'),
120 domain_server_name=dict(type='str'),
121 include_logs=dict(type='bool'),
122 include_logs_indexes=dict(type='bool'),
123 keep_cloud_sharing=dict(type='bool'),
124 include_endpoint_configuration=dict(type='bool'),
125 include_endpoint_database=dict(type='bool'),
126 verify_domain_restore=dict(type='bool'),
127 pre_import_verification_only=dict(type='bool'),
128 ignore_warnings=dict(type='bool')
129 )
130 argument_spec.update(checkpoint_argument_spec_for_commands)
131
132 module = AnsibleModule(argument_spec=argument_spec)
133
134 command = "import-management"
135
136 result = api_command(module, command)
137 module.exit_json(**result)
138
139
140 if __name__ == '__main__':
141 main()