Debian Codegraph @

ansible_collections/check_point/mgmt/plugins/modules/cp_mgmt_radius_server.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_radius_server
31 short_description: Manages radius-server objects on Checkpoint over Web Services API
32 description:
33 - Manages radius-server objects on Checkpoint devices including creating, updating and removing objects.
34 - All operations are performed over Web Services API.
35 - Available from R81.20 management version.
36 version_added: "5.0.0"
37 author: "Shiran Golzar (@chkp-shirango)"
38 options:
39 name:
40 description:
41 - Object name.
42 type: str
43 required: True
44 server:
45 description:
46 - The UID or Name of the host that is the RADIUS Server.
47 type: str
48 shared_secret:
49 description:
50 - The secret between the RADIUS server and the Security Gateway.
51 type: str
52 service:
53 description:
54 - The UID or Name of the Service to which the RADIUS server listens.
55 type: str
56 server_version:
57 description:
58 - The version can be either RADIUS Version 1.0, which is RFC 2138 compliant, and RADIUS Version 2.0 which is RFC 2865 compliant.
59 type: str
60 choices: ['RADIUS Ver. 1.0', 'RADIUS Ver. 2.0']
61 protocol:
62 description:
63 - The type of authentication protocol that will be used when authenticating the user to the RADIUS server.
64 type: str
65 choices: ['PAP', 'MS_CHAP2']
66 priority:
67 description:
68 - The priority of the RADIUS Server in case it is a member of a RADIUS Group.
69 type: int
70 accounting:
71 description:
72 - Accounting settings.
73 type: dict
74 suboptions:
75 enable_ip_pool_management:
76 description:
77 - IP pool management, enables Accounting service.
78 type: bool
79 accounting_service:
80 description:
81 - The UID or Name of the the accounting interface to notify the server when users login and logout which will then lock and release the
82 IP addresses that the server allocated to those users.
83 type: str
84 tags:
85 description:
86 - Collection of tag identifiers.
87 type: list
88 elements: str
89 color:
90 description:
91 - Color of the object. Should be one of existing colors.
92 type: str
93 choices: ['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green', 'khaki', 'orchid', 'dark orange', 'dark sea green',
94 'pink', 'turquoise', 'dark blue', 'firebrick', 'brown', 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green', 'lemon chiffon',
95 'coral', 'sea green', 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue', 'olive', 'orange', 'red', 'sienna', 'yellow']
96 comments:
97 description:
98 - Comments string.
99 type: str
100 details_level:
101 description:
102 - 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
103 representation of the object.
104 type: str
105 choices: ['uid', 'standard', 'full']
106 groups:
107 description:
108 - Collection of group identifiers.
109 type: list
110 elements: str
111 ignore_warnings:
112 description:
113 - Apply changes ignoring warnings.
114 type: bool
115 ignore_errors:
116 description:
117 - 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.
118 type: bool
119 extends_documentation_fragment: check_point.mgmt.checkpoint_objects
120 """
121
122 EXAMPLES = """
123 - name: add-radius-server
124 cp_mgmt_radius_server:
125 name: radServer
126 server: hostRad
127 shared_secret: '123'
128 state: present
129
130 - name: set-radius-server
131 cp_mgmt_radius_server:
132 name: t4
133 server: hostRadius
134 state: present
135
136 - name: delete-radius-server
137 cp_mgmt_radius_server:
138 ignore_warnings: 'true'
139 name: radiusServer
140 state: absent
141 """
142
143 RETURN = """
144 cp_mgmt_radius_server:
145 description: The checkpoint object created or updated.
146 returned: always, except when deleting the object.
147 type: dict
148 """
149
150 from ansible.module_utils.basic import AnsibleModule
151 from ansible_collections.check_point.mgmt.plugins.module_utils.checkpoint import checkpoint_argument_spec_for_objects, \
152 api_call
153
154
155 def main():
156 argument_spec = dict(
157 name=dict(type='str', required=True),
158 server=dict(type='str'),
159 shared_secret=dict(type='str', no_log=True),
160 service=dict(type='str'),
161 server_version=dict(type='str', choices=['RADIUS Ver. 1.0', 'RADIUS Ver. 2.0']),
162 protocol=dict(type='str', choices=['PAP', 'MS_CHAP2']),
163 priority=dict(type='int'),
164 accounting=dict(type='dict', options=dict(
165 enable_ip_pool_management=dict(type='bool'),
166 accounting_service=dict(type='str')
167 )),
168 tags=dict(type='list', elements='str'),
169 color=dict(type='str', choices=['aquamarine', 'black', 'blue', 'crete blue', 'burlywood', 'cyan', 'dark green',
170 'khaki', 'orchid', 'dark orange', 'dark sea green', 'pink', 'turquoise',
171 'dark blue', 'firebrick', 'brown',
172 'forest green', 'gold', 'dark gold', 'gray', 'dark gray', 'light green',
173 'lemon chiffon', 'coral', 'sea green',
174 'sky blue', 'magenta', 'purple', 'slate blue', 'violet red', 'navy blue',
175 'olive', 'orange', 'red', 'sienna',
176 'yellow']),
177 comments=dict(type='str'),
178 details_level=dict(type='str', choices=['uid', 'standard', 'full']),
179 groups=dict(type='list', elements='str'),
180 ignore_warnings=dict(type='bool'),
181 ignore_errors=dict(type='bool')
182 )
183 argument_spec.update(checkpoint_argument_spec_for_objects)
184
185 module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True)
186 api_call_object = 'radius-server'
187
188 result = api_call(module, api_call_object)
189 module.exit_json(**result)
190
191
192 if __name__ == '__main__':
193 main()