Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_locallog_setting.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_locallog_setting
15 short_description: Settings for locallog logging.
16 version_added: "2.0.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 system_locallog_setting:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 log_interval_dev_no_logging:
27 aliases: ['log-interval-dev-no-logging']
28 type: int
29 description: Interval in minute for logging the event of no logs received from a device.
30 log_interval_disk_full:
31 aliases: ['log-interval-disk-full']
32 type: int
33 description: Interval in minute for logging the event of disk full.
34 log_interval_gbday_exceeded:
35 aliases: ['log-interval-gbday-exceeded']
36 type: int
37 description: Interval in minute for logging the event of the GB/Day license exceeded.
38 log_daemon_crash:
39 aliases: ['log-daemon-crash']
40 type: str
41 description:
42 - Send a logmsg when a daemon crashes.
43 - disable - Disable setting.
44 - enable - Enable setting.
45 choices: ['disable', 'enable']
46 no_log_detection_threshold:
47 aliases: ['no-log-detection-threshold']
48 type: int
49 description: Time interval in minutes to trigger a local event message if no log data is received.
50 log_interval_adom_perf_stats:
51 aliases: ['log-interval-adom-perf-stats']
52 type: int
53 description: Interval in minute for logging the event of adom perf stats.
54 '''
55
56 EXAMPLES = '''
57 - name: Example playbook (generated based on argument schema)
58 hosts: fortimanagers
59 connection: httpapi
60 gather_facts: false
61 tasks:
62 - name: Settings for locallog logging.
63 fortinet.fortimanager.fmgr_system_locallog_setting:
64 # workspace_locking_adom: <global or your adom name>
65 system_locallog_setting:
66 # log_interval_dev_no_logging: <integer>
67 # log_interval_disk_full: <integer>
68 # log_interval_gbday_exceeded: <integer>
69 # log_daemon_crash: <value in [disable, enable]>
70 # no_log_detection_threshold: <integer>
71 # log_interval_adom_perf_stats: <integer>
72 '''
73
74 RETURN = '''
75 meta:
76 description: The result of the request.
77 type: dict
78 returned: always
79 contains:
80 request_url:
81 description: The full url requested.
82 returned: always
83 type: str
84 sample: /sys/login/user
85 response_code:
86 description: The status of api request.
87 returned: always
88 type: int
89 sample: 0
90 response_data:
91 description: The api response.
92 type: list
93 returned: always
94 response_message:
95 description: The descriptive message of the api response.
96 type: str
97 returned: always
98 sample: OK.
99 system_information:
100 description: The information of the target system.
101 type: dict
102 returned: always
103 rc:
104 description: The status the request.
105 type: int
106 returned: always
107 sample: 0
108 version_check_warning:
109 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
110 type: list
111 returned: complex
112 '''
113 from ansible.module_utils.basic import AnsibleModule
114 from ansible.module_utils.connection import Connection
115 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
116 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
117
118
119 def main():
120 urls_list = [
121 '/cli/global/system/locallog/setting'
122 ]
123 module_arg_spec = {
124 'system_locallog_setting': {
125 'type': 'dict', 'v_range': [['6.0.0', '']],
126 'options': {
127 'log-interval-dev-no-logging': {'type': 'int'},
128 'log-interval-disk-full': {'type': 'int'},
129 'log-interval-gbday-exceeded': {'type': 'int'},
130 'log-daemon-crash': {'v_range': [['7.2.2', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
131 'no-log-detection-threshold': {'v_range': [['7.2.4', '7.2.12'], ['7.4.2', '']], 'type': 'int'},
132 'log-interval-adom-perf-stats': {'v_range': [['7.4.0', '']], 'type': 'int'}
133 }
134 }
135 }
136
137 module_option_spec = get_module_arg_spec('partial crud')
138 module_arg_spec.update(module_option_spec)
139 check_galaxy_version(module_arg_spec)
140 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_locallog_setting'),
141 supports_check_mode=True)
142 if not module._socket_path:
143 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
144 connection = Connection(module._socket_path)
145 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
146 None, 'data', module, connection)
147 fmgr.process_partial_crud()
148 module.exit_json(meta=module.params)
149
150
151 if __name__ == '__main__':
152 main()