Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_set_trust.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_set_trust
31 short_description: Configure a Trusted communication between the Management Server and the managed Security Gateway.
32 description:
33 - Configure a Trusted communication between the Management Server and the managed Security Gateway.
34 - All operations are performed over Web Services API.
35 - Available from R82.10 management version.
36 version_added: "6.7.0"
37 author: "Eden Brillant (@chkp-edenbr)"
38 options:
39 name:
40 description:
41 - Object name.
42 type: str
43 ipv4_address:
44 description:
45 - IP address of the object, for establishing trust with dynamic gateways.
46 type: str
47 one_time_password:
48 description:
49 - Shared password to establish SIC between the Security Management and the Security Gateway.
50 type: str
51 trust_method:
52 description:
53 - Establish the trust communication method.
54 type: str
55 choices: ['one_time_password', 'without_password_not_secure', 'cloud_token']
56 trust_settings:
57 description:
58 - Settings for the trusted communication establishment.
59 type: dict
60 suboptions:
61 gateway_mac_address:
62 description:
63 - Use the Security Gateway MAC address, relevant for the gateway_mac_address identification-method.
64 type: str
65 identification_method:
66 description:
67 - How to identify the gateway (relevant for Spark DAIP gateways only).
68 type: str
69 choices: ['gateway_name', 'mac_address', 'none_not_secure', 'ip_address']
70 initiation_phase:
71 description:
72 - Push the certificate to the Security Gateway immediately, or wait for the Security Gateway to pull the certificate. Default value for
73 Spark Gateway is 'when_gateway_connects'.
74 type: str
75 choices: ['now', 'when_gateway_connects']
76 details_level:
77 description:
78 - 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
79 representation of the object.
80 type: str
81 choices: ['uid', 'standard', 'full']
82 domains_to_process:
83 description:
84 - Indicates which domains to process the commands on. It cannot be used with the details-level full, must be run from the System Domain only and
85 with ignore-warnings true. Valid values are, CURRENT_DOMAIN, ALL_DOMAINS_ON_THIS_SERVER.
86 type: list
87 elements: str
88 extends_documentation_fragment: check_point.mgmt.checkpoint_commands
89 """
90
91 EXAMPLES = """
92 - name: set-trust
93 cp_mgmt_set_trust:
94 name: gw1
95 one_time_password: aaaa
96 """
97
98 RETURN = """
99 cp_mgmt_set_trust:
100 description: The checkpoint set-trust output.
101 returned: always.
102 type: dict
103 """
104
105 from ansible.module_utils.basic import AnsibleModule
106 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_commands, api_command
107
108
109 def main():
110 argument_spec = dict(
111 name=dict(type='str'),
112 ipv4_address=dict(type='str'),
113 one_time_password=dict(type='str', no_log=True),
114 trust_method=dict(type='str', choices=['one_time_password', 'without_password_not_secure', 'cloud_token']),
115 trust_settings=dict(type='dict', options=dict(
116 gateway_mac_address=dict(type='str'),
117 identification_method=dict(type='str', choices=['gateway_name', 'mac_address', 'none_not_secure', 'ip_address']),
118 initiation_phase=dict(type='str', choices=['now', 'when_gateway_connects'])
119 )),
120 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
121 domains_to_process=dict(type='list', elements='str')
122 )
123 argument_spec.update(checkpoint_argument_spec_for_commands)
124
125 module = AnsibleModule(argument_spec=argument_spec)
126
127 command = "set-trust"
128
129 result = api_command(module, command)
130 module.exit_json(**result)
131
132
133 if __name__ == '__main__':
134 main()