New in version 2.4.
parameter | required | default | choices | comments |
---|---|---|---|---|
description |
no |
Specify VLAN description, in the range from 1 to 80.
|
||
name |
no |
Name of VLAN, in the range from 1 to 31.
|
||
state |
no | present |
|
Manage the state of the resource.
|
vlan_id |
no |
Single VLAN ID, in the range from 1 to 4094.
|
||
vlan_range |
no |
Range of VLANs such as
2-10 or 2,5,10-15 , etc. |
- name: vlan module test hosts: cloudengine connection: local gather_facts: no vars: cli: host: "{{ inventory_hostname }}" port: "{{ ansible_ssh_port }}" username: "{{ username }}" password: "{{ password }}" transport: cli tasks: - name: Ensure a range of VLANs are not present on the switch ce_vlan: vlan_range: "2-10,20,50,55-60,100-150" state: absent provider: "{{ cli }}" - name: Ensure VLAN 50 exists with the name WEB ce_vlan: vlan_id: 50 name: WEB state: absent provider: "{{ cli }}" - name: Ensure VLAN is NOT on the device ce_vlan: vlan_id: 50 state: absent provider: "{{ cli }}"
Common return values are documented here Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
changed |
check to see if a change was made on the device
|
always | boolean | True |
end_state |
k/v pairs of the VLAN after executing module or null when using vlan_range
|
always | dict | {'name': 'VLAN_APP', 'vlan_id': '20', 'description': 'vlan for app'} |
end_state_vlans_list |
list of VLANs after the module is executed
|
always | list | ['1', '2', '3', '4', '5', '20', '100'] |
existing |
k/v pairs of existing vlan or null when using vlan_range
|
always | dict | {'name': 'VLAN_APP', 'vlan_id': '20', 'description': ''} |
existing_vlans_list |
list of existing VLANs on the switch prior to making changes
|
always | list | ['1', '2', '3', '4', '5', '20'] |
proposed |
k/v pairs of parameters passed into module (does not include vlan_id or vlan_range)
|
always | dict | {'name': 'VLAN_APP', 'vlan_id': '20', 'description': 'vlan for app'} |
proposed_vlans_list |
list of VLANs being proposed
|
always | list | ['100'] |
updates |
command string sent to the device
|
always | list | ['vlan 20', 'name VLAN20'] |
This module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.