Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_system_docker.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_docker
15 short_description: Docker host.
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_crud
20 options:
21 system_docker:
22 description: The top level parameters set.
23 required: false
24 type: dict
25 suboptions:
26 fortiportal:
27 type: str
28 description:
29 - Enable/disable container.
30 - disable - Disable setting.
31 - enable - Enable setting.
32 choices: ['disable', 'enable']
33 fortiwlm:
34 type: str
35 description:
36 - Enable/disable container.
37 - disable - Disable setting.
38 - enable - Enable setting.
39 choices: ['disable', 'enable']
40 sdwancontroller:
41 type: str
42 description:
43 - Enable/disable container.
44 - disable - Disable setting.
45 - enable - Enable setting.
46 choices: ['disable', 'enable']
47 status:
48 type: str
49 description:
50 - Enable and set registry.
51 - disable - Disable docker host service.
52 - enable - Enable production registry.
53 - qa - Enable QA test registry.
54 - dev - Enable QA test registry
55 choices: ['disable', 'enable', 'qa', 'dev']
56 cpu:
57 type: int
58 description: Cpu.
59 default_address_pool_base:
60 aliases: ['default-address-pool_base']
61 type: str
62 description: Set default-address-pool CIDR.
63 default_address_pool_size:
64 aliases: ['default-address-pool_size']
65 type: int
66 description: Set default-address-pool size.
67 fortiauthenticator:
68 type: str
69 description:
70 - Enable/disable container.
71 - disable - Disable setting.
72 - enable - Enable setting.
73 choices: ['disable', 'enable']
74 fortisigconverter:
75 type: str
76 description:
77 - Enable/disable container.
78 - disable - Disable setting.
79 - enable - Enable setting.
80 choices: ['disable', 'enable']
81 mem:
82 type: int
83 description: Max % RAM usage.
84 docker_user_login_max:
85 aliases: ['docker-user-login-max']
86 type: int
87 description: Max login session for docker users.
88 fortisoar:
89 type: str
90 description:
91 - Enable/disable container.
92 - disable - Disable setting.
93 - enable - Enable setting.
94 choices: ['disable', 'enable']
95 fortiaiops:
96 type: str
97 description:
98 - Enable/disable container.
99 - disable - Disable setting.
100 - enable - Enable setting.
101 choices: ['disable', 'enable']
102 policyanalyzer:
103 type: str
104 description:
105 - Enable/disable container.
106 - disable - Disable setting.
107 - enable - Enable setting.
108 choices: ['disable', 'enable']
109 universalconnector:
110 type: str
111 description:
112 - Enable/disable container.
113 - disable - Disable setting.
114 - enable - Enable setting.
115 choices: ['disable', 'enable']
116 fsmcollector:
117 type: str
118 description:
119 - Enable/disable container.
120 - disable - Disable setting.
121 - enable - Enable setting.
122 choices: ['disable', 'enable']
123 '''
124
125 EXAMPLES = '''
126 - name: Example playbook (generated based on argument schema)
127 hosts: fortimanagers
128 connection: httpapi
129 gather_facts: false
130 tasks:
131 - name: Docker host.
132 fortinet.fortimanager.fmgr_system_docker:
133 # workspace_locking_adom: <global or your adom name>
134 system_docker:
135 # fortiportal: <value in [disable, enable]>
136 # fortiwlm: <value in [disable, enable]>
137 # sdwancontroller: <value in [disable, enable]>
138 # status: <value in [disable, enable, qa, ...]>
139 # cpu: <integer>
140 # default_address_pool_base: <string>
141 # default_address_pool_size: <integer>
142 # fortiauthenticator: <value in [disable, enable]>
143 # fortisigconverter: <value in [disable, enable]>
144 # mem: <integer>
145 # docker_user_login_max: <integer>
146 # fortisoar: <value in [disable, enable]>
147 # fortiaiops: <value in [disable, enable]>
148 # policyanalyzer: <value in [disable, enable]>
149 # universalconnector: <value in [disable, enable]>
150 # fsmcollector: <value in [disable, enable]>
151 '''
152
153 RETURN = '''
154 meta:
155 description: The result of the request.
156 type: dict
157 returned: always
158 contains:
159 request_url:
160 description: The full url requested.
161 returned: always
162 type: str
163 sample: /sys/login/user
164 response_code:
165 description: The status of api request.
166 returned: always
167 type: int
168 sample: 0
169 response_data:
170 description: The api response.
171 type: list
172 returned: always
173 response_message:
174 description: The descriptive message of the api response.
175 type: str
176 returned: always
177 sample: OK.
178 system_information:
179 description: The information of the target system.
180 type: dict
181 returned: always
182 rc:
183 description: The status the request.
184 type: int
185 returned: always
186 sample: 0
187 version_check_warning:
188 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
189 type: list
190 returned: complex
191 '''
192 from ansible.module_utils.basic import AnsibleModule
193 from ansible.module_utils.connection import Connection
194 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
195 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
196
197
198 def main():
199 urls_list = [
200 '/cli/global/system/docker'
201 ]
202 module_arg_spec = {
203 'system_docker': {
204 'type': 'dict', 'v_range': [['6.4.0', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.7'], ['7.6.0', '7.6.3']],
205 'options': {
206 'fortiportal': {'v_range': [['6.4.0', '7.0.13'], ['7.2.0', '7.2.4'], ['7.4.0', '7.4.0']], 'choices': ['disable', 'enable'], 'type': 'str'},
207 'fortiwlm': {
208 'v_range': [['6.4.0', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.6'], ['7.6.0', '7.6.2']],
209 'choices': ['disable', 'enable'],
210 'type': 'str'
211 },
212 'sdwancontroller': {'v_range': [['6.4.0', '7.0.13']], 'choices': ['disable', 'enable'], 'type': 'str'},
213 'status': {
214 'v_range': [['6.4.0', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.7'], ['7.6.0', '7.6.3']],
215 'choices': ['disable', 'enable', 'qa', 'dev'],
216 'type': 'str'
217 },
218 'cpu': {'v_range': [['6.4.5', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.7'], ['7.6.0', '7.6.3']], 'type': 'int'},
219 'default-address-pool_base': {
220 'v_range': [['6.4.3', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.7'], ['7.6.0', '7.6.3']],
221 'type': 'str'
222 },
223 'default-address-pool_size': {
224 'v_range': [['6.4.3', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.7'], ['7.6.0', '7.6.3']],
225 'type': 'int'
226 },
227 'fortiauthenticator': {'v_range': [['6.4.3', '7.0.13'], ['7.2.0', '7.2.0']], 'choices': ['disable', 'enable'], 'type': 'str'},
228 'fortisigconverter': {
229 'v_range': [['6.4.3', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.7'], ['7.6.0', '7.6.3']],
230 'choices': ['disable', 'enable'],
231 'type': 'str'
232 },
233 'mem': {'v_range': [['6.4.5', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.7'], ['7.6.0', '7.6.3']], 'type': 'int'},
234 'docker-user-login-max': {'v_range': [['6.4.6', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.7'], ['7.6.0', '7.6.3']], 'type': 'int'},
235 'fortisoar': {
236 'v_range': [['7.0.0', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.6'], ['7.6.0', '7.6.2']],
237 'choices': ['disable', 'enable'],
238 'type': 'str'
239 },
240 'fortiaiops': {
241 'v_range': [['7.0.1', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.6'], ['7.6.0', '7.6.2']],
242 'choices': ['disable', 'enable'],
243 'type': 'str'
244 },
245 'policyanalyzer': {
246 'v_range': [['7.0.2', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.6'], ['7.6.0', '7.6.2']],
247 'choices': ['disable', 'enable'],
248 'type': 'str'
249 },
250 'universalconnector': {
251 'v_range': [['7.0.1', '7.0.13'], ['7.2.0', '7.2.10'], ['7.4.0', '7.4.7'], ['7.6.0', '7.6.3']],
252 'choices': ['disable', 'enable'],
253 'type': 'str'
254 },
255 'fsmcollector': {'v_range': [['7.0.1', '7.0.1']], 'choices': ['disable', 'enable'], 'type': 'str'}
256 }
257 }
258 }
259
260 module_option_spec = get_module_arg_spec('partial crud')
261 module_arg_spec.update(module_option_spec)
262 check_galaxy_version(module_arg_spec)
263 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'system_docker'),
264 supports_check_mode=True)
265 if not module._socket_path:
266 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
267 connection = Connection(module._socket_path)
268 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
269 None, 'data', module, connection)
270 fmgr.process_partial_crud()
271 module.exit_json(meta=module.params)
272
273
274 if __name__ == '__main__':
275 main()