| 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_export_management |
| 31 |
short_description: Export 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 |
- Export 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. |
| 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 in which the exported database file is saved.<br><font color="red">Required only</font> when not using pre-export-verification-only flag. |
| 44 |
type: str |
| 45 |
domain_name: |
| 46 |
description: |
| 47 |
- Domain name to be exported.<br><font color="red">Required only for</font> exporting a Domain from the Multi-Domain Server or backing up Domain. |
| 48 |
type: str |
| 49 |
target_version: |
| 50 |
description: |
| 51 |
- Target version. |
| 52 |
type: str |
| 53 |
include_logs: |
| 54 |
description: |
| 55 |
- Export logs without log indexes. |
| 56 |
type: bool |
| 57 |
include_logs_indexes: |
| 58 |
description: |
| 59 |
- Export logs with log indexes. |
| 60 |
type: bool |
| 61 |
include_endpoint_configuration: |
| 62 |
description: |
| 63 |
- Include export of the Endpoint Security Management configuration files. |
| 64 |
type: bool |
| 65 |
include_endpoint_database: |
| 66 |
description: |
| 67 |
- Include export of the Endpoint Security Management database. |
| 68 |
type: bool |
| 69 |
is_domain_backup: |
| 70 |
description: |
| 71 |
- If true, the exported Domain will be suitable for import on the same Multi-Domain Server only. |
| 72 |
type: bool |
| 73 |
is_smc_to_mds: |
| 74 |
description: |
| 75 |
- If true, the exported Security Management Server will be suitable for import on the Multi-Domain Server only. |
| 76 |
type: bool |
| 77 |
pre_export_verification_only: |
| 78 |
description: |
| 79 |
- If true, only runs the pre-export verifications instead of the full export. |
| 80 |
type: bool |
| 81 |
ignore_warnings: |
| 82 |
description: |
| 83 |
- Ignoring the verification warnings. By Setting this parameter to 'true' export will not be blocked by warnings. |
| 84 |
type: bool |
| 85 |
extends_documentation_fragment: check_point.mgmt.checkpoint_commands |
| 86 |
""" |
| 87 |
|
| 88 |
EXAMPLES = """ |
| 89 |
- name: export-management |
| 90 |
cp_mgmt_export_management: |
| 91 |
domain_name: domain1 |
| 92 |
file_path: /var/log/domain1_backup.tgz |
| 93 |
is_domain_backup: true |
| 94 |
""" |
| 95 |
|
| 96 |
RETURN = """ |
| 97 |
cp_mgmt_export_management: |
| 98 |
description: The checkpoint export-management output. |
| 99 |
returned: always. |
| 100 |
type: dict |
| 101 |
""" |
| 102 |
|
| 103 |
from ansible.module_utils.basic import AnsibleModule |
| 104 |
from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command |
| 105 |
|
| 106 |
|
| 107 |
def main(): |
| 108 |
argument_spec = dict( |
| 109 |
file_path=dict(type='str'), |
| 110 |
domain_name=dict(type='str',), |
| 111 |
target_version=dict(type='str'), |
| 112 |
include_logs=dict(type='bool'), |
| 113 |
include_logs_indexes=dict(type='bool'), |
| 114 |
include_endpoint_configuration=dict(type='bool'), |
| 115 |
include_endpoint_database=dict(type='bool'), |
| 116 |
is_domain_backup=dict(type='bool'), |
| 117 |
is_smc_to_mds=dict(type='bool'), |
| 118 |
pre_export_verification_only=dict(type='bool'), |
| 119 |
ignore_warnings=dict(type='bool') |
| 120 |
) |
| 121 |
argument_spec.update(checkpoint_argument_spec_for_commands) |
| 122 |
|
| 123 |
module = AnsibleModule(argument_spec=argument_spec) |
| 124 |
|
| 125 |
command = "export-management" |
| 126 |
|
| 127 |
result = api_command(module, command) |
| 128 |
module.exit_json(**result) |
| 129 |
|
| 130 |
|
| 131 |
if __name__ == '__main__': |
| 132 |
main() |