Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_endpointcontrol_fctems.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_endpointcontrol_fctems
15 short_description: Configure FortiClient Enterprise Management Server
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 endpointcontrol_fctems:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 call_timeout:
34 aliases: ['call-timeout']
35 type: int
36 description: FortiClient EMS call timeout in seconds
37 capabilities:
38 type: list
39 elements: str
40 description: List of EMS capabilities.
41 choices: ['fabric-auth', 'silent-approval', 'websocket', 'websocket-malware',
42 'push-ca-certs', 'common-tags-api', 'tenant-id',
43 'single-vdom-connector', 'client-avatars', 'fgt-sysinfo-api',
44 'ztna-server-info', 'used-tags']
45 certificate_fingerprint:
46 aliases: ['certificate-fingerprint']
47 type: str
48 description: EMS certificate fingerprint.
49 cloud_server_type:
50 aliases: ['cloud-server-type']
51 type: str
52 description: Cloud server type.
53 choices: ['production', 'alpha', 'beta']
54 fortinetone_cloud_authentication:
55 aliases: ['fortinetone-cloud-authentication']
56 type: str
57 description: Enable/disable authentication of FortiClient EMS Cloud through FortiCloud account.
58 choices: ['disable', 'enable']
59 https_port:
60 aliases: ['https-port']
61 type: int
62 description: FortiClient EMS HTTPS access port number.
63 name:
64 type: str
65 description: FortiClient Enterprise Management Server
66 required: true
67 out_of_sync_threshold:
68 aliases: ['out-of-sync-threshold']
69 type: int
70 description: Outdated resource threshold in seconds
71 preserve_ssl_session:
72 aliases: ['preserve-ssl-session']
73 type: str
74 description: Enable/disable preservation of EMS SSL session connection.
75 choices: ['disable', 'enable']
76 pull_avatars:
77 aliases: ['pull-avatars']
78 type: str
79 description: Enable/disable pulling avatars from EMS.
80 choices: ['disable', 'enable']
81 pull_malware_hash:
82 aliases: ['pull-malware-hash']
83 type: str
84 description: Enable/disable pulling FortiClient malware hash from EMS.
85 choices: ['disable', 'enable']
86 pull_sysinfo:
87 aliases: ['pull-sysinfo']
88 type: str
89 description: Enable/disable pulling SysInfo from EMS.
90 choices: ['disable', 'enable']
91 pull_tags:
92 aliases: ['pull-tags']
93 type: str
94 description: Enable/disable pulling FortiClient user tags from EMS.
95 choices: ['disable', 'enable']
96 pull_vulnerabilities:
97 aliases: ['pull-vulnerabilities']
98 type: str
99 description: Enable/disable pulling vulnerabilities from EMS.
100 choices: ['disable', 'enable']
101 server:
102 type: str
103 description: FortiClient EMS FQDN or IPv4 address.
104 source_ip:
105 aliases: ['source-ip']
106 type: str
107 description: REST API call source IP.
108 websocket_override:
109 aliases: ['websocket-override']
110 type: str
111 description: Enable/disable override behavior for how this FortiGate unit connects to EMS using a WebSocket connection.
112 choices: ['disable', 'enable']
113 status_check_interval:
114 aliases: ['status-check-interval']
115 type: int
116 description: FortiClient EMS call timeout in seconds
117 certificate:
118 type: str
119 description: FortiClient EMS certificate.
120 admin_username:
121 aliases: ['admin-username']
122 type: str
123 description: FortiClient EMS admin username.
124 serial_number:
125 aliases: ['serial-number']
126 type: str
127 description: FortiClient EMS Serial Number.
128 admin_password:
129 aliases: ['admin-password']
130 type: raw
131 description: (list) FortiClient EMS admin password.
132 interface:
133 type: str
134 description: Specify outgoing interface to reach server.
135 interface_select_method:
136 aliases: ['interface-select-method']
137 type: str
138 description: Specify how to select outgoing interface to reach server.
139 choices: ['auto', 'sdwan', 'specify']
140 dirty_reason:
141 aliases: ['dirty-reason']
142 type: str
143 description: Dirty Reason for FortiClient EMS.
144 choices: ['none', 'mismatched-ems-sn']
145 ems_id:
146 aliases: ['ems-id']
147 type: int
148 description: EMS ID in order
149 status:
150 type: str
151 description: Enable or disable this EMS configuration.
152 choices: ['disable', 'enable']
153 ca_cn_info:
154 aliases: ['ca-cn-info']
155 type: str
156 description: Ca cn info.
157 trust_ca_cn:
158 aliases: ['trust-ca-cn']
159 type: str
160 description: Trust ca cn.
161 choices: ['disable', 'enable']
162 tenant_id:
163 aliases: ['tenant-id']
164 type: str
165 description: EMS Tenant ID.
166 send_tags_to_all_vdoms:
167 aliases: ['send-tags-to-all-vdoms']
168 type: str
169 description: Relax restrictions on tags to send all EMS tags to all VDOMs
170 choices: ['disable', 'enable']
171 verified_cn:
172 aliases: ['verified-cn']
173 type: str
174 description: EMS certificate CN.
175 verifying_ca:
176 aliases: ['verifying-ca']
177 type: str
178 description: Lowest CA cert on Fortigate in verified EMS cert chain.
179 cloud_authentication_access_key:
180 aliases: ['cloud-authentication-access-key']
181 type: str
182 description: FortiClient EMS Cloud multitenancy access key
183 '''
184
185 EXAMPLES = '''
186 - name: Example playbook (generated based on argument schema)
187 hosts: fortimanagers
188 connection: httpapi
189 gather_facts: false
190 tasks:
191 - name: Configure FortiClient Enterprise Management Server
192 fortinet.fortimanager.fmgr_endpointcontrol_fctems:
193 # workspace_locking_adom: <global or your adom name>
194 adom: <your own value>
195 state: present # <value in [present, absent]>
196 endpointcontrol_fctems:
197 name: "your value" # Required variable, string
198 # call_timeout: <integer>
199 # capabilities: ["fabric-auth", "silent-approval", "websocket", "websocket-malware",
200 # "push-ca-certs", "common-tags-api", "tenant-id",
201 # "single-vdom-connector", "client-avatars", "fgt-sysinfo-api",
202 # "ztna-server-info", "used-tags"]
203 # certificate_fingerprint: <string>
204 # cloud_server_type: <value in [production, alpha, beta]>
205 # fortinetone_cloud_authentication: <value in [disable, enable]>
206 # https_port: <integer>
207 # out_of_sync_threshold: <integer>
208 # preserve_ssl_session: <value in [disable, enable]>
209 # pull_avatars: <value in [disable, enable]>
210 # pull_malware_hash: <value in [disable, enable]>
211 # pull_sysinfo: <value in [disable, enable]>
212 # pull_tags: <value in [disable, enable]>
213 # pull_vulnerabilities: <value in [disable, enable]>
214 # server: <string>
215 # source_ip: <string>
216 # websocket_override: <value in [disable, enable]>
217 # status_check_interval: <integer>
218 # certificate: <string>
219 # admin_username: <string>
220 # serial_number: <string>
221 # admin_password: <list or string>
222 # interface: <string>
223 # interface_select_method: <value in [auto, sdwan, specify]>
224 # dirty_reason: <value in [none, mismatched-ems-sn]>
225 # ems_id: <integer>
226 # status: <value in [disable, enable]>
227 # ca_cn_info: <string>
228 # trust_ca_cn: <value in [disable, enable]>
229 # tenant_id: <string>
230 # send_tags_to_all_vdoms: <value in [disable, enable]>
231 # verified_cn: <string>
232 # verifying_ca: <string>
233 # cloud_authentication_access_key: <string>
234 '''
235
236 RETURN = '''
237 meta:
238 description: The result of the request.
239 type: dict
240 returned: always
241 contains:
242 request_url:
243 description: The full url requested.
244 returned: always
245 type: str
246 sample: /sys/login/user
247 response_code:
248 description: The status of api request.
249 returned: always
250 type: int
251 sample: 0
252 response_data:
253 description: The api response.
254 type: list
255 returned: always
256 response_message:
257 description: The descriptive message of the api response.
258 type: str
259 returned: always
260 sample: OK.
261 system_information:
262 description: The information of the target system.
263 type: dict
264 returned: always
265 rc:
266 description: The status the request.
267 type: int
268 returned: always
269 sample: 0
270 version_check_warning:
271 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
272 type: list
273 returned: complex
274 '''
275 from ansible.module_utils.basic import AnsibleModule
276 from ansible.module_utils.connection import Connection
277 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
278 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
279
280
281 def main():
282 urls_list = [
283 '/pm/config/adom/{adom}/obj/endpoint-control/fctems',
284 '/pm/config/global/obj/endpoint-control/fctems'
285 ]
286 module_arg_spec = {
287 'adom': {'required': True, 'type': 'str'},
288 'revision_note': {'type': 'str'},
289 'endpointcontrol_fctems': {
290 'type': 'dict', 'v_range': [['7.0.2', '']],
291 'options': {
292 'call-timeout': {'v_range': [['7.0.2', '']], 'type': 'int'},
293 'capabilities': {
294 'v_range': [['7.0.2', '']],
295 'type': 'list',
296 'choices': [
297 'fabric-auth', 'silent-approval', 'websocket', 'websocket-malware', 'push-ca-certs', 'common-tags-api', 'tenant-id',
298 'single-vdom-connector', 'client-avatars', 'fgt-sysinfo-api', 'ztna-server-info', 'used-tags'
299 ],
300 'elements': 'str'
301 },
302 'certificate-fingerprint': {'v_range': [['7.0.2', '']], 'type': 'str'},
303 'cloud-server-type': {'v_range': [['7.0.2', '']], 'choices': ['production', 'alpha', 'beta'], 'type': 'str'},
304 'fortinetone-cloud-authentication': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
305 'https-port': {'v_range': [['7.0.2', '']], 'type': 'int'},
306 'name': {'v_range': [['7.0.2', '']], 'required': True, 'type': 'str'},
307 'out-of-sync-threshold': {'v_range': [['7.0.5', '']], 'type': 'int'},
308 'preserve-ssl-session': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
309 'pull-avatars': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
310 'pull-malware-hash': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
311 'pull-sysinfo': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
312 'pull-tags': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
313 'pull-vulnerabilities': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
314 'server': {'v_range': [['7.0.2', '']], 'type': 'str'},
315 'source-ip': {'v_range': [['7.0.2', '']], 'type': 'str'},
316 'websocket-override': {'v_range': [['7.0.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
317 'status-check-interval': {'v_range': [['7.0.2', '']], 'type': 'int'},
318 'certificate': {'v_range': [['7.0.2', '']], 'type': 'str'},
319 'admin-username': {'v_range': [['7.0.2', '7.6.2']], 'type': 'str'},
320 'serial-number': {'v_range': [['7.0.2', '']], 'type': 'str'},
321 'admin-password': {'v_range': [['7.0.2', '7.6.2']], 'no_log': True, 'type': 'raw'},
322 'interface': {'v_range': [['7.0.4', '7.0.16'], ['7.2.1', '']], 'type': 'str'},
323 'interface-select-method': {'v_range': [['7.0.4', '7.0.16'], ['7.2.1', '']], 'choices': ['auto', 'sdwan', 'specify'], 'type': 'str'},
324 'dirty-reason': {'v_range': [['7.0.5', '7.0.16'], ['7.2.1', '']], 'choices': ['none', 'mismatched-ems-sn'], 'type': 'str'},
325 'ems-id': {'v_range': [['7.0.5', '7.0.16'], ['7.2.1', '']], 'type': 'int'},
326 'status': {'v_range': [['7.0.5', '7.0.16'], ['7.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
327 'ca-cn-info': {'v_range': [['7.0.6', '7.0.16'], ['7.2.2', '']], 'type': 'str'},
328 'trust-ca-cn': {'v_range': [['7.0.6', '7.0.16'], ['7.2.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
329 'tenant-id': {'v_range': [['7.2.1', '']], 'type': 'str'},
330 'send-tags-to-all-vdoms': {'v_range': [['7.4.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
331 'verified-cn': {'v_range': [['7.4.2', '']], 'type': 'str'},
332 'verifying-ca': {'v_range': [['7.4.2', '']], 'type': 'str'},
333 'cloud-authentication-access-key': {'v_range': [['7.4.3', '']], 'no_log': True, 'type': 'str'}
334 }
335 }
336 }
337
338 module_option_spec = get_module_arg_spec('full crud')
339 module_arg_spec.update(module_option_spec)
340 check_galaxy_version(module_arg_spec)
341 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'endpointcontrol_fctems'),
342 supports_check_mode=True)
343 if not module._socket_path:
344 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
345 connection = Connection(module._socket_path)
346 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
347 'name', 'data', module, connection)
348 fmgr.process_crud()
349 module.exit_json(meta=module.params)
350
351
352 if __name__ == '__main__':
353 main()