|
| 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_central_license_facts |
| 31 | +short_description: Get central-license objects facts on Checkpoint over Web Services API |
| 32 | +description: |
| 33 | + - Get central-license objects facts on Checkpoint devices. |
| 34 | + - All operations are performed over Web Services API. |
| 35 | + - This module handles both operations, get a specific object and get several objects, |
| 36 | + For getting a specific object use the parameter 'signature'. |
| 37 | +version_added: "5.2.0" |
| 38 | +author: "Eden Brillant (@chkp-edenbr)" |
| 39 | +options: |
| 40 | + signature: |
| 41 | + description: |
| 42 | + - The license's signature. This parameter is relevant only for getting a specific object. |
| 43 | + type: str |
| 44 | +extends_documentation_fragment: checkpoint_facts |
| 45 | +""" |
| 46 | + |
| 47 | +EXAMPLES = """ |
| 48 | +- name: show-central-license |
| 49 | + cp_mgmt_central_license_facts: |
| 50 | + signature: dLLLLL-WWWWWW-ZZZZZZ-QQQQQQ |
| 51 | +
|
| 52 | +- name: show-central-licenses |
| 53 | + cp_mgmt_show_central_licenses: |
| 54 | +""" |
| 55 | + |
| 56 | +RETURN = """ |
| 57 | +ansible_facts: |
| 58 | + description: The checkpoint object facts. |
| 59 | + returned: always. |
| 60 | + type: dict |
| 61 | +""" |
| 62 | + |
| 63 | +from ansible.module_utils.basic import AnsibleModule |
| 64 | +from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import ( |
| 65 | + checkpoint_argument_spec_for_facts, |
| 66 | + api_call_facts, |
| 67 | +) |
| 68 | + |
| 69 | + |
| 70 | +def main(): |
| 71 | + argument_spec = dict( |
| 72 | + signature=dict(type='str') |
| 73 | + ) |
| 74 | + argument_spec.update(checkpoint_argument_spec_for_facts) |
| 75 | + |
| 76 | + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) |
| 77 | + |
| 78 | + api_call_object = "central-license" |
| 79 | + api_call_object_plural_version = "central-licenses" |
| 80 | + |
| 81 | + result = api_call_facts(module, api_call_object, api_call_object_plural_version) |
| 82 | + module.exit_json(ansible_facts=result) |
| 83 | + |
| 84 | + |
| 85 | +if __name__ == '__main__': |
| 86 | + main() |
0 commit comments