Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_pkg_authentication_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_pkg_authentication_setting
15 short_description: Configure authentication setting.
16 version_added: "2.1.0"
17 extends_documentation_fragment:
18 - fortinet.fortimanager.general
19 - fortinet.fortimanager.general.partial_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 pkg:
29 description: The parameter (pkg) in requested url.
30 type: str
31 required: true
32 pkg_authentication_setting:
33 description: The top level parameters set.
34 required: false
35 type: dict
36 suboptions:
37 active_auth_scheme:
38 aliases: ['active-auth-scheme']
39 type: str
40 description: Active authentication method
41 auth_https:
42 aliases: ['auth-https']
43 type: str
44 description: Enable/disable redirecting HTTP user authentication to HTTPS.
45 choices: ['disable', 'enable']
46 captive_portal:
47 aliases: ['captive-portal']
48 type: str
49 description: Captive portal host name.
50 captive_portal_ip:
51 aliases: ['captive-portal-ip']
52 type: str
53 description: Captive portal IP address.
54 captive_portal_ip6:
55 aliases: ['captive-portal-ip6']
56 type: str
57 description: Captive portal IPv6 address.
58 captive_portal_port:
59 aliases: ['captive-portal-port']
60 type: int
61 description: Captive portal port number
62 captive_portal_ssl_port:
63 aliases: ['captive-portal-ssl-port']
64 type: int
65 description: Captive portal SSL port number
66 captive_portal_type:
67 aliases: ['captive-portal-type']
68 type: str
69 description: Captive portal type.
70 choices: ['fqdn', 'ip']
71 captive_portal6:
72 aliases: ['captive-portal6']
73 type: str
74 description: IPv6 captive portal host name.
75 rewrite_https_port:
76 aliases: ['rewrite-https-port']
77 type: int
78 description: Rewrite to HTTPS port
79 sso_auth_scheme:
80 aliases: ['sso-auth-scheme']
81 type: str
82 description: Single-Sign-On authentication method
83 dev_range:
84 aliases: ['dev-range']
85 type: raw
86 description: (list or str) Address range for the IP based device query.
87 user_cert_ca:
88 aliases: ['user-cert-ca']
89 type: raw
90 description: (list or str) CA certificate used for client certificate verification.
91 cert_auth:
92 aliases: ['cert-auth']
93 type: str
94 description: Enable/disable redirecting certificate authentication to HTTPS portal.
95 choices: ['disable', 'enable']
96 cert_captive_portal:
97 aliases: ['cert-captive-portal']
98 type: str
99 description: Certificate captive portal host name.
100 cert_captive_portal_ip:
101 aliases: ['cert-captive-portal-ip']
102 type: str
103 description: Certificate captive portal IP address.
104 cert_captive_portal_port:
105 aliases: ['cert-captive-portal-port']
106 type: int
107 description: Certificate captive portal port number
108 cookie_max_age:
109 aliases: ['cookie-max-age']
110 type: int
111 description: Persistent web portal cookie maximum age in minutes
112 cookie_refresh_div:
113 aliases: ['cookie-refresh-div']
114 type: int
115 description: Refresh rate divider of persistent web portal cookie
116 ip_auth_cookie:
117 aliases: ['ip-auth-cookie']
118 type: str
119 description: Enable/disable persistent cookie on IP based web portal authentication
120 choices: ['disable', 'enable']
121 persistent_cookie:
122 aliases: ['persistent-cookie']
123 type: str
124 description: Enable/disable persistent cookie on web portal authentication
125 choices: ['disable', 'enable']
126 update_time:
127 aliases: ['update-time']
128 type: str
129 description: Time of the last update.
130 log_auth_request:
131 aliases: ['log-auth-request']
132 type: str
133 description: Log auth request.
134 choices: ['disable', 'enable']
135 '''
136
137 EXAMPLES = '''
138 - name: Example playbook (generated based on argument schema)
139 hosts: fortimanagers
140 connection: httpapi
141 gather_facts: false
142 tasks:
143 - name: Configure authentication setting.
144 fortinet.fortimanager.fmgr_pkg_authentication_setting:
145 # workspace_locking_adom: <global or your adom name>
146 adom: <your own value>
147 pkg: <your own value>
148 pkg_authentication_setting:
149 # active_auth_scheme: <string>
150 # auth_https: <value in [disable, enable]>
151 # captive_portal: <string>
152 # captive_portal_ip: <string>
153 # captive_portal_ip6: <string>
154 # captive_portal_port: <integer>
155 # captive_portal_ssl_port: <integer>
156 # captive_portal_type: <value in [fqdn, ip]>
157 # captive_portal6: <string>
158 # rewrite_https_port: <integer>
159 # sso_auth_scheme: <string>
160 # dev_range: <list or string>
161 # user_cert_ca: <list or string>
162 # cert_auth: <value in [disable, enable]>
163 # cert_captive_portal: <string>
164 # cert_captive_portal_ip: <string>
165 # cert_captive_portal_port: <integer>
166 # cookie_max_age: <integer>
167 # cookie_refresh_div: <integer>
168 # ip_auth_cookie: <value in [disable, enable]>
169 # persistent_cookie: <value in [disable, enable]>
170 # update_time: <string>
171 # log_auth_request: <value in [disable, enable]>
172 '''
173
174 RETURN = '''
175 meta:
176 description: The result of the request.
177 type: dict
178 returned: always
179 contains:
180 request_url:
181 description: The full url requested.
182 returned: always
183 type: str
184 sample: /sys/login/user
185 response_code:
186 description: The status of api request.
187 returned: always
188 type: int
189 sample: 0
190 response_data:
191 description: The api response.
192 type: list
193 returned: always
194 response_message:
195 description: The descriptive message of the api response.
196 type: str
197 returned: always
198 sample: OK.
199 system_information:
200 description: The information of the target system.
201 type: dict
202 returned: always
203 rc:
204 description: The status the request.
205 type: int
206 returned: always
207 sample: 0
208 version_check_warning:
209 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
210 type: list
211 returned: complex
212 '''
213 from ansible.module_utils.basic import AnsibleModule
214 from ansible.module_utils.connection import Connection
215 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
216 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
217
218
219 def main():
220 urls_list = [
221 '/pm/config/adom/{adom}/pkg/{pkg}/authentication/setting'
222 ]
223 module_arg_spec = {
224 'adom': {'required': True, 'type': 'str'},
225 'pkg': {'required': True, 'type': 'str'},
226 'revision_note': {'type': 'str'},
227 'pkg_authentication_setting': {
228 'type': 'dict', 'v_range': [['6.2.1', '']],
229 'options': {
230 'active-auth-scheme': {'v_range': [['6.2.1', '']], 'type': 'str'},
231 'auth-https': {'v_range': [['6.2.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
232 'captive-portal': {'v_range': [['6.2.1', '']], 'type': 'str'},
233 'captive-portal-ip': {'v_range': [['6.2.1', '']], 'type': 'str'},
234 'captive-portal-ip6': {'v_range': [['6.2.1', '']], 'type': 'str'},
235 'captive-portal-port': {'v_range': [['6.2.1', '']], 'type': 'int'},
236 'captive-portal-ssl-port': {'v_range': [['6.2.1', '']], 'type': 'int'},
237 'captive-portal-type': {'v_range': [['6.2.1', '']], 'choices': ['fqdn', 'ip'], 'type': 'str'},
238 'captive-portal6': {'v_range': [['6.2.1', '']], 'type': 'str'},
239 'rewrite-https-port': {'v_range': [['6.2.1', '7.6.2'], ['7.6.4', '']], 'type': 'int'},
240 'sso-auth-scheme': {'v_range': [['6.2.1', '']], 'type': 'str'},
241 'dev-range': {'v_range': [['7.0.0', '']], 'type': 'raw'},
242 'user-cert-ca': {'v_range': [['7.0.0', '']], 'type': 'raw'},
243 'cert-auth': {'v_range': [['7.0.1', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
244 'cert-captive-portal': {'v_range': [['7.0.1', '']], 'type': 'str'},
245 'cert-captive-portal-ip': {'v_range': [['7.0.1', '']], 'type': 'str'},
246 'cert-captive-portal-port': {'v_range': [['7.0.1', '']], 'type': 'int'},
247 'cookie-max-age': {'v_range': [['7.2.0', '']], 'type': 'int'},
248 'cookie-refresh-div': {'v_range': [['7.2.0', '']], 'type': 'int'},
249 'ip-auth-cookie': {'v_range': [['7.2.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
250 'persistent-cookie': {'v_range': [['7.2.0', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
251 'update-time': {'v_range': [['7.2.0', '']], 'type': 'str'},
252 'log-auth-request': {'v_range': [['7.4.8', '7.4.10'], ['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
253 }
254 }
255 }
256
257 module_option_spec = get_module_arg_spec('partial crud')
258 module_arg_spec.update(module_option_spec)
259 check_galaxy_version(module_arg_spec)
260 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'pkg_authentication_setting'),
261 supports_check_mode=True)
262 if not module._socket_path:
263 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
264 connection = Connection(module._socket_path)
265 fmgr = NAPIManager('partial crud', module_arg_spec, urls_list,
266 None, 'data', module, connection)
267 fmgr.process_partial_crud()
268 module.exit_json(meta=module.params)
269
270
271 if __name__ == '__main__':
272 main()