| 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_clients_provision |
| 9 |
short_description: Resource module for networks _clients _provision |
| 10 |
description: |
| 11 |
- Manage operation create of the resource networks _clients _provision. |
| 12 |
- Provisions a client with a name and policy. Clients can be provisioned before |
| 13 |
they associate to the network. |
| 14 |
version_added: '1.0.0' |
| 15 |
extends_documentation_fragment: |
| 16 |
- cisco.meraki.module |
| 17 |
author: Francisco Munoz (@fmunoz) |
| 18 |
options: |
| 19 |
clients: |
| 20 |
description: The array of clients to provision. |
| 21 |
elements: dict |
| 22 |
suboptions: |
| 23 |
mac: |
| 24 |
description: The MAC address of the client. Required. |
| 25 |
type: str |
| 26 |
name: |
| 27 |
description: The display name for the client. Optional. Limited to 255 bytes. |
| 28 |
type: str |
| 29 |
type: list |
| 30 |
devicePolicy: |
| 31 |
description: The policy to apply to the specified client. Can be 'Group policy', |
| 32 |
'Allowed', 'Blocked', 'Per connection' or 'Normal'. Required. |
| 33 |
type: str |
| 34 |
groupPolicyId: |
| 35 |
description: The ID of the desired group policy to apply to the client. Required |
| 36 |
if 'devicePolicy' is set to "Group policy". Otherwise this is ignored. |
| 37 |
type: str |
| 38 |
networkId: |
| 39 |
description: NetworkId path parameter. Network ID. |
| 40 |
type: str |
| 41 |
policiesBySecurityAppliance: |
| 42 |
description: An object, describing what the policy-connection association is for |
| 43 |
the security appliance. (Only relevant if the security appliance is actually |
| 44 |
within the network). |
| 45 |
suboptions: |
| 46 |
devicePolicy: |
| 47 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 48 |
'Blocked' or 'Normal'. Required. |
| 49 |
type: str |
| 50 |
type: dict |
| 51 |
policiesBySsid: |
| 52 |
description: An object, describing the policy-connection associations for each |
| 53 |
active SSID within the network. Keys should be the number of enabled SSIDs, |
| 54 |
mapping to an object describing the client's policy. |
| 55 |
suboptions: |
| 56 |
'0': |
| 57 |
description: The number for the SSID. |
| 58 |
suboptions: |
| 59 |
devicePolicy: |
| 60 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 61 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 62 |
type: str |
| 63 |
groupPolicyId: |
| 64 |
description: The ID of the desired group policy to apply to the client. |
| 65 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 66 |
is ignored. |
| 67 |
type: str |
| 68 |
type: dict |
| 69 |
'1': |
| 70 |
description: The number for the SSID. |
| 71 |
suboptions: |
| 72 |
devicePolicy: |
| 73 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 74 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 75 |
type: str |
| 76 |
groupPolicyId: |
| 77 |
description: The ID of the desired group policy to apply to the client. |
| 78 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 79 |
is ignored. |
| 80 |
type: str |
| 81 |
type: dict |
| 82 |
'10': |
| 83 |
description: The number for the SSID. |
| 84 |
suboptions: |
| 85 |
devicePolicy: |
| 86 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 87 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 88 |
type: str |
| 89 |
groupPolicyId: |
| 90 |
description: The ID of the desired group policy to apply to the client. |
| 91 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 92 |
is ignored. |
| 93 |
type: str |
| 94 |
type: dict |
| 95 |
'11': |
| 96 |
description: The number for the SSID. |
| 97 |
suboptions: |
| 98 |
devicePolicy: |
| 99 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 100 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 101 |
type: str |
| 102 |
groupPolicyId: |
| 103 |
description: The ID of the desired group policy to apply to the client. |
| 104 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 105 |
is ignored. |
| 106 |
type: str |
| 107 |
type: dict |
| 108 |
'12': |
| 109 |
description: The number for the SSID. |
| 110 |
suboptions: |
| 111 |
devicePolicy: |
| 112 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 113 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 114 |
type: str |
| 115 |
groupPolicyId: |
| 116 |
description: The ID of the desired group policy to apply to the client. |
| 117 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 118 |
is ignored. |
| 119 |
type: str |
| 120 |
type: dict |
| 121 |
'13': |
| 122 |
description: The number for the SSID. |
| 123 |
suboptions: |
| 124 |
devicePolicy: |
| 125 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 126 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 127 |
type: str |
| 128 |
groupPolicyId: |
| 129 |
description: The ID of the desired group policy to apply to the client. |
| 130 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 131 |
is ignored. |
| 132 |
type: str |
| 133 |
type: dict |
| 134 |
'14': |
| 135 |
description: The number for the SSID. |
| 136 |
suboptions: |
| 137 |
devicePolicy: |
| 138 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 139 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 140 |
type: str |
| 141 |
groupPolicyId: |
| 142 |
description: The ID of the desired group policy to apply to the client. |
| 143 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 144 |
is ignored. |
| 145 |
type: str |
| 146 |
type: dict |
| 147 |
'2': |
| 148 |
description: The number for the SSID. |
| 149 |
suboptions: |
| 150 |
devicePolicy: |
| 151 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 152 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 153 |
type: str |
| 154 |
groupPolicyId: |
| 155 |
description: The ID of the desired group policy to apply to the client. |
| 156 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 157 |
is ignored. |
| 158 |
type: str |
| 159 |
type: dict |
| 160 |
'3': |
| 161 |
description: The number for the SSID. |
| 162 |
suboptions: |
| 163 |
devicePolicy: |
| 164 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 165 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 166 |
type: str |
| 167 |
groupPolicyId: |
| 168 |
description: The ID of the desired group policy to apply to the client. |
| 169 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 170 |
is ignored. |
| 171 |
type: str |
| 172 |
type: dict |
| 173 |
'4': |
| 174 |
description: The number for the SSID. |
| 175 |
suboptions: |
| 176 |
devicePolicy: |
| 177 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 178 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 179 |
type: str |
| 180 |
groupPolicyId: |
| 181 |
description: The ID of the desired group policy to apply to the client. |
| 182 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 183 |
is ignored. |
| 184 |
type: str |
| 185 |
type: dict |
| 186 |
'5': |
| 187 |
description: The number for the SSID. |
| 188 |
suboptions: |
| 189 |
devicePolicy: |
| 190 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 191 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 192 |
type: str |
| 193 |
groupPolicyId: |
| 194 |
description: The ID of the desired group policy to apply to the client. |
| 195 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 196 |
is ignored. |
| 197 |
type: str |
| 198 |
type: dict |
| 199 |
'6': |
| 200 |
description: The number for the SSID. |
| 201 |
suboptions: |
| 202 |
devicePolicy: |
| 203 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 204 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 205 |
type: str |
| 206 |
groupPolicyId: |
| 207 |
description: The ID of the desired group policy to apply to the client. |
| 208 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 209 |
is ignored. |
| 210 |
type: str |
| 211 |
type: dict |
| 212 |
'7': |
| 213 |
description: The number for the SSID. |
| 214 |
suboptions: |
| 215 |
devicePolicy: |
| 216 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 217 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 218 |
type: str |
| 219 |
groupPolicyId: |
| 220 |
description: The ID of the desired group policy to apply to the client. |
| 221 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 222 |
is ignored. |
| 223 |
type: str |
| 224 |
type: dict |
| 225 |
'8': |
| 226 |
description: The number for the SSID. |
| 227 |
suboptions: |
| 228 |
devicePolicy: |
| 229 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 230 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 231 |
type: str |
| 232 |
groupPolicyId: |
| 233 |
description: The ID of the desired group policy to apply to the client. |
| 234 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 235 |
is ignored. |
| 236 |
type: str |
| 237 |
type: dict |
| 238 |
'9': |
| 239 |
description: The number for the SSID. |
| 240 |
suboptions: |
| 241 |
devicePolicy: |
| 242 |
description: The policy to apply to the specified client. Can be 'Allowed', |
| 243 |
'Blocked', 'Normal' or 'Group policy'. Required. |
| 244 |
type: str |
| 245 |
groupPolicyId: |
| 246 |
description: The ID of the desired group policy to apply to the client. |
| 247 |
Required if 'devicePolicy' is set to "Group policy". Otherwise this |
| 248 |
is ignored. |
| 249 |
type: str |
| 250 |
type: dict |
| 251 |
type: dict |
| 252 |
requirements: |
| 253 |
- meraki >= 2.4.9 |
| 254 |
- python >= 3.5 |
| 255 |
seealso: |
| 256 |
- name: Cisco Meraki documentation for networks provisionNetworkClients |
| 257 |
description: Complete reference of the provisionNetworkClients API. |
| 258 |
link: https://developer.cisco.com/meraki/api-v1/#!provision-network-clients |
| 259 |
notes: |
| 260 |
- SDK Method used are |
| 261 |
networks.Networks.provision_network_clients, |
| 262 |
- Paths used are |
| 263 |
post /networks/{networkId}/clients/provision, |
| 264 |
""" |
| 265 |
|
| 266 |
EXAMPLES = r""" |
| 267 |
- name: Create |
| 268 |
cisco.meraki.networks_clients_provision: |
| 269 |
meraki_api_key: "{{ meraki_api_key }}" |
| 270 |
meraki_base_url: "{{ meraki_base_url }}" |
| 271 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 272 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 273 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 274 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 275 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 276 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 277 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 278 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 279 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 280 |
meraki_output_log: "{{ meraki_output_log }}" |
| 281 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 282 |
meraki_log_path: "{{ meraki_log_path }}" |
| 283 |
meraki_print_console: "{{ meraki_print_console }}" |
| 284 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 285 |
meraki_simulate: "{{ meraki_simulate }}" |
| 286 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 287 |
meraki_caller: "{{ meraki_caller }}" |
| 288 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 289 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 290 |
clients: |
| 291 |
- mac: 00:11:22:33:44:55 |
| 292 |
name: Miles's phone |
| 293 |
devicePolicy: Group policy |
| 294 |
groupPolicyId: '101' |
| 295 |
networkId: string |
| 296 |
policiesBySecurityAppliance: |
| 297 |
devicePolicy: Normal |
| 298 |
policiesBySsid: |
| 299 |
'0': |
| 300 |
devicePolicy: Group policy |
| 301 |
groupPolicyId: '101' |
| 302 |
'1': |
| 303 |
devicePolicy: Group policy |
| 304 |
groupPolicyId: '101' |
| 305 |
'10': |
| 306 |
devicePolicy: Group policy |
| 307 |
groupPolicyId: '101' |
| 308 |
'11': |
| 309 |
devicePolicy: Group policy |
| 310 |
groupPolicyId: '101' |
| 311 |
'12': |
| 312 |
devicePolicy: Group policy |
| 313 |
groupPolicyId: '101' |
| 314 |
'13': |
| 315 |
devicePolicy: Group policy |
| 316 |
groupPolicyId: '101' |
| 317 |
'14': |
| 318 |
devicePolicy: Group policy |
| 319 |
groupPolicyId: '101' |
| 320 |
'2': |
| 321 |
devicePolicy: Group policy |
| 322 |
groupPolicyId: '101' |
| 323 |
'3': |
| 324 |
devicePolicy: Group policy |
| 325 |
groupPolicyId: '101' |
| 326 |
'4': |
| 327 |
devicePolicy: Group policy |
| 328 |
groupPolicyId: '101' |
| 329 |
'5': |
| 330 |
devicePolicy: Group policy |
| 331 |
groupPolicyId: '101' |
| 332 |
'6': |
| 333 |
devicePolicy: Group policy |
| 334 |
groupPolicyId: '101' |
| 335 |
'7': |
| 336 |
devicePolicy: Group policy |
| 337 |
groupPolicyId: '101' |
| 338 |
'8': |
| 339 |
devicePolicy: Group policy |
| 340 |
groupPolicyId: '101' |
| 341 |
'9': |
| 342 |
devicePolicy: Group policy |
| 343 |
groupPolicyId: '101' |
| 344 |
""" |
| 345 |
RETURN = r""" |
| 346 |
meraki_response: |
| 347 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 348 |
returned: always |
| 349 |
type: dict |
| 350 |
sample: > |
| 351 |
{ |
| 352 |
"clients": [ |
| 353 |
{ |
| 354 |
"mac": "string", |
| 355 |
"clientId": "string", |
| 356 |
"name": "string", |
| 357 |
"message": "string" |
| 358 |
} |
| 359 |
], |
| 360 |
"devicePolicy": "string", |
| 361 |
"groupPolicyId": "string" |
| 362 |
} |
| 363 |
""" |