ansible.builtin.meraki_device (v2.8.13) — module

Manage devices in the Meraki cloud

| "added in version" 2.7 of ansible.builtin"

Authors: Kevin Breit (@kbreit)

preview | supported by community

Install Ansible via pip

Install with pip install ansible==2.8.13

Description

Visibility into devices associated to a Meraki environment.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Query all devices in an organization.
  meraki_device:
    auth_key: abc12345
    org_name: YourOrg
    state: query
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Query all devices in a network.
  meraki_device:
    auth_key: abc12345
    org_name: YourOrg
    net_name: YourNet
    state: query
  delegate_to: localhost
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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

Inputs

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

lng:
    aliases:
    - longitude
    description:
    - Longitude of device's geographic location.
    - Use negative number for western hemisphere.

host:
    default: api.meraki.com
    description:
    - Hostname for Meraki dashboard.
    - Can be used to access regional Meraki environments, such as China.
    type: str

note:
    description:
    - Informational notes about a device.
    - Limited to 255 characters.
    version_added: '2.8'
    version_added_collection: ansible.builtin

tags:
    description:
    - Space delimited list of tags to assign to device.

model:
    description:
    - Model of network device to search for.

state:
    choices:
    - absent
    - present
    - query
    default: query
    description:
    - Query an organization.

net_id:
    description:
    - ID of a network.

org_id:
    description:
    - ID of organization.
    type: str

serial:
    description:
    - Serial number of a device to query.

address:
    description:
    - Postal address of device's location.

timeout:
    default: 30
    description:
    - Time to timeout for HTTP requests.
    type: int

auth_key:
    description:
    - Authentication key provided by the dashboard. Required if environmental variable
      C(MERAKI_KEY) is not set.
    required: true
    type: str

hostname:
    aliases:
    - name
    description:
    - Hostname of network device to search for.

net_name:
    aliases:
    - network
    description:
    - Name of a network.

org_name:
    aliases:
    - organization
    description:
    - Name of organization.
    - If C(clone) is specified, C(org_name) is the name of the new organization.
    type: str

use_https:
    default: true
    description:
    - If C(no), it will use HTTP. Otherwise it will use HTTPS.
    - Only useful for internal Meraki developers.
    type: bool

use_proxy:
    default: false
    description:
    - If C(no), it will not use a proxy, even if one is defined in an environment variable
      on the target hosts.
    type: bool

output_level:
    choices:
    - debug
    - normal
    default: normal
    description:
    - Set amount of debug output during module execution.
    type: str

output_format:
    choices:
    - snakecase
    - camelcase
    default: snakecase
    description:
    - Instructs module whether response keys should be snake case (ex. C(net_id)) or camel
      case (ex. C(netId)).
    type: str

serial_uplink:
    description:
    - Serial number of device to query uplink information from.

validate_certs:
    default: true
    description:
    - Whether to validate HTTP certificates.
    type: bool

move_map_marker:
    description:
    - Whether or not to set the latitude and longitude of a device based on the new address.
    - Only applies when C(lat) and C(lng) are not specified.
    type: bool

serial_lldp_cdp:
    description:
    - Serial number of device to query LLDP/CDP information from.

lldp_cdp_timespan:
    description:
    - Timespan, in seconds, used to query LLDP and CDP information.
    - Must be less than 1 month.

rate_limit_retry_time:
    default: 165
    description:
    - Number of seconds to retry if rate limiter is triggered.
    type: int

internal_error_retry_time:
    default: 60
    description:
    - Number of seconds to retry if server returns an internal server error.
    type: int

Outputs

response:
  description: Data returned from Meraki dashboard.
  returned: info
  type: dict