Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_mpskprofile.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_mpskprofile
15 short_description: Configure MPSK profile.
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.full_crud
20 options:
21 revision_note:
22 description: The change note that can be specified when an object is created or updated.
23 type: str
24 adom:
25 description: The parameter (adom) in requested url.
26 type: str
27 required: true
28 mpskprofile:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 mpsk_concurrent_clients:
34 aliases: ['mpsk-concurrent-clients']
35 type: int
36 description: Maximum number of concurrent clients that connect using the same passphrase in multiple PSK authentication
37 mpsk_group:
38 aliases: ['mpsk-group']
39 type: list
40 elements: dict
41 description: Mpsk group.
42 suboptions:
43 mpsk_key:
44 aliases: ['mpsk-key']
45 type: list
46 elements: dict
47 description: Mpsk key.
48 suboptions:
49 comment:
50 type: str
51 description: Comment.
52 concurrent_client_limit_type:
53 aliases: ['concurrent-client-limit-type']
54 type: str
55 description: MPSK client limit type options.
56 choices: ['default', 'unlimited', 'specified']
57 concurrent_clients:
58 aliases: ['concurrent-clients']
59 type: int
60 description: Number of clients that can connect using this pre-shared key
61 mac:
62 type: str
63 description: MAC address.
64 mpsk_schedules:
65 aliases: ['mpsk-schedules']
66 type: raw
67 description: (list or str) Firewall schedule for MPSK passphrase.
68 name:
69 type: str
70 description: Pre-shared key name.
71 passphrase:
72 type: raw
73 description: (list) WPA Pre-shared key.
74 pmk:
75 type: raw
76 description: (list) WPA PMK.
77 key_type:
78 aliases: ['key-type']
79 type: str
80 description: Select the type of the key.
81 choices: ['wpa2-personal', 'wpa3-sae']
82 sae_password:
83 aliases: ['sae-password']
84 type: raw
85 description: (list) WPA3 SAE password.
86 sae_pk:
87 aliases: ['sae-pk']
88 type: str
89 description: Enable/disable WPA3 SAE-PK
90 choices: ['disable', 'enable']
91 sae_private_key:
92 aliases: ['sae-private-key']
93 type: str
94 description: Private key used for WPA3 SAE-PK authentication.
95 name:
96 type: str
97 description: MPSK group name.
98 vlan_id:
99 aliases: ['vlan-id']
100 type: int
101 description: Optional VLAN ID.
102 vlan_type:
103 aliases: ['vlan-type']
104 type: str
105 description: MPSK group VLAN options.
106 choices: ['no-vlan', 'fixed-vlan']
107 name:
108 type: str
109 description: MPSK profile name.
110 required: true
111 ssid:
112 type: str
113 description: SSID of the VAP in which the MPSK profile is configured.
114 mpsk_external_server:
115 aliases: ['mpsk-external-server']
116 type: raw
117 description: (list) RADIUS server to be used to authenticate MPSK users.
118 mpsk_external_server_auth:
119 aliases: ['mpsk-external-server-auth']
120 type: str
121 description: Enable/Disable MPSK external server authentication
122 choices: ['disable', 'enable']
123 mpsk_type:
124 aliases: ['mpsk-type']
125 type: str
126 description: Select the security type of keys for this profile.
127 choices: ['wpa2-personal', 'wpa3-sae', 'wpa3-sae-transition']
128 '''
129
130 EXAMPLES = '''
131 - name: Example playbook (generated based on argument schema)
132 hosts: fortimanagers
133 connection: httpapi
134 gather_facts: false
135 tasks:
136 - name: Configure MPSK profile.
137 fortinet.fortimanager.fmgr_mpskprofile:
138 # workspace_locking_adom: <global or your adom name>
139 adom: <your own value>
140 state: present # <value in [present, absent]>
141 mpskprofile:
142 name: "your value" # Required variable, string
143 # mpsk_concurrent_clients: <integer>
144 # mpsk_group:
145 # - mpsk_key:
146 # - comment: <string>
147 # concurrent_client_limit_type: <value in [default, unlimited, specified]>
148 # concurrent_clients: <integer>
149 # mac: <string>
150 # mpsk_schedules: <list or string>
151 # name: <string>
152 # passphrase: <list or string>
153 # pmk: <list or string>
154 # key_type: <value in [wpa2-personal, wpa3-sae]>
155 # sae_password: <list or string>
156 # sae_pk: <value in [disable, enable]>
157 # sae_private_key: <string>
158 # name: <string>
159 # vlan_id: <integer>
160 # vlan_type: <value in [no-vlan, fixed-vlan]>
161 # ssid: <string>
162 # mpsk_external_server: <list or string>
163 # mpsk_external_server_auth: <value in [disable, enable]>
164 # mpsk_type: <value in [wpa2-personal, wpa3-sae, wpa3-sae-transition]>
165 '''
166
167 RETURN = '''
168 meta:
169 description: The result of the request.
170 type: dict
171 returned: always
172 contains:
173 request_url:
174 description: The full url requested.
175 returned: always
176 type: str
177 sample: /sys/login/user
178 response_code:
179 description: The status of api request.
180 returned: always
181 type: int
182 sample: 0
183 response_data:
184 description: The api response.
185 type: list
186 returned: always
187 response_message:
188 description: The descriptive message of the api response.
189 type: str
190 returned: always
191 sample: OK.
192 system_information:
193 description: The information of the target system.
194 type: dict
195 returned: always
196 rc:
197 description: The status the request.
198 type: int
199 returned: always
200 sample: 0
201 version_check_warning:
202 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
203 type: list
204 returned: complex
205 '''
206 from ansible.module_utils.basic import AnsibleModule
207 from ansible.module_utils.connection import Connection
208 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
209 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
210
211
212 def main():
213 urls_list = [
214 '/pm/config/adom/{adom}/obj/wireless-controller/mpsk-profile',
215 '/pm/config/global/obj/wireless-controller/mpsk-profile'
216 ]
217 module_arg_spec = {
218 'adom': {'required': True, 'type': 'str'},
219 'revision_note': {'type': 'str'},
220 'mpskprofile': {
221 'type': 'dict', 'v_range': [['6.4.2', '']],
222 'options': {
223 'mpsk-concurrent-clients': {'v_range': [['6.4.2', '']], 'type': 'int'},
224 'mpsk-group': {
225 'v_range': [['6.4.2', '']],
226 'type': 'list',
227 'options': {
228 'mpsk-key': {
229 'v_range': [['6.4.2', '']],
230 'no_log': True,
231 'type': 'list',
232 'options': {
233 'comment': {'v_range': [['6.4.2', '']], 'type': 'str'},
234 'concurrent-client-limit-type': {
235 'v_range': [['6.4.2', '']],
236 'choices': ['default', 'unlimited', 'specified'],
237 'type': 'str'
238 },
239 'concurrent-clients': {'v_range': [['6.4.2', '']], 'type': 'int'},
240 'mac': {'v_range': [['6.4.2', '']], 'type': 'str'},
241 'mpsk-schedules': {'v_range': [['6.4.2', '']], 'type': 'raw'},
242 'name': {'v_range': [['6.4.2', '']], 'type': 'str'},
243 'passphrase': {'v_range': [['6.4.2', '']], 'no_log': True, 'type': 'raw'},
244 'pmk': {'v_range': [['6.4.2', '']], 'type': 'raw'},
245 'key-type': {'v_range': [['7.4.3', '']], 'choices': ['wpa2-personal', 'wpa3-sae'], 'type': 'str'},
246 'sae-password': {'v_range': [['7.4.3', '']], 'no_log': True, 'type': 'raw'},
247 'sae-pk': {'v_range': [['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
248 'sae-private-key': {'v_range': [['7.4.3', '']], 'no_log': True, 'type': 'str'}
249 },
250 'elements': 'dict'
251 },
252 'name': {'v_range': [['6.4.2', '']], 'type': 'str'},
253 'vlan-id': {'v_range': [['6.4.2', '']], 'type': 'int'},
254 'vlan-type': {'v_range': [['6.4.2', '']], 'choices': ['no-vlan', 'fixed-vlan'], 'type': 'str'}
255 },
256 'elements': 'dict'
257 },
258 'name': {'v_range': [['6.4.2', '']], 'required': True, 'type': 'str'},
259 'ssid': {'v_range': [['6.4.2', '']], 'type': 'str'},
260 'mpsk-external-server': {'v_range': [['7.4.3', '']], 'type': 'raw'},
261 'mpsk-external-server-auth': {'v_range': [['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
262 'mpsk-type': {'v_range': [['7.4.3', '']], 'choices': ['wpa2-personal', 'wpa3-sae', 'wpa3-sae-transition'], 'type': 'str'}
263 }
264 }
265 }
266
267 module_option_spec = get_module_arg_spec('full crud')
268 module_arg_spec.update(module_option_spec)
269 check_galaxy_version(module_arg_spec)
270 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'mpskprofile'),
271 supports_check_mode=True)
272 if not module._socket_path:
273 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
274 connection = Connection(module._socket_path)
275 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
276 'name', 'data', module, connection)
277 fmgr.process_crud()
278 module.exit_json(meta=module.params)
279
280
281 if __name__ == '__main__':
282 main()