Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_csf.py

raw symbols SCIP
1 #!/usr/bin/python
2 from __future__ import absolute_import, division, print_function
3 # Copyright 2019-2024 Fortinet, Inc.
4 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
5
6 __metaclass__ = type
7
8 ANSIBLE_METADATA = {'status': ['preview'],
9 'supported_by': 'community',
10 'metadata_version': '1.1'}
11
12 DOCUMENTATION = '''
13 ---
14 module: fmgr_system_csf
15 short_description: Add this device to a Security Fabric or set up a new Security Fabric on this device.
16 version_added: "2.3.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 system_csf:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 accept_auth_by_cert:
27 aliases: ['accept-auth-by-cert']
28 type: str
29 description:
30 - Accept connections with unknown certificates and ask admin for approval.
31 - disable - Do not accept SSL connections with unknown certificates.
32 - enable - Accept SSL connections without automatic certificate verification.
33 choices: ['disable', 'enable']
34 authorization_request_type:
35 aliases: ['authorization-request-type']
36 type: str
37 description:
38 - Authorization request type.
39 - certificate - Request verification by certificate.
40 - serial - Request verification by serial number.
41 choices: ['certificate', 'serial']
42 certificate:
43 type: str
44 description: Certificate.
45 configuration_sync:
46 aliases: ['configuration-sync']
47 type: str
48 description:
49 - Configuration sync mode.
50 - default - Synchronize configuration for IPAM, FortiAnalyzer, FortiSandbox, and Central Management to root node.
51 - local - Do not synchronize configuration with root node.
52 choices: ['default', 'local']
53 downstream_access:
54 aliases: ['downstream-access']
55 type: str
56 description:
57 - Enable/disable downstream device access to this device's configuration and data.
58 - disable - Disable downstream device access to this device's configuration and data.
59 - enable - Enable downstream device access to this device's configuration and data.
60 choices: ['disable', 'enable']
61 downstream_accprofile:
62 aliases: ['downstream-accprofile']
63 type: str
64 description: Default access profile for requests from downstream devices.
65 fabric_connector:
66 aliases: ['fabric-connector']
67 type: list
68 elements: dict
69 description: Fabric connector.
70 suboptions:
71 accprofile:
72 type: str
73 description: Override access profile.
74 configuration_write_access:
75 aliases: ['configuration-write-access']
76 type: str
77 description:
78 - Enable/disable downstream device write access to configuration.
79 - disable - Disable downstream device write access to configuration.
80 - enable - Enable downstream device write access to configuration.
81 choices: ['disable', 'enable']
82 serial:
83 type: str
84 description: Serial.
85 fabric_object_unification:
86 aliases: ['fabric-object-unification']
87 type: str
88 description:
89 - Fabric CMDB Object Unification.
90 - local - Global CMDB objects will not be synchronized to and from this device.
91 - default - Global CMDB objects will be synchronized in Security Fabric.
92 choices: ['local', 'default']
93 fabric_workers:
94 aliases: ['fabric-workers']
95 type: int
96 description: Number of worker processes for Security Fabric daemon.
97 file_mgmt:
98 aliases: ['file-mgmt']
99 type: str
100 description:
101 - Enable/disable Security Fabric daemon file management.
102 - disable - Disable daemon file management.
103 - enable - Enable daemon file management.
104 choices: ['disable', 'enable']
105 file_quota:
106 aliases: ['file-quota']
107 type: int
108 description: Maximum amount of memory that can be used by the daemon files
109 file_quota_warning:
110 aliases: ['file-quota-warning']
111 type: int
112 description: Warn when the set percentage of quota has been used.
113 fixed_key:
114 aliases: ['fixed-key']
115 type: list
116 elements: str
117 description: Auto-generated fixed key used when this device is the root.
118 forticloud_account_enforcement:
119 aliases: ['forticloud-account-enforcement']
120 type: str
121 description:
122 - Fabric FortiCloud account unification.
123 - disable - Disable FortiCloud accound ID matching for Security Fabric.
124 - enable - Enable FortiCloud account ID matching for Security Fabric.
125 choices: ['disable', 'enable']
126 group_name:
127 aliases: ['group-name']
128 type: str
129 description: Security Fabric group name.
130 group_password:
131 aliases: ['group-password']
132 type: list
133 elements: str
134 description: Security Fabric group password.
135 log_unification:
136 aliases: ['log-unification']
137 type: str
138 description:
139 - Enable/disable broadcast of discovery messages for log unification.
140 - disable - Disable broadcast of discovery messages for log unification.
141 - enable - Enable broadcast of discovery messages for log unification.
142 choices: ['disable', 'enable']
143 saml_configuration_sync:
144 aliases: ['saml-configuration-sync']
145 type: str
146 description:
147 - SAML setting configuration synchronization.
148 - local - Do not apply SAML configuration generated by root.
149 - default - SAML setting for fabric members is created by fabric root.
150 choices: ['local', 'default']
151 status:
152 type: str
153 description:
154 - Enable/disable Security Fabric.
155 - disable - Disable Security Fabric.
156 - enable - Enable Security Fabric.
157 choices: ['disable', 'enable']
158 trusted_list:
159 aliases: ['trusted-list']
160 type: list
161 elements: dict
162 description: Trusted list.
163 suboptions:
164 action:
165 type: str
166 description:
167 - Security fabric authorization action.
168 - accept - Accept authorization request.
169 - deny - Deny authorization request.
170 choices: ['accept', 'deny']
171 authorization_type:
172 aliases: ['authorization-type']
173 type: str
174 description:
175 - Authorization type.
176 - serial - Verify downstream by serial number.
177 - certificate - Verify downstream by certificate.
178 choices: ['serial', 'certificate']
179 certificate:
180 type: str
181 description: Certificate.
182 downstream_authorization:
183 aliases: ['downstream-authorization']
184 type: str
185 description:
186 - Trust authorizations by this node's administrator.
187 - disable - Disable downstream authorization.
188 - enable - Enable downstream authorization.
189 choices: ['disable', 'enable']
190 ha_members:
191 aliases: ['ha-members']
192 type: str
193 description: HA members.
194 index:
195 type: int
196 description: Index of the downstream in tree.
197 name:
198 type: str
199 description: Name.
200 serial:
201 type: str
202 description: Serial.
203 upstream:
204 type: str
205 description: IP/FQDN of the FortiGate upstream from this FortiGate in the Security Fabric.
206 upstream_port:
207 aliases: ['upstream-port']
208 type: int
209 description: The port number to use to communicate with the FortiGate upstream from this FortiGate in the Security Fabric
210 upstream_confirm:
211 aliases: ['upstream-confirm']
212 type: str
213 description:
214 - Upstream authorization confirm.
215 - discover - Discover upstream device's info.
216 - confirm - Confirm upstream device's access.
217 choices: ['discover', 'confirm']
218 ssl_protocol:
219 aliases: ['ssl-protocol']
220 type: str
221 description:
222 - set the lowest SSL protocol version for upstream and downstream connections.
223 - follow-global-ssl-protocol - Follow system.
224 - sslv3 - set SSLv3 as the lowest version.
225 - tlsv1.
226 - tlsv1.
227 - tlsv1.
228 - tlsv1.
229 choices: ['follow-global-ssl-protocol', 'sslv3', 'tlsv1.0', 'tlsv1.1', 'tlsv1.2',
230 'tlsv1.3']
231 '''
232
233 EXAMPLES = '''
234 - name: Example playbook (generated based on argument schema)
235 hosts: fortimanagers
236 connection: httpapi
237 gather_facts: false
238 tasks:
239 - name: Add this device to a Security Fabric or set up a new Security Fabric on this device.
240 fortinet.fortimanager.fmgr_system_csf:
241 # workspace_locking_adom: <global or your adom name>
242 system_csf:
243 # accept_auth_by_cert: <value in [disable, enable]>
244 # authorization_request_type: <value in [certificate, serial]>
245 # certificate: <string>
246 # configuration_sync: <value in [default, local]>
247 # downstream_access: <value in [disable, enable]>
248 # downstream_accprofile: <string>
249 # fabric_connector:
250 # - accprofile: <string>
251 # configuration_write_access: <value in [disable, enable]>
252 # serial: <string>
253 # fabric_object_unification: <value in [local, default]>
254 # fabric_workers: <integer>
255 # file_mgmt: <value in [disable, enable]>
256 # file_quota: <integer>
257 # file_quota_warning: <integer>
258 # fixed_key: <list or string>
259 # forticloud_account_enforcement: <value in [disable, enable]>
260 # group_name: <string>
261 # group_password: <list or string>
262 # log_unification: <value in [disable, enable]>
263 # saml_configuration_sync: <value in [local, default]>
264 # status: <value in [disable, enable]>
265 # trusted_list:
266 # - action: <value in [accept, deny]>
267 # authorization_type: <value in [serial, certificate]>
268 # certificate: <string>
269 # downstream_authorization: <value in [disable, enable]>
270 # ha_members: <string>
271 # index: <integer>
272 # name: <string>
273 # serial: <string>
274 # upstream: <string>
275 # upstream_port: <integer>
276 # upstream_confirm: <value in [discover, confirm]>
277 # ssl_protocol: <value in [follow-global-ssl-protocol, sslv3, tlsv1.0, ...]>
278 '''
279
280 RETURN = '''
281 meta:
282 description: The result of the request.
283 type: dict
284 returned: always
285 contains:
286 request_url:
287 description: The full url requested.
288 returned: always
289 type: str
290 sample: /sys/login/user
291 response_code:
292 description: The status of api request.
293 returned: always
294 type: int
295 sample: 0
296 response_data:
297 description: The api response.
298 type: list
299 returned: always
300 response_message:
301 description: The descriptive message of the api response.
302 type: str
303 returned: always
304 sample: OK.
305 system_information:
306 description: The information of the target system.
307 type: dict
308 returned: always
309 rc:
310 description: The status the request.
311 type: int
312 returned: always
313 sample: 0
314 version_check_warning:
315 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
316 type: list
317 returned: complex
318 '''
319 from ansible.module_utils.basic import AnsibleModule
320 from ansible.module_utils.connection import Connection
321 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
322 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
323
324
325 def main():
326 urls_list = [
327 '/cli/global/system/csf'
328 ]
329 module_arg_spec = {
330 'system_csf': {
331 'type': 'dict', 'v_range': [['7.4.1', '']],
332 'options': {
333 'accept-auth-by-cert': {'v_range': [['7.4.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
334 'authorization-request-type': {'v_range': [['7.4.1', '']], 'choices': ['certificate', 'serial'], 'type': 'str'},
335 'certificate': {'v_range': [['7.4.1', '']], 'type': 'str'},
336 'configuration-sync': {'v_range': [['7.4.1', '7.4.3']], 'choices': ['default', 'local'], 'type': 'str'},
337 'downstream-access': {'v_range': [['7.4.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
338 'downstream-accprofile': {'v_range': [['7.4.1', '']], 'type': 'str'},
339 'fabric-connector': {
340 'v_range': [['7.4.1', '']],
341 'type': 'list',
342 'options': {
343 'accprofile': {'v_range': [['7.4.1', '']], 'type': 'str'},
344 'configuration-write-access': {'v_range': [['7.4.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
345 'serial': {'v_range': [['7.4.1', '']], 'type': 'str'}
346 },
347 'elements': 'dict'
348 },
349 'fabric-object-unification': {'v_range': [['7.4.1', '7.4.3']], 'choices': ['local', 'default'], 'type': 'str'},
350 'fabric-workers': {'v_range': [['7.4.1', '']], 'type': 'int'},
351 'file-mgmt': {'v_range': [['7.4.1', '7.4.3']], 'choices': ['disable', 'enable'], 'type': 'str'},
352 'file-quota': {'v_range': [['7.4.1', '7.4.3']], 'type': 'int'},
353 'file-quota-warning': {'v_range': [['7.4.1', '7.4.3']], 'type': 'int'},
354 'fixed-key': {'v_range': [['7.4.1', '']], 'no_log': True, 'type': 'list', 'elements': 'str'},
355 'forticloud-account-enforcement': {'v_range': [['7.4.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
356 'group-name': {'v_range': [['7.4.1', '']], 'type': 'str'},
357 'group-password': {'v_range': [['7.4.1', '']], 'no_log': True, 'type': 'list', 'elements': 'str'},
358 'log-unification': {'v_range': [['7.4.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
359 'saml-configuration-sync': {'v_range': [['7.4.1', '7.4.3']], 'choices': ['local', 'default'], 'type': 'str'},
360 'status': {'v_range': [['7.4.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
361 'trusted-list': {
362 'v_range': [['7.4.1', '']],
363 'type': 'list',
364 'options': {
365 'action': {'v_range': [['7.4.1', '']], 'choices': ['accept', 'deny'], 'type': 'str'},
366 'authorization-type': {'v_range': [['7.4.1', '']], 'choices': ['serial', 'certificate'], 'type': 'str'},
367 'certificate': {'v_range': [['7.4.1', '']], 'type': 'str'},
368 'downstream-authorization': {'v_range': [['7.4.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
369 'ha-members': {'v_range': [['7.4.1', '']], 'type': 'str'},
370 'index': {'v_range': [['7.4.1', '']], 'type': 'int'},
371 'name': {'v_range': [['7.4.1', '']], 'type': 'str'},
372 'serial': {'v_range': [['7.4.1', '']], 'type': 'str'}
373 },
374 'elements': 'dict'
375 },
376 'upstream': {'v_range': [['7.4.1', '']], 'type': 'str'},
377 'upstream-port': {'v_range': [['7.4.1', '']], 'type': 'int'},
378 'upstream-confirm': {'v_range': [['7.6.0', '']], 'choices': ['discover', 'confirm'], 'type': 'str'},
379 'ssl-protocol': {
380 'v_range': [['7.4.4', '7.4.10'], ['7.6.2', '']],
381 'choices': ['follow-global-ssl-protocol', 'sslv3', 'tlsv1.0', 'tlsv1.1', 'tlsv1.2', 'tlsv1.3'],
382 'type': 'str'
383 }
384 }
385 }
386 }
387
388 module_option_spec = get_module_arg_spec('partial crud')
389 module_arg_spec.update(module_option_spec)
390 check_galaxy_version(module_arg_spec)
391 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_csf'),
392 supports_check_mode=True)
393 if not module._socket_path:
394 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
395 connection = Connection(module._socket_path)
396 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
397 None, 'data', module, connection)
398 fmgr.process_partial_crud()
399 module.exit_json(meta=module.params)
400
401
402 if __name__ == '__main__':
403 main()