Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_devprof_system_centralmanagement.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_devprof_system_centralmanagement
15 short_description: Configure central management.
16 version_added: "1.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 adom:
22 description: The parameter (adom) in requested url.
23 type: str
24 required: true
25 devprof:
26 description: The parameter (devprof) in requested url.
27 type: str
28 required: true
29 devprof_system_centralmanagement:
30 description: The top level parameters set.
31 required: false
32 type: dict
33 suboptions:
34 include_default_servers:
35 aliases: ['include-default-servers']
36 type: str
37 description: Enable/disable inclusion of public FortiGuard servers in the override server list.
38 choices: ['disable', 'enable']
39 server_list:
40 aliases: ['server-list']
41 type: list
42 elements: dict
43 description: Server list.
44 suboptions:
45 addr_type:
46 aliases: ['addr-type']
47 type: str
48 description: Indicate whether the FortiGate communicates with the override server using an IPv4 address, an IPv6 address or a FQDN.
49 choices: ['fqdn', 'ipv4', 'ipv6']
50 fqdn:
51 type: str
52 description: FQDN address of override server.
53 id:
54 type: int
55 description: ID.
56 server_address:
57 aliases: ['server-address']
58 type: str
59 description: IPv4 address of override server.
60 server_address6:
61 aliases: ['server-address6']
62 type: str
63 description: IPv6 address of override server.
64 server_type:
65 aliases: ['server-type']
66 type: list
67 elements: str
68 description: FortiGuard service type.
69 choices: ['update', 'rating', 'iot-query', 'iot-collect', 'vpatch-query']
70 ltefw_upgrade_time:
71 aliases: ['ltefw-upgrade-time']
72 type: str
73 description: Schedule next LTE firmware upgrade time
74 vdom:
75 type: raw
76 description: (list) Virtual domain
77 allow_remote_firmware_upgrade:
78 aliases: ['allow-remote-firmware-upgrade']
79 type: str
80 description: Enable/disable remotely upgrading the firmware on this FortiGate from the central management server.
81 choices: ['disable', 'enable']
82 local_cert:
83 aliases: ['local-cert']
84 type: str
85 description: Certificate to be used by FGFM protocol.
86 allow_push_firmware:
87 aliases: ['allow-push-firmware']
88 type: str
89 description: Enable/disable allowing the central management server to push firmware updates to this FortiGate.
90 choices: ['disable', 'enable']
91 ltefw_upgrade_frequency:
92 aliases: ['ltefw-upgrade-frequency']
93 type: str
94 description: Set LTE firmware auto pushdown frequency.
95 choices: ['everyHour', 'every12hour', 'everyDay', 'everyWeek']
96 mode:
97 type: str
98 description: Central management mode.
99 choices: ['normal', 'backup']
100 serial_number:
101 aliases: ['serial-number']
102 type: raw
103 description: (list) Serial number.
104 fmg_source_ip6:
105 aliases: ['fmg-source-ip6']
106 type: str
107 description: IPv6 source address that this FortiGate uses when communicating with FortiManager.
108 allow_monitor:
109 aliases: ['allow-monitor']
110 type: str
111 description: Enable/disable allowing the central management server to remotely monitor this FortiGate unit.
112 choices: ['disable', 'enable']
113 allow_push_configuration:
114 aliases: ['allow-push-configuration']
115 type: str
116 description: Enable/disable allowing the central management server to push configuration changes to this FortiGate.
117 choices: ['disable', 'enable']
118 ca_cert:
119 aliases: ['ca-cert']
120 type: str
121 description: CA certificate to be used by FGFM protocol.
122 fmg_update_port:
123 aliases: ['fmg-update-port']
124 type: str
125 description: Port used to communicate with FortiManager that is acting as a FortiGuard update server.
126 choices: ['443', '8890']
127 use_elbc_vdom:
128 aliases: ['use-elbc-vdom']
129 type: str
130 description: Enable/disable use of special ELBC config sync VDOM to connect to FortiManager.
131 choices: ['disable', 'enable']
132 allow_remote_lte_firmware_upgrade:
133 aliases: ['allow-remote-lte-firmware-upgrade']
134 type: str
135 description: Enable/disable remotely upgrading the lte firmware on this FortiGate from the central management server.
136 choices: ['disable', 'enable']
137 interface:
138 type: raw
139 description: (list) Specify outgoing interface to reach server.
140 schedule_script_restore:
141 aliases: ['schedule-script-restore']
142 type: str
143 description: Enable/disable allowing the central management server to restore the scripts stored on this FortiGate.
144 choices: ['disable', 'enable']
145 schedule_config_restore:
146 aliases: ['schedule-config-restore']
147 type: str
148 description: Enable/disable allowing the central management server to restore the configuration of this FortiGate.
149 choices: ['disable', 'enable']
150 interface_select_method:
151 aliases: ['interface-select-method']
152 type: str
153 description: Specify how to select outgoing interface to reach server.
154 choices: ['auto', 'sdwan', 'specify']
155 type:
156 type: str
157 description: Central management type.
158 choices: ['fortimanager', 'fortiguard', 'none']
159 fmg_source_ip:
160 aliases: ['fmg-source-ip']
161 type: str
162 description: IPv4 source address that this FortiGate uses when communicating with FortiManager.
163 fortigate_cloud_sso_default_profile:
164 aliases: ['fortigate-cloud-sso-default-profile']
165 type: raw
166 description: (list) Override access profile.
167 fmg:
168 type: raw
169 description: (list) IP address or FQDN of the FortiManager.
170 enc_algorithm:
171 aliases: ['enc-algorithm']
172 type: str
173 description: Encryption strength for communications between the FortiGate and central management.
174 choices: ['default', 'high', 'low']
175 allow_remote_modem_firmware_upgrade:
176 aliases: ['allow-remote-modem-firmware-upgrade']
177 type: str
178 description: Enable/disable remotely upgrading the internal cellular modem firmware on this FortiGate from the central management server.
179 choices: ['disable', 'enable']
180 modem_upgrade_frequency:
181 aliases: ['modem-upgrade-frequency']
182 type: str
183 description: Set internal cellular modem firmware auto pushdown frequency.
184 choices: ['everyHour', 'every12hour', 'everyDay', 'everyWeek']
185 modem_upgrade_time:
186 aliases: ['modem-upgrade-time']
187 type: str
188 description: Schedule next internal cellular modem firmware upgrade time
189 vrf_select:
190 aliases: ['vrf-select']
191 type: int
192 description: VRF ID used for connection to server.
193 fmg_update_http_header:
194 aliases: ['fmg-update-http-header']
195 type: str
196 description: Enable/disable inclusion of HTTP header in update request.
197 choices: ['disable', 'enable']
198 '''
199
200 EXAMPLES = '''
201 - name: Example playbook (generated based on argument schema)
202 hosts: fortimanagers
203 connection: httpapi
204 gather_facts: false
205 tasks:
206 - name: Configure central management.
207 fortinet.fortimanager.fmgr_devprof_system_centralmanagement:
208 # workspace_locking_adom: <global or your adom name>
209 adom: <your own value>
210 devprof: <your own value>
211 devprof_system_centralmanagement:
212 # include_default_servers: <value in [disable, enable]>
213 # server_list:
214 # - addr_type: <value in [fqdn, ipv4, ipv6]>
215 # fqdn: <string>
216 # id: <integer>
217 # server_address: <string>
218 # server_address6: <string>
219 # server_type: ["update", "rating", "iot-query", "iot-collect", "vpatch-query"]
220 # ltefw_upgrade_time: <string>
221 # vdom: <list or string>
222 # allow_remote_firmware_upgrade: <value in [disable, enable]>
223 # local_cert: <string>
224 # allow_push_firmware: <value in [disable, enable]>
225 # ltefw_upgrade_frequency: <value in [everyHour, every12hour, everyDay, ...]>
226 # mode: <value in [normal, backup]>
227 # serial_number: <list or string>
228 # fmg_source_ip6: <string>
229 # allow_monitor: <value in [disable, enable]>
230 # allow_push_configuration: <value in [disable, enable]>
231 # ca_cert: <string>
232 # fmg_update_port: <value in [443, 8890]>
233 # use_elbc_vdom: <value in [disable, enable]>
234 # allow_remote_lte_firmware_upgrade: <value in [disable, enable]>
235 # interface: <list or string>
236 # schedule_script_restore: <value in [disable, enable]>
237 # schedule_config_restore: <value in [disable, enable]>
238 # interface_select_method: <value in [auto, sdwan, specify]>
239 # type: <value in [fortimanager, fortiguard, none]>
240 # fmg_source_ip: <string>
241 # fortigate_cloud_sso_default_profile: <list or string>
242 # fmg: <list or string>
243 # enc_algorithm: <value in [default, high, low]>
244 # allow_remote_modem_firmware_upgrade: <value in [disable, enable]>
245 # modem_upgrade_frequency: <value in [everyHour, every12hour, everyDay, ...]>
246 # modem_upgrade_time: <string>
247 # vrf_select: <integer>
248 # fmg_update_http_header: <value in [disable, enable]>
249 '''
250
251 RETURN = '''
252 meta:
253 description: The result of the request.
254 type: dict
255 returned: always
256 contains:
257 request_url:
258 description: The full url requested.
259 returned: always
260 type: str
261 sample: /sys/login/user
262 response_code:
263 description: The status of api request.
264 returned: always
265 type: int
266 sample: 0
267 response_data:
268 description: The api response.
269 type: list
270 returned: always
271 response_message:
272 description: The descriptive message of the api response.
273 type: str
274 returned: always
275 sample: OK.
276 system_information:
277 description: The information of the target system.
278 type: dict
279 returned: always
280 rc:
281 description: The status the request.
282 type: int
283 returned: always
284 sample: 0
285 version_check_warning:
286 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
287 type: list
288 returned: complex
289 '''
290 from ansible.module_utils.basic import AnsibleModule
291 from ansible.module_utils.connection import Connection
292 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
293 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
294
295
296 def main():
297 urls_list = [
298 '/pm/config/adom/{adom}/devprof/{devprof}/system/central-management'
299 ]
300 module_arg_spec = {
301 'adom': {'required': True, 'type': 'str'},
302 'devprof': {'required': True, 'type': 'str'},
303 'devprof_system_centralmanagement': {
304 'type': 'dict', 'v_range': [['6.0.0', '6.2.5'], ['6.2.7', '6.4.1'], ['6.4.3', '']],
305 'options': {
306 'include-default-servers': {
307 'v_range': [['6.0.0', '6.2.5'], ['6.2.7', '6.4.1'], ['6.4.3', '']],
308 'choices': ['disable', 'enable'],
309 'type': 'str'
310 },
311 'server-list': {
312 'v_range': [['6.0.0', '6.2.5'], ['6.2.7', '6.4.1'], ['6.4.3', '']],
313 'type': 'list',
314 'options': {
315 'addr-type': {
316 'v_range': [['6.0.0', '6.2.5'], ['6.2.7', '6.4.1'], ['6.4.3', '']],
317 'choices': ['fqdn', 'ipv4', 'ipv6'],
318 'type': 'str'
319 },
320 'fqdn': {'v_range': [['6.0.0', '6.2.5'], ['6.2.7', '6.4.1'], ['6.4.3', '']], 'type': 'str'},
321 'id': {'v_range': [['6.0.0', '6.2.5'], ['6.2.7', '6.4.1'], ['6.4.3', '']], 'type': 'int'},
322 'server-address': {'v_range': [['6.0.0', '6.2.5'], ['6.2.7', '6.4.1'], ['6.4.3', '']], 'type': 'str'},
323 'server-address6': {'v_range': [['6.0.0', '6.2.5'], ['6.2.7', '6.4.1'], ['6.4.3', '']], 'type': 'str'},
324 'server-type': {
325 'v_range': [['6.0.0', '6.2.5'], ['6.2.7', '6.4.1'], ['6.4.3', '']],
326 'type': 'list',
327 'choices': ['update', 'rating', 'iot-query', 'iot-collect', 'vpatch-query'],
328 'elements': 'str'
329 }
330 },
331 'elements': 'dict'
332 },
333 'ltefw-upgrade-time': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
334 'vdom': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'raw'},
335 'allow-remote-firmware-upgrade': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
336 'local-cert': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
337 'allow-push-firmware': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
338 'ltefw-upgrade-frequency': {
339 'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']],
340 'choices': ['everyHour', 'every12hour', 'everyDay', 'everyWeek'],
341 'type': 'str'
342 },
343 'mode': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['normal', 'backup'], 'type': 'str'},
344 'serial-number': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'raw'},
345 'fmg-source-ip6': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
346 'allow-monitor': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
347 'allow-push-configuration': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
348 'ca-cert': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
349 'fmg-update-port': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['443', '8890'], 'type': 'str'},
350 'use-elbc-vdom': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
351 'allow-remote-lte-firmware-upgrade': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
352 'interface': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'raw'},
353 'schedule-script-restore': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
354 'schedule-config-restore': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
355 'interface-select-method': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['auto', 'sdwan', 'specify'], 'type': 'str'},
356 'type': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['fortimanager', 'fortiguard', 'none'], 'type': 'str'},
357 'fmg-source-ip': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
358 'fortigate-cloud-sso-default-profile': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'raw'},
359 'fmg': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'raw'},
360 'enc-algorithm': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['default', 'high', 'low'], 'type': 'str'},
361 'allow-remote-modem-firmware-upgrade': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
362 'modem-upgrade-frequency': {
363 'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']],
364 'choices': ['everyHour', 'every12hour', 'everyDay', 'everyWeek'],
365 'type': 'str'
366 },
367 'modem-upgrade-time': {'v_range': [['7.2.6', '7.2.12'], ['7.4.3', '']], 'type': 'str'},
368 'vrf-select': {'v_range': [['7.6.2', '']], 'type': 'int'},
369 'fmg-update-http-header': {'v_range': [['7.6.3', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
370 }
371 }
372 }
373
374 module_option_spec = get_module_arg_spec('partial crud')
375 module_arg_spec.update(module_option_spec)
376 check_galaxy_version(module_arg_spec)
377 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'devprof_system_centralmanagement'),
378 supports_check_mode=True)
379 if not module._socket_path:
380 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
381 connection = Connection(module._socket_path)
382 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
383 None, 'data', module, connection)
384 fmgr.process_partial_crud()
385 module.exit_json(meta=module.params)
386
387
388 if __name__ == '__main__':
389 main()