| 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: devices_switch_routing_interfaces_dhcp |
| 9 |
short_description: Resource module for devices _switch _routing _interfaces _dhcp |
| 10 |
description: |
| 11 |
- Manage operation update of the resource devices _switch _routing _interfaces _dhcp. |
| 12 |
- Update a layer 3 interface DHCP configuration for a switch. |
| 13 |
version_added: '1.0.0' |
| 14 |
extends_documentation_fragment: |
| 15 |
- cisco.meraki.module |
| 16 |
author: Francisco Munoz (@fmunoz) |
| 17 |
options: |
| 18 |
bootFileName: |
| 19 |
description: The PXE boot server filename for the DHCP server running on the switch |
| 20 |
interface. |
| 21 |
type: str |
| 22 |
bootNextServer: |
| 23 |
description: The PXE boot server IP for the DHCP server running on the switch |
| 24 |
interface. |
| 25 |
type: str |
| 26 |
bootOptionsEnabled: |
| 27 |
description: Enable DHCP boot options to provide PXE boot options configs for |
| 28 |
the dhcp server running on the switch interface. |
| 29 |
type: bool |
| 30 |
dhcpLeaseTime: |
| 31 |
description: The DHCP lease time config for the dhcp server running on switch |
| 32 |
interface ('30 minutes', '1 hour', '4 hours', '12 hours', '1 day' or '1 week'). |
| 33 |
type: str |
| 34 |
dhcpMode: |
| 35 |
description: The DHCP mode options for the switch interface ('dhcpDisabled', 'dhcpRelay' |
| 36 |
or 'dhcpServer'). |
| 37 |
type: str |
| 38 |
dhcpOptions: |
| 39 |
description: Array of DHCP options consisting of code, type and value for the |
| 40 |
DHCP server running on the switch interface. |
| 41 |
elements: dict |
| 42 |
suboptions: |
| 43 |
code: |
| 44 |
description: The code for DHCP option which should be from 2 to 254. |
| 45 |
type: str |
| 46 |
type: |
| 47 |
description: The type of the DHCP option which should be one of ('text', 'ip', |
| 48 |
'integer' or 'hex'). |
| 49 |
type: str |
| 50 |
value: |
| 51 |
description: The value of the DHCP option. |
| 52 |
type: str |
| 53 |
type: list |
| 54 |
dhcpRelayServerIps: |
| 55 |
description: The DHCP relay server IPs to which DHCP packets would get relayed |
| 56 |
for the switch interface. |
| 57 |
elements: str |
| 58 |
type: list |
| 59 |
dnsCustomNameservers: |
| 60 |
description: The DHCP name server IPs when DHCP name server option is 'custom'. |
| 61 |
elements: str |
| 62 |
type: list |
| 63 |
dnsNameserversOption: |
| 64 |
description: The DHCP name server option for the dhcp server running on the switch |
| 65 |
interface ('googlePublicDns', 'openDns' or 'custom'). |
| 66 |
type: str |
| 67 |
fixedIpAssignments: |
| 68 |
description: Array of DHCP fixed IP assignments for the DHCP server running on |
| 69 |
the switch interface. |
| 70 |
elements: dict |
| 71 |
suboptions: |
| 72 |
ip: |
| 73 |
description: The IP address of the client which has fixed IP address assigned |
| 74 |
to it. |
| 75 |
type: str |
| 76 |
mac: |
| 77 |
description: The MAC address of the client which has fixed IP address. |
| 78 |
type: str |
| 79 |
name: |
| 80 |
description: The name of the client which has fixed IP address. |
| 81 |
type: str |
| 82 |
type: list |
| 83 |
interfaceId: |
| 84 |
description: InterfaceId path parameter. Interface ID. |
| 85 |
type: str |
| 86 |
reservedIpRanges: |
| 87 |
description: Array of DHCP reserved IP assignments for the DHCP server running |
| 88 |
on the switch interface. |
| 89 |
elements: dict |
| 90 |
suboptions: |
| 91 |
comment: |
| 92 |
description: The comment for the reserved IP range. |
| 93 |
type: str |
| 94 |
end: |
| 95 |
description: The ending IP address of the reserved IP range. |
| 96 |
type: str |
| 97 |
start: |
| 98 |
description: The starting IP address of the reserved IP range. |
| 99 |
type: str |
| 100 |
type: list |
| 101 |
serial: |
| 102 |
description: Serial path parameter. |
| 103 |
type: str |
| 104 |
requirements: |
| 105 |
- meraki >= 2.4.9 |
| 106 |
- python >= 3.5 |
| 107 |
seealso: |
| 108 |
- name: Cisco Meraki documentation for switch updateDeviceSwitchRoutingInterfaceDhcp |
| 109 |
description: Complete reference of the updateDeviceSwitchRoutingInterfaceDhcp |
| 110 |
API. |
| 111 |
link: https://developer.cisco.com/meraki/api-v1/#!update-device-switch-routing-interface-dhcp |
| 112 |
notes: |
| 113 |
- SDK Method used are |
| 114 |
switch.Switch.update_device_switch_routing_interface_dhcp, |
| 115 |
- Paths used are |
| 116 |
put /devices/{serial}/switch/routing/interfaces/{interfaceId}/dhcp, |
| 117 |
""" |
| 118 |
|
| 119 |
EXAMPLES = r""" |
| 120 |
- name: Update all |
| 121 |
cisco.meraki.devices_switch_routing_interfaces_dhcp: |
| 122 |
meraki_api_key: "{{ meraki_api_key }}" |
| 123 |
meraki_base_url: "{{ meraki_base_url }}" |
| 124 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 125 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 126 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 127 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 128 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 129 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 130 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 131 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 132 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 133 |
meraki_output_log: "{{ meraki_output_log }}" |
| 134 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 135 |
meraki_log_path: "{{ meraki_log_path }}" |
| 136 |
meraki_print_console: "{{ meraki_print_console }}" |
| 137 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 138 |
meraki_simulate: "{{ meraki_simulate }}" |
| 139 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 140 |
meraki_caller: "{{ meraki_caller }}" |
| 141 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 142 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 143 |
state: present |
| 144 |
bootFileName: home_boot_file |
| 145 |
bootNextServer: 1.2.3.4 |
| 146 |
bootOptionsEnabled: true |
| 147 |
dhcpLeaseTime: 1 day |
| 148 |
dhcpMode: dhcpServer |
| 149 |
dhcpOptions: |
| 150 |
- code: '5' |
| 151 |
type: text |
| 152 |
value: five |
| 153 |
dhcpRelayServerIps: |
| 154 |
- 1.2.3.4 |
| 155 |
dnsCustomNameservers: |
| 156 |
- 8.8.8.8, 8.8.4.4 |
| 157 |
dnsNameserversOption: custom |
| 158 |
fixedIpAssignments: |
| 159 |
- ip: 192.168.1.12 |
| 160 |
mac: 22:33:44:55:66:77 |
| 161 |
name: Cisco Meraki valued client |
| 162 |
interfaceId: string |
| 163 |
reservedIpRanges: |
| 164 |
- comment: A reserved IP range |
| 165 |
end: 192.168.1.10 |
| 166 |
start: 192.168.1.1 |
| 167 |
serial: string |
| 168 |
""" |
| 169 |
RETURN = r""" |
| 170 |
meraki_response: |
| 171 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 172 |
returned: always |
| 173 |
type: dict |
| 174 |
sample: > |
| 175 |
{ |
| 176 |
"dhcpMode": "string", |
| 177 |
"dhcpRelayServerIps": [ |
| 178 |
"string" |
| 179 |
], |
| 180 |
"dhcpLeaseTime": "string", |
| 181 |
"dnsNameserversOption": "string", |
| 182 |
"dnsCustomNameservers": [ |
| 183 |
"string" |
| 184 |
], |
| 185 |
"bootOptionsEnabled": true, |
| 186 |
"bootNextServer": "string", |
| 187 |
"bootFileName": "string", |
| 188 |
"dhcpOptions": [ |
| 189 |
{ |
| 190 |
"code": "string", |
| 191 |
"type": "string", |
| 192 |
"value": "string" |
| 193 |
} |
| 194 |
], |
| 195 |
"reservedIpRanges": [ |
| 196 |
{ |
| 197 |
"start": "string", |
| 198 |
"end": "string", |
| 199 |
"comment": "string" |
| 200 |
} |
| 201 |
], |
| 202 |
"fixedIpAssignments": [ |
| 203 |
{ |
| 204 |
"name": "string", |
| 205 |
"mac": "string", |
| 206 |
"ip": "string" |
| 207 |
} |
| 208 |
] |
| 209 |
} |
| 210 |
""" |