ansible.builtin.meraki_vlan (v2.9.24) — module

Manage VLANs 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.9.24

Description

Create, edit, query, or delete VLANs in a Meraki environment.

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Query all VLANs in a network.
  meraki_vlan:
    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 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- 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
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Delete a VLAN.
  meraki_vlan:
    auth_key: abc12345
    org_name: YourOrg
    net_name: YourNet
    state: absent
    vlan_id: 2
  delegate_to: localhost

Inputs

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

name:
    aliases:
    - vlan_name
    description:
    - Name of VLAN.
    type: str

state:
    choices:
    - absent
    - present
    - query
    default: query
    description:
    - Specifies whether object should be queried, created/modified, or removed.
    type: str

net_id:
    description:
    - ID of network which VLAN is in or should be in.
    type: str

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

subnet:
    description:
    - CIDR notation of network subnet.
    type: str

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

vlan_id:
    description:
    - ID number of VLAN.
    - ID should be between 1-4096.
    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

net_name:
    aliases:
    - network
    description:
    - Name of network which VLAN is in or should be in.
    type: str

org_name:
    aliases:
    - organization
    description:
    - Name of 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

appliance_ip:
    description:
    - IP address of appliance.
    - Address must be within subnet specified in C(subnet) parameter.
    type: str

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

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

vpn_nat_subnet:
    description:
    - The translated VPN subnet if VPN and VPN subnet translation are enabled on the VLAN.
    type: str

dns_nameservers:
    description:
    - Semi-colon delimited list of DNS IP addresses.
    - Specify one of the following options for preprogrammed DNS entries opendns, google_dns,
      upstream_dns
    type: str

reserved_ip_range:
    description:
    - IP address ranges which should be reserve and not distributed via DHCP.
    type: list

fixed_ip_assignments:
    description:
    - Static IP address assignments to be distributed via DHCP by MAC address.
    type: list

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:
  contains:
    appliance_ip:
      description: IP address of Meraki appliance in the VLAN
      returned: success
      sample: 192.0.1.1
      type: str
    dhcp_boot_filename:
      description: Filename for boot file.
      returned: success
      sample: boot.txt
      type: str
    dhcp_boot_next_server:
      description: DHCP boot option to direct boot clients to the server to load the
        boot file from.
      returned: success
      sample: 192.0.1.2
      type: str
    dhcp_boot_options_enabled:
      description: Whether DHCP boot options are enabled.
      returned: success
      sample: false
      type: bool
    dhcp_handling:
      description: Status of DHCP server on VLAN.
      returned: success
      sample: Run a DHCP server
      type: str
    dhcp_lease_time:
      description: DHCP lease time when server is active.
      returned: success
      sample: 1 day
      type: str
    dhcp_options:
      contains:
        code:
          description:
          - Code for DHCP option.
          - Integer between 2 and 254.
          returned: success
          sample: 43
          type: int
        type:
          description:
          - Type for DHCP option.
          - Choices are C(text), C(ip), C(hex), C(integer).
          returned: success
          sample: text
          type: str
        value:
          description: Value for the DHCP option.
          returned: success
          sample: 192.0.1.2
          type: str
      description: DHCP options.
      returned: success
      type: complex
    dnsnamservers:
      description: IP address or Meraki defined DNS servers which VLAN should use
        by default
      returned: success
      sample: upstream_dns
      type: str
    fixed_ip_assignments:
      contains:
        macaddress:
          contains:
            ip:
              description: IP address which is assigned to the MAC address.
              returned: success
              sample: 192.0.1.4
              type: str
            name:
              description: Descriptive name for binding.
              returned: success
              sample: fixed_ip
              type: str
          description: MAC address which has IP address assigned to it. Key value
            is the actual MAC address.
          returned: success
          type: complex
      description: List of MAC addresses which have IP addresses assigned.
      returned: success
      type: complex
    id:
      description: VLAN ID number.
      returned: success
      sample: 2
      type: int
    name:
      description: Descriptive name of VLAN.
      returned: success
      sample: TestVLAN
      type: str
    networkId:
      description: ID number of Meraki network which VLAN is associated to.
      returned: success
      sample: N_12345
      type: str
    reserved_ip_ranges:
      contains:
        comment:
          description: Description for IP address reservation.
          returned: success
          sample: reserved_range
          type: str
        end:
          description: Last IP address in reservation range.
          returned: success
          sample: 192.0.1.10
          type: str
        start:
          description: First IP address in reservation range.
          returned: success
          sample: 192.0.1.5
          type: str
      description: List of IP address ranges which are reserved for static assignment.
      returned: success
      type: complex
    subnet:
      description: CIDR notation IP subnet of VLAN.
      returned: success
      sample: 192.0.1.0/24
      type: str
  description: Information about the organization which was created or modified
  returned: success
  type: complex