Debian Codegraph @

ansible_collections/fortinet/fortimanager/plugins/modules/fmgr_vpn_kmipserver.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_vpn_kmipserver
15 short_description: KMIP server entry configuration.
16 version_added: "2.12.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 vpn_kmipserver:
29 description: The top level parameters set.
30 required: false
31 type: dict
32 suboptions:
33 interface:
34 type: list
35 elements: str
36 description: Specify outgoing interface to reach server.
37 interface_select_method:
38 aliases: ['interface-select-method']
39 type: str
40 description: Specify how to select outgoing interface to reach server.
41 choices: ['auto', 'sdwan', 'specify']
42 name:
43 type: str
44 description: KMIP server entry name.
45 required: true
46 password:
47 type: list
48 elements: str
49 description: Password to use for connectivity to the KMIP server.
50 server_identity_check:
51 aliases: ['server-identity-check']
52 type: str
53 description: Enable/disable KMIP server identity check
54 choices: ['disable', 'enable']
55 server_list:
56 aliases: ['server-list']
57 type: list
58 elements: dict
59 description: Server list.
60 suboptions:
61 cert:
62 type: list
63 elements: str
64 description: Client certificate to use for connectivity to the KMIP server.
65 id:
66 type: int
67 description: ID
68 port:
69 type: int
70 description: KMIP server port.
71 server:
72 type: str
73 description: KMIP server FQDN or IP address.
74 status:
75 type: str
76 description: Enable/disable KMIP server.
77 choices: ['disable', 'enable']
78 source_ip:
79 aliases: ['source-ip']
80 type: str
81 description: FortiGate IP address to be used for communication with the KMIP server.
82 ssl_min_proto_version:
83 aliases: ['ssl-min-proto-version']
84 type: str
85 description: Minimum supported protocol version for SSL/TLS connections
86 choices: ['default', 'TLSv1', 'TLSv1-1', 'TLSv1-2', 'SSLv3', 'TLSv1-3']
87 username:
88 type: str
89 description: User name to use for connectivity to the KMIP server.
90 vrf_select:
91 aliases: ['vrf-select']
92 type: int
93 description: VRF ID used for connection to server.
94 '''
95
96 EXAMPLES = '''
97 - name: Example playbook (generated based on argument schema)
98 hosts: fortimanagers
99 connection: httpapi
100 gather_facts: false
101 tasks:
102 - name: KMIP server entry configuration.
103 fortinet.fortimanager.fmgr_vpn_kmipserver:
104 # workspace_locking_adom: <global or your adom name>
105 adom: <your own value>
106 state: present # <value in [present, absent]>
107 vpn_kmipserver:
108 name: "your value" # Required variable, string
109 # interface: <list or string>
110 # interface_select_method: <value in [auto, sdwan, specify]>
111 # password: <list or string>
112 # server_identity_check: <value in [disable, enable]>
113 # server_list:
114 # - cert: <list or string>
115 # id: <integer>
116 # port: <integer>
117 # server: <string>
118 # status: <value in [disable, enable]>
119 # source_ip: <string>
120 # ssl_min_proto_version: <value in [default, TLSv1, TLSv1-1, ...]>
121 # username: <string>
122 # vrf_select: <integer>
123 '''
124
125 RETURN = '''
126 meta:
127 description: The result of the request.
128 type: dict
129 returned: always
130 contains:
131 request_url:
132 description: The full url requested.
133 returned: always
134 type: str
135 sample: /sys/login/user
136 response_code:
137 description: The status of api request.
138 returned: always
139 type: int
140 sample: 0
141 response_data:
142 description: The api response.
143 type: list
144 returned: always
145 response_message:
146 description: The descriptive message of the api response.
147 type: str
148 returned: always
149 sample: OK.
150 system_information:
151 description: The information of the target system.
152 type: dict
153 returned: always
154 rc:
155 description: The status the request.
156 type: int
157 returned: always
158 sample: 0
159 version_check_warning:
160 description: Warning if the parameters used in the playbook are not supported by the current FortiManager version.
161 type: list
162 returned: complex
163 '''
164 from ansible.module_utils.basic import AnsibleModule
165 from ansible.module_utils.connection import Connection
166 from ansible_collections.fortinet.fortimanager.plugins.module_utils.napi import NAPIManager, check_galaxy_version, check_parameter_bypass
167 from ansible_collections.fortinet.fortimanager.plugins.module_utils.common import get_module_arg_spec
168
169
170 def main():
171 urls_list = [
172 '/pm/config/adom/{adom}/obj/vpn/kmip-server',
173 '/pm/config/global/obj/vpn/kmip-server'
174 ]
175 module_arg_spec = {
176 'adom': {'required': True, 'type': 'str'},
177 'revision_note': {'type': 'str'},
178 'vpn_kmipserver': {
179 'type': 'dict', 'v_range': [['7.6.4', '']],
180 'options': {
181 'interface': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
182 'interface-select-method': {'v_range': [['7.6.4', '']], 'choices': ['auto', 'sdwan', 'specify'], 'type': 'str'},
183 'name': {'v_range': [['7.6.4', '']], 'required': True, 'type': 'str'},
184 'password': {'v_range': [['7.6.4', '']], 'no_log': True, 'type': 'list', 'elements': 'str'},
185 'server-identity-check': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'},
186 'server-list': {
187 'v_range': [['7.6.4', '']],
188 'type': 'list',
189 'options': {
190 'cert': {'v_range': [['7.6.4', '']], 'type': 'list', 'elements': 'str'},
191 'id': {'v_range': [['7.6.4', '']], 'type': 'int'},
192 'port': {'v_range': [['7.6.4', '']], 'type': 'int'},
193 'server': {'v_range': [['7.6.4', '']], 'type': 'str'},
194 'status': {'v_range': [['7.6.4', '']], 'choices': ['disable', 'enable'], 'type': 'str'}
195 },
196 'elements': 'dict'
197 },
198 'source-ip': {'v_range': [['7.6.4', '']], 'type': 'str'},
199 'ssl-min-proto-version': {
200 'v_range': [['7.6.4', '']],
201 'choices': ['default', 'TLSv1', 'TLSv1-1', 'TLSv1-2', 'SSLv3', 'TLSv1-3'],
202 'type': 'str'
203 },
204 'username': {'v_range': [['7.6.4', '']], 'type': 'str'},
205 'vrf-select': {'v_range': [['7.6.4', '']], 'type': 'int'}
206 }
207 }
208 }
209
210 module_option_spec = get_module_arg_spec('full crud')
211 module_arg_spec.update(module_option_spec)
212 check_galaxy_version(module_arg_spec)
213 module = AnsibleModule(argument_spec=check_parameter_bypass(module_arg_spec, 'vpn_kmipserver'),
214 supports_check_mode=True)
215 if not module._socket_path:
216 module.fail_json(msg='MUST RUN IN HTTPAPI MODE')
217 connection = Connection(module._socket_path)
218 fmgr = NAPIManager('full crud', module_arg_spec, urls_list,
219 'name', 'data', module, connection)
220 fmgr.process_crud()
221 module.exit_json(meta=module.params)
222
223
224 if __name__ == '__main__':
225 main()