| 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_switch_dhcp_server_policy |
| 9 |
short_description: Resource module for networks _switch _dhcpserverpolicy |
| 10 |
description: |
| 11 |
- Manage operation update of the resource networks _switch _dhcpserverpolicy. |
| 12 |
- > |
| 13 |
Update the DHCP server settings. Blocked/allowed servers are only applied when |
| 14 |
default policy is allow/block, respectively. |
| 15 |
version_added: '1.0.0' |
| 16 |
extends_documentation_fragment: |
| 17 |
- cisco.meraki.module |
| 18 |
author: Francisco Munoz (@fmunoz) |
| 19 |
options: |
| 20 |
alerts: |
| 21 |
description: Alert settings for DHCP servers. |
| 22 |
suboptions: |
| 23 |
email: |
| 24 |
description: Email alert settings for DHCP servers. |
| 25 |
suboptions: |
| 26 |
enabled: |
| 27 |
description: When enabled, send an email if a new DHCP server is seen. |
| 28 |
Default value is false. |
| 29 |
type: bool |
| 30 |
type: dict |
| 31 |
type: dict |
| 32 |
allowedServers: |
| 33 |
description: List the MAC addresses of DHCP servers to permit on the network when |
| 34 |
defaultPolicy is set to block. An empty array will clear the entries. |
| 35 |
elements: str |
| 36 |
type: list |
| 37 |
arpInspection: |
| 38 |
description: Dynamic ARP Inspection settings. |
| 39 |
suboptions: |
| 40 |
enabled: |
| 41 |
description: Enable or disable Dynamic ARP Inspection on the network. Default |
| 42 |
value is false. |
| 43 |
type: bool |
| 44 |
type: dict |
| 45 |
blockedServers: |
| 46 |
description: List the MAC addresses of DHCP servers to block on the network when |
| 47 |
defaultPolicy is set to allow. An empty array will clear the entries. |
| 48 |
elements: str |
| 49 |
type: list |
| 50 |
defaultPolicy: |
| 51 |
description: '''allow'' or ''block'' new DHCP servers. Default value is ''allow''.' |
| 52 |
type: str |
| 53 |
networkId: |
| 54 |
description: NetworkId path parameter. Network ID. |
| 55 |
type: str |
| 56 |
requirements: |
| 57 |
- meraki >= 2.4.9 |
| 58 |
- python >= 3.5 |
| 59 |
seealso: |
| 60 |
- name: Cisco Meraki documentation for switch updateNetworkSwitchDhcpServerPolicy |
| 61 |
description: Complete reference of the updateNetworkSwitchDhcpServerPolicy API. |
| 62 |
link: https://developer.cisco.com/meraki/api-v1/#!update-network-switch-dhcp-server-policy |
| 63 |
notes: |
| 64 |
- SDK Method used are |
| 65 |
switch.Switch.update_network_switch_dhcp_server_policy, |
| 66 |
- Paths used are |
| 67 |
put /networks/{networkId}/switch/dhcpServerPolicy, |
| 68 |
""" |
| 69 |
|
| 70 |
EXAMPLES = r""" |
| 71 |
- name: Update all |
| 72 |
cisco.meraki.networks_switch_dhcp_server_policy: |
| 73 |
meraki_api_key: "{{ meraki_api_key }}" |
| 74 |
meraki_base_url: "{{ meraki_base_url }}" |
| 75 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 76 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 77 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 78 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 79 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 80 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 81 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 82 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 83 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 84 |
meraki_output_log: "{{ meraki_output_log }}" |
| 85 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 86 |
meraki_log_path: "{{ meraki_log_path }}" |
| 87 |
meraki_print_console: "{{ meraki_print_console }}" |
| 88 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 89 |
meraki_simulate: "{{ meraki_simulate }}" |
| 90 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 91 |
meraki_caller: "{{ meraki_caller }}" |
| 92 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 93 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 94 |
state: present |
| 95 |
alerts: |
| 96 |
email: |
| 97 |
enabled: true |
| 98 |
allowedServers: |
| 99 |
- 00:50:56:00:00:01 |
| 100 |
- 00:50:56:00:00:02 |
| 101 |
arpInspection: |
| 102 |
enabled: true |
| 103 |
blockedServers: |
| 104 |
- 00:50:56:00:00:03 |
| 105 |
- 00:50:56:00:00:04 |
| 106 |
defaultPolicy: block |
| 107 |
networkId: string |
| 108 |
""" |
| 109 |
RETURN = r""" |
| 110 |
meraki_response: |
| 111 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 112 |
returned: always |
| 113 |
type: dict |
| 114 |
sample: > |
| 115 |
{ |
| 116 |
"alerts": { |
| 117 |
"email": { |
| 118 |
"enabled": true |
| 119 |
} |
| 120 |
}, |
| 121 |
"defaultPolicy": "string", |
| 122 |
"blockedServers": [ |
| 123 |
"string" |
| 124 |
], |
| 125 |
"allowedServers": [ |
| 126 |
"string" |
| 127 |
], |
| 128 |
"arpInspection": { |
| 129 |
"enabled": true, |
| 130 |
"unsupportedModels": [ |
| 131 |
"string" |
| 132 |
] |
| 133 |
} |
| 134 |
} |
| 135 |
""" |