| 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 = { |
| 25 |
"metadata_version": "1.1", |
| 26 |
"status": ["preview"], |
| 27 |
"supported_by": "community", |
| 28 |
} |
| 29 |
|
| 30 |
DOCUMENTATION = """ |
| 31 |
--- |
| 32 |
module: cp_mgmt_uninstall_software_package |
| 33 |
short_description: Uninstalls the software package from target machines. |
| 34 |
description: |
| 35 |
- Uninstalls the software package from target machines. |
| 36 |
- All operations are performed over Web Services API. |
| 37 |
- Available from R80.40 management version. |
| 38 |
version_added: "2.0.0" |
| 39 |
author: "Or Soffer (@chkp-orso)" |
| 40 |
options: |
| 41 |
name: |
| 42 |
description: |
| 43 |
- The name of the software package. |
| 44 |
type: str |
| 45 |
targets: |
| 46 |
description: |
| 47 |
- On what targets to execute this command. Targets may be identified by their name, or object unique identifier. |
| 48 |
type: list |
| 49 |
elements: str |
| 50 |
cluster_installation_settings: |
| 51 |
description: |
| 52 |
- Installation settings for cluster. |
| 53 |
type: dict |
| 54 |
suboptions: |
| 55 |
cluster_delay: |
| 56 |
description: |
| 57 |
- The delay between end of installation on one cluster members and start of installation on the next cluster member. |
| 58 |
type: int |
| 59 |
cluster_strategy: |
| 60 |
description: |
| 61 |
- The cluster installation strategy. |
| 62 |
type: str |
| 63 |
concurrency_limit: |
| 64 |
description: |
| 65 |
- The number of targets, on which the same package is installed at the same time. |
| 66 |
type: int |
| 67 |
extends_documentation_fragment: check_point.mgmt.checkpoint_commands |
| 68 |
""" |
| 69 |
|
| 70 |
EXAMPLES = """ |
| 71 |
- name: uninstall-software-package |
| 72 |
cp_mgmt_uninstall_software_package: |
| 73 |
name: Check_Point_R80_40_JHF_MCD_DEMO_019_MAIN_Bundle_T1_VISIBLE_FULL.tgz |
| 74 |
targets.1: corporate-gateway |
| 75 |
""" |
| 76 |
|
| 77 |
RETURN = """ |
| 78 |
cp_mgmt_uninstall_software_package: |
| 79 |
description: The checkpoint uninstall-software-package output. |
| 80 |
returned: always. |
| 81 |
type: dict |
| 82 |
""" |
| 83 |
|
| 84 |
from ansible.module_utils.basic import AnsibleModule |
| 85 |
from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( |
| 86 |
checkpoint_argument_spec_for_commands, |
| 87 |
api_command, |
| 88 |
) |
| 89 |
|
| 90 |
|
| 91 |
def main(): |
| 92 |
argument_spec = dict( |
| 93 |
name=dict(type="str"), |
| 94 |
targets=dict(type="list", elements="str"), |
| 95 |
cluster_installation_settings=dict( |
| 96 |
type="dict", |
| 97 |
options=dict( |
| 98 |
cluster_delay=dict(type="int"), |
| 99 |
cluster_strategy=dict(type="str"), |
| 100 |
), |
| 101 |
), |
| 102 |
concurrency_limit=dict(type="int"), |
| 103 |
) |
| 104 |
argument_spec.update(checkpoint_argument_spec_for_commands) |
| 105 |
|
| 106 |
module = AnsibleModule(argument_spec=argument_spec) |
| 107 |
|
| 108 |
command = "uninstall-software-package" |
| 109 |
|
| 110 |
result = api_command(module, command) |
| 111 |
module.exit_json(**result) |
| 112 |
|
| 113 |
|
| 114 |
if __name__ == "__main__": |
| 115 |
main() |