On this page
pn_vlan - CLI command to create/delete a VLAN.
New in version 2.2.
Synopsis
- Execute vlan-create or vlan-delete command.
 - VLANs are used to isolate network traffic at Layer 2.The VLAN identifiers 0 and 4095 are reserved and cannot be used per the IEEE 802.1Q standard. The range of configurable VLAN identifiers is 2 through 4092.
 
Parameters
| Parameter | Choices/Defaults | Comments | 
|---|---|---|
| pn_clipassword | 
        
        Provide login password if user is not root.
         | 
     |
| pn_cliswitch | 
        
        Target switch(es) to run the cli on.
         | 
     |
| pn_cliusername | 
        
        Provide login username if user is not root.
         | 
     |
| pn_description | 
        
        Specify a description for the VLAN.
         | 
     |
| pn_ports | 
        
        Specifies the switch network data port number, list of ports, or range of ports. Port numbers must ne in the range of 1 to 64.
         | 
     |
| pn_scope | 
       
  | 
      
        
        Specify a scope for the VLAN.
        
       
        Required for vlan-create.
         | 
     
| pn_stats | 
        
        Specify if you want to collect statistics for a VLAN. Statistic collection is enabled by default.
         | 
     |
| pn_untagged_ports | 
        
        Specifies the ports that should have untagged packets mapped to the VLAN. Untagged packets are packets that do not contain IEEE 802.1Q VLAN tags.
         | 
     |
| pn_vlanid  
        required
         | 
      
        
        Specify a VLAN identifier for the VLAN. This is a value between 2 and 4092.
         | 
     |
| state  
        required
         | 
      
       
  | 
      
        
        State the action to perform. Use 'present' to create vlan and 'absent' to delete vlan.
         | 
     
Examples
- name: create a VLAN
  pn_vlan:
    state: 'present'
    pn_vlanid: 1854
    pn_scope: fabric
- name: delete VLANs
  pn_vlan:
    state: 'absent'
    pn_vlanid: 1854
  Return Values
Common return values are documented here, the following are the fields unique to this module:
| Key | Returned | Description | 
|---|---|---|
| changed  
        bool
         | 
      always | 
        
        Indicates whether the CLI caused changes on the target.
          | 
     
| command  
        str
         | 
      always | 
        
        The CLI command run on the target node(s).
          | 
     
| stderr  
        list
         | 
      on error | 
        
        The set of error responses from the vlan command.
          | 
     
| stdout  
        list
         | 
      always | 
        
        The set of responses from the vlan command.
          | 
     
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
- Pluribus Networks (@amitsi)
 
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
 https://docs.ansible.com/ansible/2.6/modules/pn_vlan_module.html