| 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 |
| 9 |
short_description: Resource module for networks |
| 10 |
description: |
| 11 |
- Manage operations create, update and delete of the resource networks. |
| 12 |
- Create a network. |
| 13 |
- Delete a network. |
| 14 |
- Update a network. |
| 15 |
version_added: '1.0.0' |
| 16 |
extends_documentation_fragment: |
| 17 |
- cisco.meraki.module |
| 18 |
author: Francisco Munoz (@fmunoz) |
| 19 |
options: |
| 20 |
copyFromNetworkId: |
| 21 |
description: The ID of the network to copy configuration from. Other provided |
| 22 |
parameters will override the copied configuration, except type which must match |
| 23 |
this network's type exactly. |
| 24 |
type: str |
| 25 |
enrollmentString: |
| 26 |
description: A unique identifier which can be used for device enrollment or easy |
| 27 |
access through the Meraki SM Registration page or the Self Service Portal. Please |
| 28 |
note that changing this field may cause existing bookmarks to break. |
| 29 |
type: str |
| 30 |
name: |
| 31 |
description: The name of the network. |
| 32 |
type: str |
| 33 |
networkId: |
| 34 |
description: NetworkId path parameter. Network ID. |
| 35 |
type: str |
| 36 |
notes: |
| 37 |
description: Add any notes or additional information about this network here. |
| 38 |
type: str |
| 39 |
organizationId: |
| 40 |
description: OrganizationId path parameter. Organization ID. |
| 41 |
type: str |
| 42 |
productTypes: |
| 43 |
description: The product type(s) of the new network. If more than one type is |
| 44 |
included, the network will be a combined network. |
| 45 |
elements: str |
| 46 |
type: list |
| 47 |
tags: |
| 48 |
description: A list of tags to be applied to the network. |
| 49 |
elements: str |
| 50 |
type: list |
| 51 |
timeZone: |
| 52 |
description: The timezone of the network. For a list of allowed timezones, please |
| 53 |
see the 'TZ' column in the table in <a target='_blank' href='https //en.wikipedia.org/wiki/List_of_tz_databas... |
| 54 |
article.</a>. |
| 55 |
type: str |
| 56 |
requirements: |
| 57 |
- meraki >= 2.4.9 |
| 58 |
- python >= 3.5 |
| 59 |
seealso: |
| 60 |
- name: Cisco Meraki documentation for networks createOrganizationNetwork |
| 61 |
description: Complete reference of the createOrganizationNetwork API. |
| 62 |
link: https://developer.cisco.com/meraki/api-v1/#!create-organization-network |
| 63 |
- name: Cisco Meraki documentation for networks deleteNetwork |
| 64 |
description: Complete reference of the deleteNetwork API. |
| 65 |
link: https://developer.cisco.com/meraki/api-v1/#!delete-network |
| 66 |
- name: Cisco Meraki documentation for networks updateNetwork |
| 67 |
description: Complete reference of the updateNetwork API. |
| 68 |
link: https://developer.cisco.com/meraki/api-v1/#!update-network |
| 69 |
notes: |
| 70 |
- SDK Method used are |
| 71 |
networks.Networks.create_organization_network, |
| 72 |
networks.Networks.delete_network, |
| 73 |
networks.Networks.update_network, |
| 74 |
- Paths used are |
| 75 |
post /organizations/{organizationId}/networks, |
| 76 |
delete /networks/{networkId}, |
| 77 |
put /networks/{networkId}, |
| 78 |
""" |
| 79 |
|
| 80 |
EXAMPLES = r""" |
| 81 |
- name: Update by id |
| 82 |
cisco.meraki.networks: |
| 83 |
meraki_api_key: "{{ meraki_api_key }}" |
| 84 |
meraki_base_url: "{{ meraki_base_url }}" |
| 85 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 86 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 87 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 88 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 89 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 90 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 91 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 92 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 93 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 94 |
meraki_output_log: "{{ meraki_output_log }}" |
| 95 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 96 |
meraki_log_path: "{{ meraki_log_path }}" |
| 97 |
meraki_print_console: "{{ meraki_print_console }}" |
| 98 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 99 |
meraki_simulate: "{{ meraki_simulate }}" |
| 100 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 101 |
meraki_caller: "{{ meraki_caller }}" |
| 102 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 103 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 104 |
state: present |
| 105 |
enrollmentString: my-enrollment-string |
| 106 |
name: Main Office |
| 107 |
networkId: string |
| 108 |
notes: Additional description of the network |
| 109 |
tags: |
| 110 |
- tag1 |
| 111 |
- tag2 |
| 112 |
timeZone: America/Los_Angeles |
| 113 |
- name: Delete by id |
| 114 |
cisco.meraki.networks: |
| 115 |
meraki_api_key: "{{ meraki_api_key }}" |
| 116 |
meraki_base_url: "{{ meraki_base_url }}" |
| 117 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 118 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 119 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 120 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 121 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 122 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 123 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 124 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 125 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 126 |
meraki_output_log: "{{ meraki_output_log }}" |
| 127 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 128 |
meraki_log_path: "{{ meraki_log_path }}" |
| 129 |
meraki_print_console: "{{ meraki_print_console }}" |
| 130 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 131 |
meraki_simulate: "{{ meraki_simulate }}" |
| 132 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 133 |
meraki_caller: "{{ meraki_caller }}" |
| 134 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 135 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 136 |
state: absent |
| 137 |
networkId: string |
| 138 |
- name: Create |
| 139 |
cisco.meraki.networks: |
| 140 |
meraki_api_key: "{{ meraki_api_key }}" |
| 141 |
meraki_base_url: "{{ meraki_base_url }}" |
| 142 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 143 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 144 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 145 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 146 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 147 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 148 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 149 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 150 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 151 |
meraki_output_log: "{{ meraki_output_log }}" |
| 152 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 153 |
meraki_log_path: "{{ meraki_log_path }}" |
| 154 |
meraki_print_console: "{{ meraki_print_console }}" |
| 155 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 156 |
meraki_simulate: "{{ meraki_simulate }}" |
| 157 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 158 |
meraki_caller: "{{ meraki_caller }}" |
| 159 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 160 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 161 |
state: present |
| 162 |
copyFromNetworkId: N_24329156 |
| 163 |
name: Main Office |
| 164 |
notes: Additional description of the network |
| 165 |
organizationId: string |
| 166 |
productTypes: |
| 167 |
- appliance |
| 168 |
- switch |
| 169 |
- wireless |
| 170 |
tags: |
| 171 |
- tag1 |
| 172 |
- tag2 |
| 173 |
timeZone: America/Los_Angeles |
| 174 |
""" |
| 175 |
RETURN = r""" |
| 176 |
meraki_response: |
| 177 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 178 |
returned: always |
| 179 |
type: dict |
| 180 |
sample: > |
| 181 |
{ |
| 182 |
"id": "string", |
| 183 |
"organizationId": "string", |
| 184 |
"name": "string", |
| 185 |
"productTypes": [ |
| 186 |
"string" |
| 187 |
], |
| 188 |
"timeZone": "string", |
| 189 |
"tags": [ |
| 190 |
"string" |
| 191 |
], |
| 192 |
"enrollmentString": "string", |
| 193 |
"url": "string", |
| 194 |
"notes": "string", |
| 195 |
"isBoundToConfigTemplate": true |
| 196 |
} |
| 197 |
""" |