| 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_campus_gateway_clusters |
| 9 |
short_description: Resource module for networks _campus _gateway _clusters |
| 10 |
description: |
| 11 |
- Manage operations create and update of the resource networks _campus _gateway |
| 12 |
_clusters. |
| 13 |
- Create a cluster and add campus gateways to it. |
| 14 |
- Update a cluster and add/remove campus gateways to/from it. |
| 15 |
version_added: '1.0.0' |
| 16 |
extends_documentation_fragment: |
| 17 |
- cisco.meraki.module |
| 18 |
author: Francisco Munoz (@fmunoz) |
| 19 |
options: |
| 20 |
clusterId: |
| 21 |
description: ClusterId path parameter. Cluster ID. |
| 22 |
type: str |
| 23 |
devices: |
| 24 |
description: Devices to be added to the cluster. |
| 25 |
elements: dict |
| 26 |
suboptions: |
| 27 |
serial: |
| 28 |
description: Serial of the device. |
| 29 |
type: str |
| 30 |
tunnels: |
| 31 |
description: Tunnel settings of the device when tunnel interface of cluster |
| 32 |
is specified. |
| 33 |
elements: dict |
| 34 |
suboptions: |
| 35 |
addresses: |
| 36 |
description: Tunnel IP addresses of the device. |
| 37 |
elements: dict |
| 38 |
suboptions: |
| 39 |
address: |
| 40 |
description: IP address of the interface. |
| 41 |
type: str |
| 42 |
protocol: |
| 43 |
description: Protocol of the interface. |
| 44 |
type: str |
| 45 |
type: list |
| 46 |
interface: |
| 47 |
description: Tunnel interface name. |
| 48 |
type: str |
| 49 |
type: list |
| 50 |
uplinks: |
| 51 |
description: Uplink settings of the device when uplink assignment mode of |
| 52 |
cluster is static. |
| 53 |
elements: dict |
| 54 |
suboptions: |
| 55 |
addresses: |
| 56 |
description: Uplink IP addresses of the device. |
| 57 |
elements: dict |
| 58 |
suboptions: |
| 59 |
address: |
| 60 |
description: IP address of the interface. |
| 61 |
type: str |
| 62 |
protocol: |
| 63 |
description: Protocol of the interface. |
| 64 |
type: str |
| 65 |
type: list |
| 66 |
interface: |
| 67 |
description: Uplink interface name. |
| 68 |
type: str |
| 69 |
type: list |
| 70 |
type: list |
| 71 |
name: |
| 72 |
description: Name of the new cluster. |
| 73 |
type: str |
| 74 |
nameservers: |
| 75 |
description: Nameservers of the cluster. |
| 76 |
suboptions: |
| 77 |
addresses: |
| 78 |
description: Addresses of the nameservers. |
| 79 |
elements: str |
| 80 |
type: list |
| 81 |
type: dict |
| 82 |
networkId: |
| 83 |
description: NetworkId path parameter. Network ID. |
| 84 |
type: str |
| 85 |
notes: |
| 86 |
description: Notes about cluster with max size of 511 characters allowed. |
| 87 |
type: str |
| 88 |
portChannels: |
| 89 |
description: Port channel settings of the cluster. |
| 90 |
elements: dict |
| 91 |
suboptions: |
| 92 |
allowedVlans: |
| 93 |
description: Allowed VLANs of the port channel. |
| 94 |
type: str |
| 95 |
name: |
| 96 |
description: Name of the port channel. |
| 97 |
type: str |
| 98 |
vlan: |
| 99 |
description: VLAN ID of the port channel. |
| 100 |
type: int |
| 101 |
type: list |
| 102 |
tunnels: |
| 103 |
description: Tunnel interface settings of the cluster Reuse uplink or specify |
| 104 |
tunnel interface. |
| 105 |
elements: dict |
| 106 |
suboptions: |
| 107 |
addresses: |
| 108 |
description: Addresses of the interface. |
| 109 |
elements: dict |
| 110 |
suboptions: |
| 111 |
gateway: |
| 112 |
description: Gateway of the interface. |
| 113 |
type: str |
| 114 |
protocol: |
| 115 |
description: Protocol of the interface. |
| 116 |
type: str |
| 117 |
subnetMask: |
| 118 |
description: Subnet mask of the interface. |
| 119 |
type: str |
| 120 |
type: list |
| 121 |
interface: |
| 122 |
description: Interface identifier, should be set to tun1. Specify this interface |
| 123 |
only if uplink isn't reused as tunnel. |
| 124 |
type: str |
| 125 |
uplink: |
| 126 |
description: Uplink interface details if uplink is reused as tunnel. |
| 127 |
suboptions: |
| 128 |
interface: |
| 129 |
description: Uplink interface identifier. |
| 130 |
type: str |
| 131 |
type: dict |
| 132 |
vlan: |
| 133 |
description: VLAN ID of the interface. |
| 134 |
type: int |
| 135 |
type: list |
| 136 |
uplinks: |
| 137 |
description: Uplink interface settings of the cluster. |
| 138 |
elements: dict |
| 139 |
suboptions: |
| 140 |
addresses: |
| 141 |
description: Addresses of the interface. |
| 142 |
elements: dict |
| 143 |
suboptions: |
| 144 |
assignmentMode: |
| 145 |
description: Assignment mode of the interface. |
| 146 |
type: str |
| 147 |
gateway: |
| 148 |
description: Gateway of the interface when assignment mode is static. |
| 149 |
type: str |
| 150 |
protocol: |
| 151 |
description: Protocol of the interface when assignment mode is static. |
| 152 |
type: str |
| 153 |
subnetMask: |
| 154 |
description: Subnet mask of the interface when assignment mode is static. |
| 155 |
type: str |
| 156 |
type: list |
| 157 |
interface: |
| 158 |
description: Interface identifier, should be set to man1. |
| 159 |
type: str |
| 160 |
vlan: |
| 161 |
description: VLAN ID of the interface. |
| 162 |
type: int |
| 163 |
type: list |
| 164 |
requirements: |
| 165 |
- meraki >= 2.4.9 |
| 166 |
- python >= 3.5 |
| 167 |
seealso: |
| 168 |
- name: Cisco Meraki documentation for campusGateway createNetworkCampusGatewayCluster |
| 169 |
description: Complete reference of the createNetworkCampusGatewayCluster API. |
| 170 |
link: https://developer.cisco.com/meraki/api-v1/#!create-network-campus-gateway-cluster |
| 171 |
- name: Cisco Meraki documentation for campusGateway updateNetworkCampusGatewayCluster |
| 172 |
description: Complete reference of the updateNetworkCampusGatewayCluster API. |
| 173 |
link: https://developer.cisco.com/meraki/api-v1/#!update-network-campus-gateway-cluster |
| 174 |
notes: |
| 175 |
- SDK Method used are |
| 176 |
campus_gateway.CampusGateway.create_network_campus_gateway_cluster, |
| 177 |
campus_gateway.CampusGateway.update_network_campus_gateway_cluster, |
| 178 |
- Paths used are |
| 179 |
post /networks/{networkId}/campusGateway/clusters, |
| 180 |
put /networks/{networkId}/campusGateway/clusters/{clusterId}, |
| 181 |
""" |
| 182 |
|
| 183 |
EXAMPLES = r""" |
| 184 |
- name: Create |
| 185 |
cisco.meraki.networks_campus_gateway_clusters: |
| 186 |
meraki_api_key: "{{ meraki_api_key }}" |
| 187 |
meraki_base_url: "{{ meraki_base_url }}" |
| 188 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 189 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 190 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 191 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 192 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 193 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 194 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 195 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 196 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 197 |
meraki_output_log: "{{ meraki_output_log }}" |
| 198 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 199 |
meraki_log_path: "{{ meraki_log_path }}" |
| 200 |
meraki_print_console: "{{ meraki_print_console }}" |
| 201 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 202 |
meraki_simulate: "{{ meraki_simulate }}" |
| 203 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 204 |
meraki_caller: "{{ meraki_caller }}" |
| 205 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 206 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 207 |
state: present |
| 208 |
devices: |
| 209 |
- serial: Q234-ABCD-0001 |
| 210 |
tunnels: |
| 211 |
- addresses: |
| 212 |
- address: 6.2.6.7 |
| 213 |
protocol: ipv4 |
| 214 |
interface: tun1 |
| 215 |
uplinks: |
| 216 |
- addresses: |
| 217 |
- address: 5.1.2.3 |
| 218 |
protocol: ipv4 |
| 219 |
interface: man1 |
| 220 |
name: North Campus |
| 221 |
nameservers: |
| 222 |
addresses: |
| 223 |
- 8.8.8.8 |
| 224 |
- 8.8.4.4 |
| 225 |
networkId: string |
| 226 |
notes: This cluster is for New York Office |
| 227 |
portChannels: |
| 228 |
- allowedVlans: 10-20 |
| 229 |
name: Port-channel1 |
| 230 |
vlan: 25 |
| 231 |
tunnels: |
| 232 |
- addresses: |
| 233 |
- gateway: 2.3.5.6 |
| 234 |
protocol: ipv4 |
| 235 |
subnetMask: 255.255.255.0 |
| 236 |
interface: tun1 |
| 237 |
uplink: |
| 238 |
interface: man1 |
| 239 |
vlan: 6 |
| 240 |
uplinks: |
| 241 |
- addresses: |
| 242 |
- assignmentMode: static |
| 243 |
gateway: 1.2.3.5 |
| 244 |
protocol: ipv4 |
| 245 |
subnetMask: 255.255.255.0 |
| 246 |
interface: man1 |
| 247 |
vlan: 5 |
| 248 |
- name: Update by id |
| 249 |
cisco.meraki.networks_campus_gateway_clusters: |
| 250 |
meraki_api_key: "{{ meraki_api_key }}" |
| 251 |
meraki_base_url: "{{ meraki_base_url }}" |
| 252 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 253 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 254 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 255 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 256 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 257 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 258 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 259 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 260 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 261 |
meraki_output_log: "{{ meraki_output_log }}" |
| 262 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 263 |
meraki_log_path: "{{ meraki_log_path }}" |
| 264 |
meraki_print_console: "{{ meraki_print_console }}" |
| 265 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 266 |
meraki_simulate: "{{ meraki_simulate }}" |
| 267 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 268 |
meraki_caller: "{{ meraki_caller }}" |
| 269 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 270 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 271 |
state: present |
| 272 |
clusterId: string |
| 273 |
devices: |
| 274 |
- serial: Q234-ABCD-0001 |
| 275 |
tunnels: |
| 276 |
- addresses: |
| 277 |
- address: 6.2.6.7 |
| 278 |
protocol: ipv4 |
| 279 |
interface: tun1 |
| 280 |
uplinks: |
| 281 |
- addresses: |
| 282 |
- address: 5.1.2.3 |
| 283 |
protocol: ipv4 |
| 284 |
interface: man1 |
| 285 |
name: North Campus |
| 286 |
nameservers: |
| 287 |
addresses: |
| 288 |
- 8.8.8.8 |
| 289 |
- 8.8.4.4 |
| 290 |
networkId: string |
| 291 |
notes: This cluster is for New York Office |
| 292 |
portChannels: |
| 293 |
- allowedVlans: 10-20 |
| 294 |
name: Port-channel1 |
| 295 |
vlan: 25 |
| 296 |
tunnels: |
| 297 |
- addresses: |
| 298 |
- gateway: 2.3.5.6 |
| 299 |
protocol: ipv4 |
| 300 |
subnetMask: 255.255.255.0 |
| 301 |
interface: tun1 |
| 302 |
uplink: |
| 303 |
interface: man1 |
| 304 |
vlan: 6 |
| 305 |
uplinks: |
| 306 |
- addresses: |
| 307 |
- assignmentMode: static |
| 308 |
gateway: 1.2.3.5 |
| 309 |
protocol: ipv4 |
| 310 |
subnetMask: 255.255.255.0 |
| 311 |
interface: man1 |
| 312 |
vlan: 5 |
| 313 |
""" |
| 314 |
RETURN = r""" |
| 315 |
meraki_response: |
| 316 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 317 |
returned: always |
| 318 |
type: dict |
| 319 |
sample: > |
| 320 |
{ |
| 321 |
"clusterId": "string", |
| 322 |
"name": "string", |
| 323 |
"uplinks": [ |
| 324 |
{ |
| 325 |
"interface": "string", |
| 326 |
"vlan": 0, |
| 327 |
"addresses": [ |
| 328 |
{ |
| 329 |
"assignmentMode": "string", |
| 330 |
"protocol": "string", |
| 331 |
"gateway": "string", |
| 332 |
"subnetMask": "string" |
| 333 |
} |
| 334 |
] |
| 335 |
} |
| 336 |
], |
| 337 |
"tunnels": [ |
| 338 |
{ |
| 339 |
"uplink": { |
| 340 |
"interface": "string" |
| 341 |
}, |
| 342 |
"interface": "string", |
| 343 |
"vlan": 0, |
| 344 |
"addresses": [ |
| 345 |
{ |
| 346 |
"protocol": "string", |
| 347 |
"gateway": "string", |
| 348 |
"subnetMask": "string" |
| 349 |
} |
| 350 |
] |
| 351 |
} |
| 352 |
], |
| 353 |
"nameservers": { |
| 354 |
"addresses": [ |
| 355 |
"string" |
| 356 |
] |
| 357 |
}, |
| 358 |
"portChannels": [ |
| 359 |
{ |
| 360 |
"id": "string", |
| 361 |
"name": "string", |
| 362 |
"vlan": 0, |
| 363 |
"allowedVlans": "string" |
| 364 |
} |
| 365 |
], |
| 366 |
"devices": [ |
| 367 |
{ |
| 368 |
"serial": "string", |
| 369 |
"memberId": "string", |
| 370 |
"uplinks": [ |
| 371 |
{ |
| 372 |
"interface": "string", |
| 373 |
"addresses": [ |
| 374 |
{ |
| 375 |
"protocol": "string", |
| 376 |
"address": "string" |
| 377 |
} |
| 378 |
] |
| 379 |
} |
| 380 |
], |
| 381 |
"tunnels": [ |
| 382 |
{ |
| 383 |
"interface": "string", |
| 384 |
"addresses": [ |
| 385 |
{ |
| 386 |
"protocol": "string", |
| 387 |
"address": "string" |
| 388 |
} |
| 389 |
] |
| 390 |
} |
| 391 |
] |
| 392 |
} |
| 393 |
], |
| 394 |
"notes": "string", |
| 395 |
"url": "string" |
| 396 |
} |
| 397 |
""" |