| 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_meraki_auth_users |
| 9 |
short_description: Resource module for networks _merakiauthusers |
| 10 |
description: |
| 11 |
- Manage operations create, update and delete of the resource networks _merakiauthusers. |
| 12 |
- > |
| 13 |
Authorize a user configured with Meraki Authentication for a network currently |
| 14 |
supports 802.1X, splash guest, and client VPN users, and currently, organizations |
| 15 |
have a 50,000 user cap . |
| 16 |
- Delete an 802.1X RADIUS user, or deauthorize and optionally delete a splash guest |
| 17 |
or client VPN user. |
| 18 |
- > |
| 19 |
Update a user configured with Meraki Authentication currently, 802.1X RADIUS, |
| 20 |
splash guest, and client VPN users can be updated . |
| 21 |
version_added: '1.0.0' |
| 22 |
extends_documentation_fragment: |
| 23 |
- cisco.meraki.module |
| 24 |
author: Francisco Munoz (@fmunoz) |
| 25 |
options: |
| 26 |
accountType: |
| 27 |
description: Authorization type for user. Can be 'Guest' or '802.1X' for wireless |
| 28 |
networks, or 'Client VPN' for MX networks. Defaults to '802.1X'. |
| 29 |
type: str |
| 30 |
authorizations: |
| 31 |
description: Authorization zones and expiration dates for the user. |
| 32 |
elements: dict |
| 33 |
suboptions: |
| 34 |
expiresAt: |
| 35 |
description: Date for authorization to expire. Set to 'Never' for the authorization |
| 36 |
to not expire, which is the default. |
| 37 |
type: str |
| 38 |
ssidNumber: |
| 39 |
description: Required for wireless networks. The SSID for which the user is |
| 40 |
being authorized, which must be configured for the user's given accountType. |
| 41 |
type: int |
| 42 |
type: list |
| 43 |
delete: |
| 44 |
description: Delete query parameter. If the ID supplied is for a splash guest |
| 45 |
or client VPN user, and that user is not authorized for any other networks in |
| 46 |
the organization, then also delete the user. 802.1X RADIUS users are always |
| 47 |
deleted regardless of this optional attribute. |
| 48 |
type: bool |
| 49 |
email: |
| 50 |
description: Email address of the user. |
| 51 |
type: str |
| 52 |
emailPasswordToUser: |
| 53 |
description: Whether or not Meraki should email the password to user. Default |
| 54 |
is false. |
| 55 |
type: bool |
| 56 |
isAdmin: |
| 57 |
description: Whether or not the user is a Dashboard administrator. |
| 58 |
type: bool |
| 59 |
merakiAuthUserId: |
| 60 |
description: MerakiAuthUserId path parameter. Meraki auth user ID. |
| 61 |
type: str |
| 62 |
name: |
| 63 |
description: Name of the user. Only required If the user is not a Dashboard administrator. |
| 64 |
type: str |
| 65 |
networkId: |
| 66 |
description: NetworkId path parameter. Network ID. |
| 67 |
type: str |
| 68 |
password: |
| 69 |
description: The password for this user account. Only required If the user is |
| 70 |
not a Dashboard administrator. |
| 71 |
type: str |
| 72 |
requirements: |
| 73 |
- meraki >= 2.4.9 |
| 74 |
- python >= 3.5 |
| 75 |
seealso: |
| 76 |
- name: Cisco Meraki documentation for networks createNetworkMerakiAuthUser |
| 77 |
description: Complete reference of the createNetworkMerakiAuthUser API. |
| 78 |
link: https://developer.cisco.com/meraki/api-v1/#!create-network-meraki-auth-user |
| 79 |
- name: Cisco Meraki documentation for networks deleteNetworkMerakiAuthUser |
| 80 |
description: Complete reference of the deleteNetworkMerakiAuthUser API. |
| 81 |
link: https://developer.cisco.com/meraki/api-v1/#!delete-network-meraki-auth-user |
| 82 |
- name: Cisco Meraki documentation for networks updateNetworkMerakiAuthUser |
| 83 |
description: Complete reference of the updateNetworkMerakiAuthUser API. |
| 84 |
link: https://developer.cisco.com/meraki/api-v1/#!update-network-meraki-auth-user |
| 85 |
notes: |
| 86 |
- SDK Method used are |
| 87 |
networks.Networks.create_network_meraki_auth_user, |
| 88 |
networks.Networks.delete_network_meraki_auth_user, |
| 89 |
networks.Networks.update_network_meraki_auth_user, |
| 90 |
- Paths used are |
| 91 |
post /networks/{networkId}/merakiAuthUsers, |
| 92 |
delete /networks/{networkId}/merakiAuthUsers/{merakiAuthUserId}, |
| 93 |
put /networks/{networkId}/merakiAuthUsers/{merakiAuthUserId}, |
| 94 |
""" |
| 95 |
|
| 96 |
EXAMPLES = r""" |
| 97 |
- name: Create |
| 98 |
cisco.meraki.networks_meraki_auth_users: |
| 99 |
meraki_api_key: "{{ meraki_api_key }}" |
| 100 |
meraki_base_url: "{{ meraki_base_url }}" |
| 101 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 102 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 103 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 104 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 105 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 106 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 107 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 108 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 109 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 110 |
meraki_output_log: "{{ meraki_output_log }}" |
| 111 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 112 |
meraki_log_path: "{{ meraki_log_path }}" |
| 113 |
meraki_print_console: "{{ meraki_print_console }}" |
| 114 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 115 |
meraki_simulate: "{{ meraki_simulate }}" |
| 116 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 117 |
meraki_caller: "{{ meraki_caller }}" |
| 118 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 119 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 120 |
state: present |
| 121 |
accountType: 802.1X |
| 122 |
authorizations: |
| 123 |
- expiresAt: '2018-03-13T00:00:00.090210Z' |
| 124 |
ssidNumber: 1 |
| 125 |
email: [email protected] |
| 126 |
emailPasswordToUser: false |
| 127 |
isAdmin: false |
| 128 |
name: Miles Meraki |
| 129 |
networkId: string |
| 130 |
password: secret |
| 131 |
- name: Delete by id |
| 132 |
cisco.meraki.networks_meraki_auth_users: |
| 133 |
meraki_api_key: "{{ meraki_api_key }}" |
| 134 |
meraki_base_url: "{{ meraki_base_url }}" |
| 135 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 136 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 137 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 138 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 139 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 140 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 141 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 142 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 143 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 144 |
meraki_output_log: "{{ meraki_output_log }}" |
| 145 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 146 |
meraki_log_path: "{{ meraki_log_path }}" |
| 147 |
meraki_print_console: "{{ meraki_print_console }}" |
| 148 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 149 |
meraki_simulate: "{{ meraki_simulate }}" |
| 150 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 151 |
meraki_caller: "{{ meraki_caller }}" |
| 152 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 153 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 154 |
state: absent |
| 155 |
delete: true |
| 156 |
merakiAuthUserId: string |
| 157 |
networkId: string |
| 158 |
- name: Update by id |
| 159 |
cisco.meraki.networks_meraki_auth_users: |
| 160 |
meraki_api_key: "{{ meraki_api_key }}" |
| 161 |
meraki_base_url: "{{ meraki_base_url }}" |
| 162 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 163 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 164 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 165 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 166 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 167 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 168 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 169 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 170 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 171 |
meraki_output_log: "{{ meraki_output_log }}" |
| 172 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 173 |
meraki_log_path: "{{ meraki_log_path }}" |
| 174 |
meraki_print_console: "{{ meraki_print_console }}" |
| 175 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 176 |
meraki_simulate: "{{ meraki_simulate }}" |
| 177 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 178 |
meraki_caller: "{{ meraki_caller }}" |
| 179 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 180 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 181 |
state: present |
| 182 |
authorizations: |
| 183 |
- expiresAt: '2018-03-13T00:00:00.090210Z' |
| 184 |
ssidNumber: 1 |
| 185 |
emailPasswordToUser: false |
| 186 |
merakiAuthUserId: string |
| 187 |
name: Miles Meraki |
| 188 |
networkId: string |
| 189 |
password: secret |
| 190 |
""" |
| 191 |
RETURN = r""" |
| 192 |
meraki_response: |
| 193 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 194 |
returned: always |
| 195 |
type: dict |
| 196 |
sample: > |
| 197 |
{ |
| 198 |
"id": "string", |
| 199 |
"email": "string", |
| 200 |
"name": "string", |
| 201 |
"createdAt": "string", |
| 202 |
"accountType": "string", |
| 203 |
"isAdmin": true, |
| 204 |
"authorizations": [ |
| 205 |
{ |
| 206 |
"ssidNumber": 0, |
| 207 |
"authorizedZone": "string", |
| 208 |
"expiresAt": "string", |
| 209 |
"authorizedByName": "string", |
| 210 |
"authorizedByEmail": "string" |
| 211 |
} |
| 212 |
] |
| 213 |
} |
| 214 |
""" |