meraki_device – Manage devices in the Meraki cloud

New in version 2.7.

Synopsis

  • Visibility into devices associated to a Meraki environment.

Parameters

Parameter Choices/Defaults Comments
address
-
Postal address of device's location.
auth_key
string
Authentication key provided by the dashboard. Required if environmental variable MERAKI_KEY is not set.
host
string
Default:
"api.meraki.com"
Hostname for Meraki dashboard.
Can be used to access regional Meraki environments, such as China.
hostname
-
Hostname of network device to search for.

aliases: name
lat
-
Latitude of device's geographic location.
Use negative number for southern hemisphere.

aliases: latitude
lldp_cdp_timespan
-
Timespan, in seconds, used to query LLDP and CDP information.
Must be less than 1 month.
lng
-
Longitude of device's geographic location.
Use negative number for western hemisphere.

aliases: longitude
model
-
Model of network device to search for.
move_map_marker
boolean
    Choices:
  • no
  • yes
Whether or not to set the latitude and longitude of a device based on the new address.
Only applies when lat and lng are not specified.
net_id
-
ID of a network.
net_name
-
Name of a network.

aliases: network
note
-
added in 2.8
Informational notes about a device.
Limited to 255 characters.
org_id
integer
ID of organization.
org_name
string
Name of organization.
If clone is specified, org_name is the name of the new organization.

aliases: organization
output_level
string
    Choices:
  • debug
  • normal ←
Set amount of debug output during module execution.
serial
-
Serial number of a device to query.
serial_lldp_cdp
-
Serial number of device to query LLDP/CDP information from.
serial_uplink
-
Serial number of device to query uplink information from.
state
-
    Choices:
  • absent
  • present
  • query ←
Query an organization.
tags
-
Space delimited list of tags to assign to device.
timeout
integer
Default:
30
Time to timeout for HTTP requests.
use_https
boolean
    Choices:
  • no
  • yes ←
If no, it will use HTTP. Otherwise it will use HTTPS.
Only useful for internal Meraki developers.
use_proxy
boolean
    Choices:
  • no
  • yes
If no, it will not use a proxy, even if one is defined in an environment variable on the target hosts.
validate_certs
boolean
    Choices:
  • no
  • yes ←
Whether to validate HTTP certificates.

Notes

Note

  • This module does not support claiming of devices or licenses into a Meraki organization.

  • More information about the Meraki API can be found at https://dashboard.meraki.com/api_docs.

  • Some of the options are likely only used for developers within Meraki.

  • More information about the Meraki API can be found at https://dashboard.meraki.com/api_docs.

  • Some of the options are likely only used for developers within Meraki.

Examples

- name: Query all devices in an organization.
  meraki_device:
    auth_key: abc12345
    org_name: YourOrg
    state: query
  delegate_to: localhost

- name: Query all devices in a network.
  meraki_device:
    auth_key: abc12345
    org_name: YourOrg
    net_name: YourNet
    state: query
  delegate_to: localhost

- name: Query a device by serial number.
  meraki_device:
    auth_key: abc12345
    org_name: YourOrg
    net_name: YourNet
    serial: ABC-123
    state: query
  delegate_to: localhost

- name: Lookup uplink information about a device.
  meraki_device:
    auth_key: abc12345
    org_name: YourOrg
    net_name: YourNet
    serial_uplink: ABC-123
    state: query
  delegate_to: localhost

- name: Lookup LLDP and CDP information about devices connected to specified device.
  meraki_device:
    auth_key: abc12345
    org_name: YourOrg
    net_name: YourNet
    serial_lldp_cdp: ABC-123
    state: query
  delegate_to: localhost

- name: Lookup a device by hostname.
  meraki_device:
    auth_key: abc12345
    org_name: YourOrg
    net_name: YourNet
    hostname: main-switch
    state: query
  delegate_to: localhost

- name: Query all devices of a specific model.
  meraki_device:
    auth_key: abc123
    org_name: YourOrg
    net_name: YourNet
    model: MR26
    state: query
  delegate_to: localhost

- name: Update information about a device.
  meraki_device:
    auth_key: abc123
    org_name: YourOrg
    net_name: YourNet
    state: present
    serial: '{{serial}}'
    name: mr26
    address: 1060 W. Addison St., Chicago, IL
    lat: 41.948038
    lng: -87.65568
    tags: recently-added
  delegate_to: localhost

- name: Claim a device into a network.
  meraki_device:
    auth_key: abc123
    org_name: YourOrg
    net_name: YourNet
    serial: ABC-123
    state: present
  delegate_to: localhost

- name: Remove a device from a network.
  meraki_device:
    auth_key: abc123
    org_name: YourOrg
    net_name: YourNet
    serial: ABC-123
    state: absent
  delegate_to: localhost

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key Returned Description
response
dictionary
info
Data returned from Meraki dashboard.



Status

Authors

  • Kevin Breit (@kbreit)

Hint

If you notice any issues in this documentation you can edit this document to improve it.