| 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_management_interface |
| 9 |
short_description: Resource module for devices _managementinterface |
| 10 |
description: |
| 11 |
- Manage operations create and update of the resource devices _managementinterface. |
| 12 |
- Reboot a device. This endpoint has a sustained rate limit of one request every |
| 13 |
60 seconds. |
| 14 |
- Update the management interface settings for a device. |
| 15 |
version_added: '1.0.0' |
| 16 |
extends_documentation_fragment: |
| 17 |
- cisco.meraki.module |
| 18 |
author: Francisco Munoz (@fmunoz) |
| 19 |
options: |
| 20 |
serial: |
| 21 |
description: Serial path parameter. |
| 22 |
type: str |
| 23 |
wan1: |
| 24 |
description: WAN 1 settings. |
| 25 |
suboptions: |
| 26 |
staticDns: |
| 27 |
description: Up to two DNS IPs. |
| 28 |
elements: str |
| 29 |
type: list |
| 30 |
staticGatewayIp: |
| 31 |
description: The IP of the gateway on the WAN. |
| 32 |
type: str |
| 33 |
staticIp: |
| 34 |
description: The IP the device should use on the WAN. |
| 35 |
type: str |
| 36 |
staticSubnetMask: |
| 37 |
description: The subnet mask for the WAN. |
| 38 |
type: str |
| 39 |
usingStaticIp: |
| 40 |
description: Configure the interface to have static IP settings or use DHCP. |
| 41 |
type: bool |
| 42 |
vlan: |
| 43 |
description: The VLAN that management traffic should be tagged with. Applies |
| 44 |
whether usingStaticIp is true or false. |
| 45 |
type: int |
| 46 |
wanEnabled: |
| 47 |
description: Enable or disable the interface (only for MX devices). Valid |
| 48 |
values are 'enabled', 'disabled', and 'not configured'. |
| 49 |
type: str |
| 50 |
type: dict |
| 51 |
wan2: |
| 52 |
description: WAN 2 settings (only for MX devices). |
| 53 |
suboptions: |
| 54 |
staticDns: |
| 55 |
description: Up to two DNS IPs. |
| 56 |
elements: str |
| 57 |
type: list |
| 58 |
staticGatewayIp: |
| 59 |
description: The IP of the gateway on the WAN. |
| 60 |
type: str |
| 61 |
staticIp: |
| 62 |
description: The IP the device should use on the WAN. |
| 63 |
type: str |
| 64 |
staticSubnetMask: |
| 65 |
description: The subnet mask for the WAN. |
| 66 |
type: str |
| 67 |
usingStaticIp: |
| 68 |
description: Configure the interface to have static IP settings or use DHCP. |
| 69 |
type: bool |
| 70 |
vlan: |
| 71 |
description: The VLAN that management traffic should be tagged with. Applies |
| 72 |
whether usingStaticIp is true or false. |
| 73 |
type: int |
| 74 |
wanEnabled: |
| 75 |
description: Enable or disable the interface (only for MX devices). Valid |
| 76 |
values are 'enabled', 'disabled', and 'not configured'. |
| 77 |
type: str |
| 78 |
type: dict |
| 79 |
requirements: |
| 80 |
- meraki >= 2.4.9 |
| 81 |
- python >= 3.5 |
| 82 |
seealso: |
| 83 |
- name: Cisco Meraki documentation for devices rebootDevice |
| 84 |
description: Complete reference of the rebootDevice API. |
| 85 |
link: https://developer.cisco.com/meraki/api-v1/#!reboot-device |
| 86 |
- name: Cisco Meraki documentation for devices updateDeviceManagementInterface |
| 87 |
description: Complete reference of the updateDeviceManagementInterface API. |
| 88 |
link: https://developer.cisco.com/meraki/api-v1/#!update-device-management-interface |
| 89 |
notes: |
| 90 |
- SDK Method used are |
| 91 |
devices.Devices.reboot_device, |
| 92 |
devices.Devices.update_device_management_interface, |
| 93 |
- Paths used are |
| 94 |
post /devices/{serial}/reboot, |
| 95 |
put /devices/{serial}/managementInterface, |
| 96 |
""" |
| 97 |
|
| 98 |
EXAMPLES = r""" |
| 99 |
- name: Update all |
| 100 |
cisco.meraki.devices_management_interface: |
| 101 |
meraki_api_key: "{{ meraki_api_key }}" |
| 102 |
meraki_base_url: "{{ meraki_base_url }}" |
| 103 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 104 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 105 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 106 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 107 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 108 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 109 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 110 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 111 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 112 |
meraki_output_log: "{{ meraki_output_log }}" |
| 113 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 114 |
meraki_log_path: "{{ meraki_log_path }}" |
| 115 |
meraki_print_console: "{{ meraki_print_console }}" |
| 116 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 117 |
meraki_simulate: "{{ meraki_simulate }}" |
| 118 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 119 |
meraki_caller: "{{ meraki_caller }}" |
| 120 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 121 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 122 |
state: present |
| 123 |
serial: string |
| 124 |
wan1: |
| 125 |
staticDns: |
| 126 |
- 1.2.3.2 |
| 127 |
- 1.2.3.3 |
| 128 |
staticGatewayIp: 1.2.3.1 |
| 129 |
staticIp: 1.2.3.4 |
| 130 |
staticSubnetMask: 255.255.255.0 |
| 131 |
usingStaticIp: true |
| 132 |
vlan: 7 |
| 133 |
wanEnabled: not configured |
| 134 |
wan2: |
| 135 |
staticDns: |
| 136 |
- 1.2.3.2 |
| 137 |
- 1.2.3.3 |
| 138 |
staticGatewayIp: 1.2.3.1 |
| 139 |
staticIp: 1.2.3.4 |
| 140 |
staticSubnetMask: 255.255.255.0 |
| 141 |
usingStaticIp: false |
| 142 |
vlan: 2 |
| 143 |
wanEnabled: enabled |
| 144 |
- name: Create |
| 145 |
cisco.meraki.devices_management_interface: |
| 146 |
meraki_api_key: "{{ meraki_api_key }}" |
| 147 |
meraki_base_url: "{{ meraki_base_url }}" |
| 148 |
meraki_single_request_timeout: "{{ meraki_single_request_timeout }}" |
| 149 |
meraki_certificate_path: "{{ meraki_certificate_path }}" |
| 150 |
meraki_requests_proxy: "{{ meraki_requests_proxy }}" |
| 151 |
meraki_wait_on_rate_limit: "{{ meraki_wait_on_rate_limit }}" |
| 152 |
meraki_nginx_429_retry_wait_time: "{{ meraki_nginx_429_retry_wait_time }}" |
| 153 |
meraki_action_batch_retry_wait_time: "{{ meraki_action_batch_retry_wait_time }}" |
| 154 |
meraki_retry_4xx_error: "{{ meraki_retry_4xx_error }}" |
| 155 |
meraki_retry_4xx_error_wait_time: "{{ meraki_retry_4xx_error_wait_time }}" |
| 156 |
meraki_maximum_retries: "{{ meraki_maximum_retries }}" |
| 157 |
meraki_output_log: "{{ meraki_output_log }}" |
| 158 |
meraki_log_file_prefix: "{{ meraki_log_file_prefix }}" |
| 159 |
meraki_log_path: "{{ meraki_log_path }}" |
| 160 |
meraki_print_console: "{{ meraki_print_console }}" |
| 161 |
meraki_suppress_logging: "{{ meraki_suppress_logging }}" |
| 162 |
meraki_simulate: "{{ meraki_simulate }}" |
| 163 |
meraki_be_geo_id: "{{ meraki_be_geo_id }}" |
| 164 |
meraki_caller: "{{ meraki_caller }}" |
| 165 |
meraki_use_iterator_for_get_pages: "{{ meraki_use_iterator_for_get_pages }}" |
| 166 |
meraki_inherit_logging_config: "{{ meraki_inherit_logging_config }}" |
| 167 |
state: present |
| 168 |
serial: string |
| 169 |
""" |
| 170 |
RETURN = r""" |
| 171 |
meraki_response: |
| 172 |
description: A dictionary or list with the response returned by the Cisco Meraki Python SDK |
| 173 |
returned: always |
| 174 |
type: dict |
| 175 |
sample: > |
| 176 |
{ |
| 177 |
"ddnsHostnames": { |
| 178 |
"activeDdnsHostname": "string", |
| 179 |
"ddnsHostnameWan1": "string", |
| 180 |
"ddnsHostnameWan2": "string" |
| 181 |
}, |
| 182 |
"wan1": { |
| 183 |
"wanEnabled": "string", |
| 184 |
"usingStaticIp": true, |
| 185 |
"staticIp": "string", |
| 186 |
"staticSubnetMask": "string", |
| 187 |
"staticGatewayIp": "string", |
| 188 |
"staticDns": [ |
| 189 |
"string" |
| 190 |
], |
| 191 |
"vlan": 0, |
| 192 |
"vrf": { |
| 193 |
"name": "string" |
| 194 |
} |
| 195 |
}, |
| 196 |
"wan2": { |
| 197 |
"wanEnabled": "string", |
| 198 |
"usingStaticIp": true, |
| 199 |
"staticIp": "string", |
| 200 |
"staticSubnetMask": "string", |
| 201 |
"staticGatewayIp": "string", |
| 202 |
"staticDns": [ |
| 203 |
"string" |
| 204 |
], |
| 205 |
"vlan": 0, |
| 206 |
"vrf": { |
| 207 |
"name": "string" |
| 208 |
} |
| 209 |
} |
| 210 |
} |
| 211 |
""" |