Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_firewall_sslsshprofile_sslexempt.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_firewall_sslsshprofile_sslexempt
15 short_description: Servers to exempt from SSL inspection.
16 version_added: "2.0.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 ssl-ssh-profile:
29 description: Deprecated, please use "ssl_ssh_profile"
30 type: str
31 ssl_ssh_profile:
32 description: The parameter (ssl-ssh-profile) in requested url.
33 type: str
34 firewall_sslsshprofile_sslexempt:
35 description: The top level parameters set.
36 required: false
37 type: dict
38 suboptions:
39 address:
40 type: str
41 description: IPv4 address object.
42 address6:
43 type: str
44 description: IPv6 address object.
45 fortiguard_category:
46 aliases: ['fortiguard-category']
47 type: str
48 description: FortiGuard category ID.
49 id:
50 type: int
51 description: ID number.
52 required: true
53 regex:
54 type: str
55 description: Exempt servers by regular expression.
56 type:
57 type: str
58 description: Type of address object
59 choices: ['fortiguard-category', 'address', 'address6', 'wildcard-fqdn', 'regex',
60 'finger-print']
61 wildcard_fqdn:
62 aliases: ['wildcard-fqdn']
63 type: str
64 description: Exempt servers by wildcard FQDN.
65 finger_print_category:
66 aliases: ['finger-print-category']
67 type: str
68 description: Finger print platform.
69 choices: ['unknown', 'firefox', 'chrome', 'safari', 'edge', 'ie', 'android',
70 'ios', 'windows']
71 '''
72
73 EXAMPLES = '''
74 - name: Example playbook
75 hosts: fortimanagers
76 gather_facts: false
77 connection: httpapi
78 vars:
79 ansible_httpapi_use_ssl: true
80 ansible_httpapi_validate_certs: false
81 ansible_httpapi_port: 443
82 tasks:
83 - name: Servers to exempt from SSL inspection.
84 fortinet.fortimanager.fmgr_firewall_sslsshprofile_sslexempt:
85 bypass_validation: false
86 adom: ansible
87 ssl_ssh_profile: "ansible-test" # name
88 state: present
89 firewall_sslsshprofile_sslexempt:
90 id: 1
91 type: address6 # <value in [fortiguard-category, address, address6, ...]>
92
93 - name: Gathering fortimanager facts
94 hosts: fortimanagers
95 gather_facts: false
96 connection: httpapi
97 vars:
98 ansible_httpapi_use_ssl: true
99 ansible_httpapi_validate_certs: false
100 ansible_httpapi_port: 443
101 tasks:
102 - name: Retrieve all the servers to exempt from SSL inspection
103 fortinet.fortimanager.fmgr_fact:
104 facts:
105 selector: "firewall_sslsshprofile_sslexempt"
106 params:
107 adom: "ansible"
108 ssl_ssh_profile: "ansible-test" # name
109 ssl_exempt: "your_value"
110 '''
111
112 RETURN = '''
113 meta:
114 description: The result of the request.
115 type: dict
116 returned: always
117 contains:
118 request_url:
119 description: The full url requested.
120 returned: always
121 type: str
122 sample: /sys/login/user
123 response_code:
124 description: The status of api request.
125 returned: always
126 type: int
127 sample: 0
128 response_data:
129 description: The api response.
130 type: list
131 returned: always
132 response_message:
133 description: The descriptive message of the api response.
134 type: str
135 returned: always
136 sample: OK.
137 system_information:
138 description: The information of the target system.
139 type: dict
140 returned: always
141 rc:
142 description: The status the request.
143 type: int
144 returned: always
145 sample: 0
146 version_check_warning:
147 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
148 type: list
149 returned: complex
150 '''
151 from ansible.module_utils.basic import AnsibleModule
152 from ansible.module_utils.connection import Connection
153 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
154 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
155
156
157 def main():
158 urls_list = [
159 '/pm/config/adom/{adom}/obj/firewall/ssl-ssh-profile/{ssl-ssh-profile}/ssl-exempt',
160 '/pm/config/global/obj/firewall/ssl-ssh-profile/{ssl-ssh-profile}/ssl-exempt'
161 ]
162 module_arg_spec = {
163 'adom': {'required': True, 'type': 'str'},
164 'ssl-ssh-profile': {'type': 'str', 'api_name': 'ssl_ssh_profile'},
165 'ssl_ssh_profile': {'type': 'str'},
166 'revision_note': {'type': 'str'},
167 'firewall_sslsshprofile_sslexempt': {
168 'type': 'dict', 'v_range': [['6.0.0', '']],
169 'options': {
170 'address': {'type': 'str'},
171 'address6': {'type': 'str'},
172 'fortiguard-category': {'type': 'str'},
173 'id': {'required': True, 'type': 'int'},
174 'regex': {'type': 'str'},
175 'type': {'choices': ['fortiguard-category', 'address', 'address6', 'wildcard-fqdn', 'regex', 'finger-print'], 'type': 'str'},
176 'wildcard-fqdn': {'type': 'str'},
177 'finger-print-category': {
178 'v_range': [['7.4.8', '7.4.10'], ['7.6.4', '']],
179 'choices': ['unknown', 'firefox', 'chrome', 'safari', 'edge', 'ie', 'android', 'ios', 'windows'],
180 'type': 'str'
181 }
182 }
183 }
184 }
185
186 module_option_spec = get_module_arg_spec('full crud')
187 module_arg_spec.update(module_option_spec)
188 check_galaxy_version(module_arg_spec)
189 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'firewall_sslsshprofile_sslexempt'),
190 supports_check_mode=True)
191 if not module._socket_path:
192 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
193 connection = Connection(module._socket_path)
194 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
195 'id', 'data', module, connection)
196 fmgr.process_crud()
197 module.exit_json(meta=module.params)
198
199
200 if __name__ == '__main__':
201 main()