Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_sslciphersuites.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_sslciphersuites
15 short_description: Configure preferred SSL/TLS cipher suites
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 system_sslciphersuites:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 cipher:
27 type: str
28 description: Cipher name
29 priority:
30 type: int
31 description: SSL/TLS cipher suites priority.
32 version:
33 type: str
34 description:
35 - SSL/TLS version the cipher suite can be used with.
36 - tls1.
37 - tls1.
38 choices: ['tls1.2-or-below', 'tls1.3']
39 '''
40
41 EXAMPLES = '''
42 - name: Example playbook (generated based on argument schema)
43 hosts: fortimanagers
44 connection: httpapi
45 gather_facts: false
46 tasks:
47 - name: Configure preferred SSL/TLS cipher suites
48 fortinet.fortimanager.fmgr_system_sslciphersuites:
49 # workspace_locking_adom: <global or your adom name>
50 state: present # <value in [present, absent]>
51 system_sslciphersuites:
52 # cipher: <string>
53 # priority: <integer>
54 # version: <value in [tls1.2-or-below, tls1.3]>
55 '''
56
57 RETURN = '''
58 meta:
59 description: The result of the request.
60 type: dict
61 returned: always
62 contains:
63 request_url:
64 description: The full url requested.
65 returned: always
66 type: str
67 sample: /sys/login/user
68 response_code:
69 description: The status of api request.
70 returned: always
71 type: int
72 sample: 0
73 response_data:
74 description: The api response.
75 type: list
76 returned: always
77 response_message:
78 description: The descriptive message of the api response.
79 type: str
80 returned: always
81 sample: OK.
82 system_information:
83 description: The information of the target system.
84 type: dict
85 returned: always
86 rc:
87 description: The status the request.
88 type: int
89 returned: always
90 sample: 0
91 version_check_warning:
92 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
93 type: list
94 returned: complex
95 '''
96 from ansible.module_utils.basic import AnsibleModule
97 from ansible.module_utils.connection import Connection
98 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
99 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
100
101
102 def main():
103 urls_list = [
104 '/cli/global/system/global/ssl-cipher-suites'
105 ]
106 module_arg_spec = {
107 'system_sslciphersuites': {
108 'type': 'dict', 'v_range': [['6.4.8', '6.4.15'], ['7.0.2', '']],
109 'options': {
110 'cipher': {'v_range': [['6.4.8', '6.4.15'], ['7.0.2', '']], 'type': 'str'},
111 'priority': {'v_range': [['6.4.8', '6.4.15'], ['7.0.2', '']], 'type': 'int'},
112 'version': {'v_range': [['6.4.8', '6.4.15'], ['7.0.2', '']], 'choices': ['tls1.2-or-below', 'tls1.3'], 'type': 'str'}
113 }
114 }
115 }
116
117 module_option_spec = get_module_arg_spec('full crud')
118 module_arg_spec.update(module_option_spec)
119 check_galaxy_version(module_arg_spec)
120 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_sslciphersuites'),
121 supports_check_mode=True)
122 if not module._socket_path:
123 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
124 connection = Connection(module._socket_path)
125 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
126 None, 'data', module, connection)
127 fmgr.process_crud()
128 module.exit_json(meta=module.params)
129
130
131 if __name__ == '__main__':
132 main()