meraki_vlan - Manage VLANs in the Meraki cloud

New in version 2.7.

Synopsis

Parameters

Parameter Choices/Defaults Comments
appliance_ip
IP address of appliance.
Address must be within subnet specified in subnet parameter.
auth_key
Authentication key provided by the dashboard. Required if environmental variable MERAKI_KEY is not set.
dns_nameservers
Semi-colon delimited list of DNS IP addresses.
Specify one of the following options for preprogrammed DNS entries opendns, google_dns, upstream_dns
fixed_ip_assignments
Static IP address assignements to be distributed via DHCP by MAC address.
host
string
Default:
api.meraki.com
Hostname for Meraki dashboard
Only useful for internal Meraki developers
name
Name of VLAN.

aliases: vlan_name
net_id
ID of network which VLAN is in or should be in.
net_name
Name of network which VLAN is in or should be in.

aliases: network
org_id
ID of organization.
org_name
Name of organization.

aliases: organization
output_level
    Choices:
  • normal ←
  • debug
Set amount of debug output during module execution
reserved_ip_range
IP address ranges which should be reserve and not distributed via DHCP.
state
    Choices:
  • absent
  • present
  • query ←
Specifies whether object should be queried, created/modified, or removed.
subnet
CIDR notation of network subnet.
timeout
int
Default:
30
Time to timeout for HTTP requests.
use_https
bool
    Choices:
  • no
  • yes ←
If no, it will use HTTP. Otherwise it will use HTTPS.
Only useful for internal Meraki developers
use_proxy
bool
    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
bool
    Choices:
  • no
  • yes ←
Whether to validate HTTP certificates.
vlan_id
ID number of VLAN.
ID should be between 1-4096.
vpn_nat_subnet
The translated VPN subnet if VPN and VPN subnet translation are enabled on the VLAN.

Notes

Note

  • Some of the options are likely only used for developers within Meraki.
  • Meraki’s API defaults to networks having VLAN support disabled and there is no way to enable VLANs support in the API. VLAN support must be enabled manually.
  • 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 VLANs in a network.
  meraki_vlan:
    auth_key: abc12345
    org_name: YourOrg
    net_name: YourNet
    state: query
  delegate_to: localhost

- name: Query information about a single VLAN by ID.
  meraki_vlan:
    auth_key: abc12345
    org_name: YourOrg
    net_name: YourNet
    vlan_id: 2
    state: query
  delegate_to: localhost

- name: Create a VLAN.
  meraki_vlan:
    auth_key: abc12345
    org_name: YourOrg
    net_name: YourNet
    state: present
    vlan_id: 2
    name: TestVLAN
    subnet: 192.0.1.0/24
    appliance_ip: 192.0.1.1
  delegate_to: localhost

- name: Update a VLAN.
  meraki_vlan:
    auth_key: abc12345
    org_name: YourOrg
    net_name: YourNet
    state: present
    vlan_id: 2
    name: TestVLAN
    subnet: 192.0.1.0/24
    appliance_ip: 192.168.250.2
    fixed_ip_assignments:
      - mac: "13:37:de:ad:be:ef"
        ip: 192.168.250.10
        name: fixed_ip
    reserved_ip_range:
      - start: 192.168.250.10
        end: 192.168.250.20
        comment: reserved_range
    dns_nameservers: opendns
  delegate_to: localhost

- name: Delete a VLAN.
  meraki_vlan:
    auth_key: abc12345
    org_name: YourOrg
    net_name: YourNet
    state: absent
    vlan_id: 2
  delegate_to: localhost

Return Values

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

Key Returned Description
response
complex
success
Information about the organization which was created or modified

  networkId
string
success
ID number of Meraki network which VLAN is associated to.

Sample:
N_12345
  subnet
string
success
CIDR notation IP subnet of VLAN.

Sample:
192.0.1.0/24
  fixedIpAssignments
complex
success
List of MAC addresses which have IP addresses assigned.

    macaddress
complex
success
MAC address which has IP address assigned to it. Key value is the actual MAC address.

      ip
string
success
IP address which is assigned to the MAC address.

Sample:
192.0.1.4
      name
string
success
Descriptive name for binding.

Sample:
fixed_ip
  name
string
success
Descriptive name of VLAN

Sample:
TestVLAN
  applianceIp
string
success
IP address of Meraki appliance in the VLAN

Sample:
192.0.1.1
  reservedIpRanges
complex
success
List of IP address ranges which are reserved for static assignment.

    comment
string
success
Description for IP address reservation.

Sample:
reserved_range
    start
string
success
First IP address in reservation range.

Sample:
192.0.1.5
    end
string
success
Last IP address in reservation range.

Sample:
192.0.1.10
  dnsnamservers
string
success
IP address or Meraki defined DNS servers which VLAN should use by default

Sample:
upstream_dns
  id
int
success
VLAN ID number.

Sample:
2


Status

This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.

Maintenance

This module is flagged as community which means that it is maintained by the Ansible Community. See Module Maintenance & Support for more info.

For a list of other modules that are also maintained by the Ansible Community, see here.

Author

  • Kevin Breit (@kbreit)

Hint

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