Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_user_exchange.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_user_exchange
15 short_description: Configure MS Exchange server entries.
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 user_exchange:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 addr_type:
34 aliases: ['addr-type']
35 type: str
36 description: Indicate whether the server IP-address is IPv4 or IPv6.
37 choices: ['ipv4', 'ipv6']
38 auth_level:
39 aliases: ['auth-level']
40 type: str
41 description: Authentication security level used for the RPC protocol layer.
42 choices: ['low', 'medium', 'normal', 'high', 'connect', 'call', 'packet',
43 'integrity', 'privacy']
44 auth_type:
45 aliases: ['auth-type']
46 type: str
47 description: Authentication security type used for the RPC protocol layer.
48 choices: ['spnego', 'ntlm', 'kerberos']
49 connect_protocol:
50 aliases: ['connect-protocol']
51 type: str
52 description: Connection protocol used to connect to MS Exchange service.
53 choices: ['rpc-over-tcp', 'rpc-over-http', 'rpc-over-https']
54 domain_name:
55 aliases: ['domain-name']
56 type: str
57 description: MS Exchange server fully qualified domain name.
58 http_auth_type:
59 aliases: ['http-auth-type']
60 type: str
61 description: Authentication security type used for the HTTP transport.
62 choices: ['ntlm', 'basic']
63 ip:
64 type: str
65 description: Server IPv4 address.
66 ip6:
67 type: str
68 description: Server IPv6 address.
69 kdc_ip:
70 aliases: ['kdc-ip']
71 type: raw
72 description: (list) KDC IPv4 addresses for Kerberos authentication.
73 name:
74 type: str
75 description: MS Exchange server entry name.
76 required: true
77 password:
78 type: raw
79 description: (list) Password for the specified username.
80 server_name:
81 aliases: ['server-name']
82 type: str
83 description: MS Exchange server hostname.
84 ssl_min_proto_version:
85 aliases: ['ssl-min-proto-version']
86 type: str
87 description: Minimum SSL/TLS protocol version for HTTPS transport
88 choices: ['default', 'TLSv1-1', 'TLSv1-2', 'SSLv3', 'TLSv1', 'TLSv1-3']
89 username:
90 type: str
91 description: User name used to sign in to the server.
92 auto_discover_kdc:
93 aliases: ['auto-discover-kdc']
94 type: str
95 description: Enable/disable automatic discovery of KDC IP addresses.
96 choices: ['disable', 'enable']
97 validate_server_certificate:
98 aliases: ['validate-server-certificate']
99 type: str
100 description: Enable/disable exchange server certificate validation.
101 choices: ['disable', 'enable']
102 '''
103
104 EXAMPLES = '''
105 - name: Example playbook (generated based on argument schema)
106 hosts: fortimanagers
107 connection: httpapi
108 gather_facts: false
109 tasks:
110 - name: Configure MS Exchange server entries.
111 fortinet.fortimanager.fmgr_user_exchange:
112 # workspace_locking_adom: <global or your adom name>
113 adom: <your own value>
114 state: present # <value in [present, absent]>
115 user_exchange:
116 name: "your value" # Required variable, string
117 # addr_type: <value in [ipv4, ipv6]>
118 # auth_level: <value in [low, medium, normal, ...]>
119 # auth_type: <value in [spnego, ntlm, kerberos]>
120 # connect_protocol: <value in [rpc-over-tcp, rpc-over-http, rpc-over-https]>
121 # domain_name: <string>
122 # http_auth_type: <value in [ntlm, basic]>
123 # ip: <string>
124 # ip6: <string>
125 # kdc_ip: <list or string>
126 # password: <list or string>
127 # server_name: <string>
128 # ssl_min_proto_version: <value in [default, TLSv1-1, TLSv1-2, ...]>
129 # username: <string>
130 # auto_discover_kdc: <value in [disable, enable]>
131 # validate_server_certificate: <value in [disable, enable]>
132 '''
133
134 RETURN = '''
135 meta:
136 description: The result of the request.
137 type: dict
138 returned: always
139 contains:
140 request_url:
141 description: The full url requested.
142 returned: always
143 type: str
144 sample: /sys/login/user
145 response_code:
146 description: The status of api request.
147 returned: always
148 type: int
149 sample: 0
150 response_data:
151 description: The api response.
152 type: list
153 returned: always
154 response_message:
155 description: The descriptive message of the api response.
156 type: str
157 returned: always
158 sample: OK.
159 system_information:
160 description: The information of the target system.
161 type: dict
162 returned: always
163 rc:
164 description: The status the request.
165 type: int
166 returned: always
167 sample: 0
168 version_check_warning:
169 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
170 type: list
171 returned: complex
172 '''
173 from ansible.module_utils.basic import AnsibleModule
174 from ansible.module_utils.connection import Connection
175 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
176 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
177
178
179 def main():
180 urls_list = [
181 '/pm/config/adom/{adom}/obj/user/exchange',
182 '/pm/config/global/obj/user/exchange'
183 ]
184 module_arg_spec = {
185 'adom': {'required': True, 'type': 'str'},
186 'revision_note': {'type': 'str'},
187 'user_exchange': {
188 'type': 'dict', 'v_range': [['6.2.0', '']],
189 'options': {
190 'addr-type': {'v_range': [['6.2.0', '7.2.0']], 'choices': ['ipv4', 'ipv6'], 'type': 'str'},
191 'auth-level': {
192 'v_range': [['6.2.0', '']],
193 'choices': ['low', 'medium', 'normal', 'high', 'connect', 'call', 'packet', 'integrity', 'privacy'],
194 'type': 'str'
195 },
196 'auth-type': {'v_range': [['6.2.1', '']], 'choices': ['spnego', 'ntlm', 'kerberos'], 'type': 'str'},
197 'connect-protocol': {'v_range': [['6.2.0', '']], 'choices': ['rpc-over-tcp', 'rpc-over-http', 'rpc-over-https'], 'type': 'str'},
198 'domain-name': {'v_range': [['6.2.0', '']], 'type': 'str'},
199 'http-auth-type': {'v_range': [['6.2.1', '']], 'choices': ['ntlm', 'basic'], 'type': 'str'},
200 'ip': {'v_range': [['6.2.0', '']], 'type': 'str'},
201 'ip6': {'v_range': [['6.2.0', '7.2.0']], 'type': 'str'},
202 'kdc-ip': {'v_range': [['6.2.1', '']], 'type': 'raw'},
203 'name': {'v_range': [['6.2.0', '']], 'required': True, 'type': 'str'},
204 'password': {'v_range': [['6.2.0', '']], 'no_log': True, 'type': 'raw'},
205 'server-name': {'v_range': [['6.2.0', '']], 'type': 'str'},
206 'ssl-min-proto-version': {
207 'v_range': [['6.2.1', '']],
208 'choices': ['default', 'TLSv1-1', 'TLSv1-2', 'SSLv3', 'TLSv1', 'TLSv1-3'],
209 'type': 'str'
210 },
211 'username': {'v_range': [['6.2.0', '']], 'type': 'str'},
212 'auto-discover-kdc': {'v_range': [['6.4.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
213 'validate-server-certificate': {'v_range': [['7.6.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
214 }
215 }
216 }
217
218 module_option_spec = get_module_arg_spec('full crud')
219 module_arg_spec.update(module_option_spec)
220 check_galaxy_version(module_arg_spec)
221 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'user_exchange'),
222 supports_check_mode=True)
223 if not module._socket_path:
224 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
225 connection = Connection(module._socket_path)
226 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
227 'name', 'data', module, connection)
228 fmgr.process_crud()
229 module.exit_json(meta=module.params)
230
231
232 if __name__ == '__main__':
233 main()