Debian Codegraph @

ansible_collections/cisco/meraki/plugins/modules/networks_appliance_vlans.py

raw
1 #!/usr/bin/python
2 # -*- coding: utf-8 -*-
3
4 # Copyright (c) 2021, Cisco Systems
5 # GNU General Public License v3.0+ (see LICENSE or https://www.gnu.org/licenses/gpl-3.0.txt)
6
7 DOCUMENTATION = r"""
8 module: networks_appliance_vlans
9 short_description: Resource module for networks _appliance _vlans
10 description:
11 - Manage operations create, update and delete of the resource networks _appliance
12 _vlans.
13 - Add a VLAN.
14 - Delete a VLAN from a network.
15 - Update a VLAN.
16 version_added: '1.0.0'
17 extends_documentation_fragment:
18 - cisco.meraki.module
19 author: Francisco Munoz (@fmunoz)
20 options:
21 applianceIp:
22 description: The local IP of the appliance on the VLAN.
23 type: str
24 cidr:
25 description: CIDR of the pool of subnets. Applicable only for template network.
26 Each network bound to the template will automatically pick a subnet from this
27 pool to build its own VLAN.
28 type: str
29 dhcpBootFilename:
30 description: DHCP boot option for boot filename.
31 type: str
32 dhcpBootNextServer:
33 description: DHCP boot option to direct boot clients to the server to load the
34 boot file from.
35 type: str
36 dhcpBootOptionsEnabled:
37 description: Use DHCP boot options specified in other properties.
38 type: bool
39 dhcpHandling:
40 description: The appliance's handling of DHCP requests on this VLAN. One of 'Run
41 a DHCP server', 'Relay DHCP to another server' or 'Do not respond to DHCP requests'.
42 type: str
43 dhcpLeaseTime:
44 description: The term of DHCP leases if the appliance is running a DHCP server
45 on this VLAN. One of '30 minutes', '1 hour', '4 hours', '12 hours', '1 day'
46 or '1 week'.
47 type: str
48 dhcpOptions:
49 description: The list of DHCP options that will be included in DHCP responses.
50 Each object in the list should have "code", "type", and "value" properties.
51 elements: dict
52 suboptions:
53 code:
54 description: The code for the DHCP option. This should be an integer between
55 2 and 254.
56 type: str
57 type:
58 description: The type for the DHCP option. One of 'text', 'ip', 'hex' or 'integer'.
59 type: str
60 value:
61 description: The value for the DHCP option.
62 type: str
63 type: list
64 dhcpRelayServerIps:
65 description: The IPs (IPv4) of the DHCP servers that DHCP requests should be relayed
66 to. CIDR/subnet notation and hostnames are not supported.
67 elements: str
68 type: list
69 dnsNameservers:
70 description: The DNS nameservers used for DHCP responses, either "upstream_dns",
71 "google_dns", "opendns", or a newline seperated string of IP addresses or domain
72 names.
73 type: str
74 fixedIpAssignments:
75 description: The DHCP fixed IP assignments on the VLAN. This should be an object
76 that contains mappings from MAC addresses to objects that themselves each contain
77 "ip" and "name" string fields. See the sample request/response for more details.
78 type: dict
79 groupPolicyId:
80 description: The id of the desired group policy to apply to the VLAN.
81 type: str
82 id:
83 description: The VLAN ID of the new VLAN (must be between 1 and 4094).
84 type: str
85 ipv6:
86 description: IPv6 configuration on the VLAN.
87 suboptions:
88 enabled:
89 description: Enable IPv6 on VLAN.
90 type: bool
91 prefixAssignments:
92 description: Prefix assignments on the VLAN.
93 elements: dict
94 suboptions:
95 autonomous:
96 description: Auto assign a /64 prefix from the origin to the VLAN.
97 type: bool
98 disabled:
99 description: Disable the prefix assignment.
100 type: bool
101 origin:
102 description: The origin of the prefix.
103 suboptions:
104 interfaces:
105 description: Interfaces associated with the prefix.
106 elements: str
107 type: list
108 type:
109 description: Type of the origin.
110 type: str
111 type: dict
112 staticApplianceIp6:
113 description: Manual configuration of the IPv6 Appliance IP.
114 type: str
115 staticPrefix:
116 description: Manual configuration of a /64 prefix on the VLAN.
117 type: str
118 type: list
119 type: dict
120 mandatoryDhcp:
121 description: Mandatory DHCP will enforce that clients connecting to this VLAN
122 must use the IP address assigned by the DHCP server. Clients who use a static
123 IP address won't be able to associate. Only available on firmware versions 17.0
124 and above.
125 suboptions:
126 enabled:
127 description: Enable Mandatory DHCP on VLAN.
128 type: bool
129 type: dict
130 mask:
131 description: Mask used for the subnet of all bound to the template networks. Applicable
132 only for template network.
133 type: int
134 name:
135 description: The name of the new VLAN.
136 type: str
137 networkId:
138 description: NetworkId path parameter. Network ID.
139 type: str
140 reservedIpRanges:
141 description: The DHCP reserved IP ranges on the VLAN.
142 elements: dict
143 suboptions:
144 comment:
145 description: A text comment for the reserved range.
146 type: str
147 end:
148 description: The last IP in the reserved range.
149 type: str
150 start:
151 description: The first IP in the reserved range.
152 type: str
153 type: list
154 subnet:
155 description: The subnet of the VLAN.
156 type: str
157 templateVlanType:
158 description: Type of subnetting of the VLAN. Applicable only for template network.
159 type: str
160 vlanId:
161 description: VlanId path parameter. Vlan ID.
162 type: str
163 vpnNatSubnet:
164 description: The translated VPN subnet if VPN and VPN subnet translation are enabled
165 on the VLAN.
166 type: str
167 requirements:
168 - meraki >= 2.4.9
169 - python >= 3.5
170 seealso:
171 - name: Cisco Meraki documentation for appliance createNetworkApplianceVlan
172 description: Complete reference of the createNetworkApplianceVlan API.
173 link: https://developer.cisco.com/meraki/api-v1/#!create-network-appliance-vlan
174 - name: Cisco Meraki documentation for appliance deleteNetworkApplianceVlan
175 description: Complete reference of the deleteNetworkApplianceVlan API.
176 link: https://developer.cisco.com/meraki/api-v1/#!delete-network-appliance-vlan
177 - name: Cisco Meraki documentation for appliance updateNetworkApplianceVlan
178 description: Complete reference of the updateNetworkApplianceVlan API.
179 link: https://developer.cisco.com/meraki/api-v1/#!update-network-appliance-vlan
180 notes:
181 - SDK Method used are
182 appliance.Appliance.create_network_appliance_vlan,
183 appliance.Appliance.delete_network_appliance_vlan,
184 appliance.Appliance.update_network_appliance_vlan,
185 - Paths used are
186 post /networks/{networkId}/appliance/vlans,
187 delete /networks/{networkId}/appliance/vlans/{vlanId},
188 put /networks/{networkId}/appliance/vlans/{vlanId},
189 """
190
191 EXAMPLES = r"""
192 - name: Create
193 cisco.meraki.networks_appliance_vlans:
194 meraki_api_key: "{{ meraki_api_key }}"
195 meraki_base_url: "{{ meraki_base_url }}"
196 meraki_single_request_timeout: "{{ meraki_single_request_timeout }}"
197 meraki_certificate_path: "{{ meraki_certificate_path }}"
198 meraki_requests_proxy: "{{ meraki_requests_proxy }}"
199 meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}"
200 meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}"
201 meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}"
202 meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}"
203 meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}"
204 meraki_maximum_retries: "{{ meraki_maximum_retries }}"
205 meraki_output_log: "{{ meraki_output_log }}"
206 meraki_log_file_prefix: "{{ meraki_log_file_prefix }}"
207 meraki_log_path: "{{ meraki_log_path }}"
208 meraki_print_console: "{{ meraki_print_console }}"
209 meraki_suppress_logging: "{{ meraki_suppress_logging }}"
210 meraki_simulate: "{{ meraki_simulate }}"
211 meraki_be_geo_id: "{{ meraki_be_geo_id }}"
212 meraki_caller: "{{ meraki_caller }}"
213 meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}"
214 meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}"
215 state: present
216 applianceIp: 192.168.1.2
217 cidr: 192.168.1.0/24
218 dhcpBootFilename: sample.file
219 dhcpBootNextServer: 1.2.3.4
220 dhcpBootOptionsEnabled: true
221 dhcpHandling: Run a DHCP server
222 dhcpLeaseTime: 30 minutes
223 dhcpOptions:
224 - code: '3'
225 type: text
226 value: five
227 dhcpRelayServerIps:
228 - 192.168.1.0
229 - 192.168.128.0
230 groupPolicyId: '101'
231 id: '1234'
232 ipv6:
233 enabled: true
234 prefixAssignments:
235 - autonomous: false
236 disabled: false
237 origin:
238 interfaces:
239 - wan0
240 type: internet
241 staticApplianceIp6: 2001:db8:3c4d:15::1
242 staticPrefix: 2001:db8:3c4d:15::/64
243 mandatoryDhcp:
244 enabled: true
245 mask: 28
246 name: My VLAN
247 networkId: string
248 subnet: 192.168.1.0/24
249 templateVlanType: same
250 - name: Update by id
251 cisco.meraki.networks_appliance_vlans:
252 meraki_api_key: "{{ meraki_api_key }}"
253 meraki_base_url: "{{ meraki_base_url }}"
254 meraki_single_request_timeout: "{{ meraki_single_request_timeout }}"
255 meraki_certificate_path: "{{ meraki_certificate_path }}"
256 meraki_requests_proxy: "{{ meraki_requests_proxy }}"
257 meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}"
258 meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}"
259 meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}"
260 meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}"
261 meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}"
262 meraki_maximum_retries: "{{ meraki_maximum_retries }}"
263 meraki_output_log: "{{ meraki_output_log }}"
264 meraki_log_file_prefix: "{{ meraki_log_file_prefix }}"
265 meraki_log_path: "{{ meraki_log_path }}"
266 meraki_print_console: "{{ meraki_print_console }}"
267 meraki_suppress_logging: "{{ meraki_suppress_logging }}"
268 meraki_simulate: "{{ meraki_simulate }}"
269 meraki_be_geo_id: "{{ meraki_be_geo_id }}"
270 meraki_caller: "{{ meraki_caller }}"
271 meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}"
272 meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}"
273 state: present
274 adaptivePolicyGroupId: '1234'
275 applianceIp: 192.168.1.2
276 cidr: 192.168.1.0/24
277 dhcpBootFilename: sample.file
278 dhcpBootNextServer: 1.2.3.4
279 dhcpBootOptionsEnabled: false
280 dhcpHandling: Run a DHCP server
281 dhcpLeaseTime: 1 day
282 dhcpOptions:
283 - code: '5'
284 type: text
285 value: five
286 dhcpRelayServerIps:
287 - 192.168.1.0
288 - 192.168.128.0
289 dnsNameservers: google_dns
290 fixedIpAssignments:
291 22:33:44:55:66:77:
292 ip: 1.2.3.4
293 name: Some client name
294 groupPolicyId: '101'
295 ipv6:
296 enabled: true
297 prefixAssignments:
298 - autonomous: false
299 disabled: false
300 origin:
301 interfaces:
302 - wan0
303 type: internet
304 staticApplianceIp6: 2001:db8:3c4d:15::1
305 staticPrefix: 2001:db8:3c4d:15::/64
306 mandatoryDhcp:
307 enabled: true
308 mask: 28
309 name: My VLAN
310 networkId: string
311 reservedIpRanges:
312 - comment: A reserved IP range
313 end: 192.168.1.1
314 start: 192.168.1.0
315 subnet: 192.168.1.0/24
316 templateVlanType: same
317 uplinks:
318 - interface: wan1
319 nat:
320 enabled: true
321 vlanId: string
322 vpnNatSubnet: 192.168.1.0/24
323 vrf:
324 id: '1000'
325 name: VRF BLUE
326 - name: Delete by id
327 cisco.meraki.networks_appliance_vlans:
328 meraki_api_key: "{{ meraki_api_key }}"
329 meraki_base_url: "{{ meraki_base_url }}"
330 meraki_single_request_timeout: "{{ meraki_single_request_timeout }}"
331 meraki_certificate_path: "{{ meraki_certificate_path }}"
332 meraki_requests_proxy: "{{ meraki_requests_proxy }}"
333 meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}"
334 meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}"
335 meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}"
336 meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}"
337 meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}"
338 meraki_maximum_retries: "{{ meraki_maximum_retries }}"
339 meraki_output_log: "{{ meraki_output_log }}"
340 meraki_log_file_prefix: "{{ meraki_log_file_prefix }}"
341 meraki_log_path: "{{ meraki_log_path }}"
342 meraki_print_console: "{{ meraki_print_console }}"
343 meraki_suppress_logging: "{{ meraki_suppress_logging }}"
344 meraki_simulate: "{{ meraki_simulate }}"
345 meraki_be_geo_id: "{{ meraki_be_geo_id }}"
346 meraki_caller: "{{ meraki_caller }}"
347 meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}"
348 meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}"
349 state: absent
350 networkId: string
351 vlanId: string
352 """
353 RETURN = r"""
354 meraki_response:
355 description: A dictionary or list with the response returned by the Cisco Meraki Python SDK
356 returned: always
357 type: dict
358 sample: >
359 {
360 "id": "string",
361 "interfaceId": "string",
362 "name": "string",
363 "subnet": "string",
364 "applianceIp": "string",
365 "groupPolicyId": "string",
366 "templateVlanType": "string",
367 "cidr": "string",
368 "mask": 0,
369 "mandatoryDhcp": {
370 "enabled": true
371 },
372 "ipv6": {
373 "enabled": true,
374 "prefixAssignments": [
375 {
376 "autonomous": true,
377 "staticPrefix": "string",
378 "staticApplianceIp6": "string",
379 "origin": {
380 "type": "string",
381 "interfaces": [
382 "string"
383 ]
384 }
385 }
386 ]
387 }
388 }
389 """