| 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_add_updatable_object |
| 31 |
short_description: Import an updatable object from the repository to the management server. |
| 32 |
description: |
| 33 |
- Import an updatable object from the repository to the management server. This operation takes effect immediately and doesn't require publishing. |
| 34 |
- All operations are performed over Web Services API. |
| 35 |
- Available from R80.20 management version. |
| 36 |
version_added: "5.0.0" |
| 37 |
author: "Eden Brillant (@chkp-edenbr)" |
| 38 |
options: |
| 39 |
uri: |
| 40 |
description: |
| 41 |
- URI of the updatable object in the Updatable Objects Repository. |
| 42 |
type: str |
| 43 |
uid_in_updatable_objects_repository: |
| 44 |
description: |
| 45 |
- Unique identifier of the updatable object in the Updatable Objects Repository. |
| 46 |
type: str |
| 47 |
color: |
| 48 |
description: |
| 49 |
- Color of the object. Should be one of existing colors. |
| 50 |
type: str |
| 51 |
choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green', |
| 52 |
'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', |
| 53 |
'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow'] |
| 54 |
comments: |
| 55 |
description: |
| 56 |
- Comments string. |
| 57 |
type: str |
| 58 |
details_level: |
| 59 |
description: |
| 60 |
- 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 |
| 61 |
representation of the object. |
| 62 |
type: str |
| 63 |
choices: ['uid', 'standard', 'full'] |
| 64 |
ignore_warnings: |
| 65 |
description: |
| 66 |
- Apply changes ignoring warnings. |
| 67 |
type: bool |
| 68 |
ignore_errors: |
| 69 |
description: |
| 70 |
- 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. |
| 71 |
type: bool |
| 72 |
extends_documentation_fragment: check_point.mgmt.checkpoint_commands |
| 73 |
""" |
| 74 |
|
| 75 |
EXAMPLES = """ |
| 76 |
- name: add-updatable-object |
| 77 |
cp_mgmt_add_updatable_object: |
| 78 |
uri: '{{uri}}' |
| 79 |
""" |
| 80 |
|
| 81 |
RETURN = """ |
| 82 |
cp_mgmt_add_updatable_object: |
| 83 |
description: The checkpoint add-updatable-object output. |
| 84 |
returned: always. |
| 85 |
type: dict |
| 86 |
""" |
| 87 |
|
| 88 |
from ansible.module_utils.basic import AnsibleModule |
| 89 |
from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command |
| 90 |
|
| 91 |
|
| 92 |
def main(): |
| 93 |
argument_spec = dict( |
| 94 |
uri=dict(type='str'), |
| 95 |
uid_in_updatable_objects_repository=dict(type='str'), |
| 96 |
color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', |
| 97 |
'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', |
| 98 |
'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon', 'coral', 'sea green', |
| 99 |
'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', |
| 100 |
'yellow']), |
| 101 |
comments=dict(type='str'), |
| 102 |
details_level=dict(type='str', choices=['uid', 'standard', 'full']), |
| 103 |
ignore_warnings=dict(type='bool'), |
| 104 |
ignore_errors=dict(type='bool') |
| 105 |
) |
| 106 |
argument_spec.update(checkpoint_argument_spec_for_commands) |
| 107 |
|
| 108 |
module = AnsibleModule(argument_spec=argument_spec) |
| 109 |
|
| 110 |
command = "add-updatable-object" |
| 111 |
|
| 112 |
result = api_command(module, command) |
| 113 |
module.exit_json(**result) |
| 114 |
|
| 115 |
|
| 116 |
if __name__ == '__main__': |
| 117 |
main() |