---
title: "NIOS VLAN"
canonical: "https://docs.infoblox.com/space/niosmodulesansible/1161953404/NIOS%20VLAN"
format: markdown
---
Use the `nios_vlan` module to create, update, or remove instances of NIOS VLAN objects from a NIOS Grid. It supports IPv4 as well as IPv6 networks.

The following table describes the parameters you can define in the `nios_vlan` module:

| **Parameter** | **Required/Optional** | **Description** |
| --- | --- | --- |
| `name` | Required | Specifies the name of the VLAN object that you want to add, update, or remove from NIOS. |
| `id` | Required | Specifies the ID of the VLAN object. |
| `parent` | Optional | Specifies the name of the parent VLAN view or VLAN range of the VLAN object.  
If a value is not specified, `default` is considered as the name. |
| `contact` | Optional | Specifies the contact information of an individual or a team that manages or uses the VLAN. |
| `department` | Optional | Specifies the department where the VLAN object is used. |
| `description` | Optional | Describes the VLAN object. This may be used for objects that have long VLAN names. |
| `reserved` | Optional | Determines weather the VLAN should be assigned to IPAM objects manually.  
The default value is `false`. |
| `extattrs` | Optional | Specifies extensible attributes for the VLAN object. |
| `state` | Optional | Specifies the state of the VLAN object instance on the NIOS server.  
Set one of the following values:<br>- `present` (default): Configures the object.
- `absent`: Removes the object. |
| `comment` | Optional | Describes the VLAN object. |
| `provider` | Required | Defines the details of the connection:<br>- `host`: The DNS host name or IP address to connect to the remote instance of NIOS.
- `username`: The user name to use for authenticating the connection to the remote instance.
- `password`: The password to use for authenticating the connection to the remote instance.<br>For information on additional fields you can define, see the list of subparameters in the *[NIOS Modules for Ansible Collections](https://infoblox-docs.atlassian.net/wiki/spaces/niosmodulesansible/pages/44525470)* topic. |
| `connection` | Required | The `nios_vlan` module must be run locally. |

## Examples

`name: Create a new vlan`  
`infoblox.nios_modules.nios_vlan:`  
`  name: ansible`  
`  id: 10`  
`  parent: my_vlanview`  
`  state: present`  
`  provider:`  
`    host: "{{ inventory_hostname_short }}"`  
`    username: admin`  
`    password: admin`  
`connection: local`  
  
`name: Update the comment for a vlan`  
`  infoblox.nios_modules.nios_vlan:`  
`    name: ansible`  
`    id: 10`  
`    parent: my_vlanview`  
`    comment: this is an example comment`  
`    state: present`  
`    provider:`  
`      host: "{{ inventory_hostname_short }}"`  
`      username: admin`  
`      password: admin`  
`  connection: local`  


`name: Remove the vlan`  
`infoblox.nios_modules.nios_vlan:`  
`  name: ansible`  
`  id: 10`  
`  parent: my_vlanview`  
`  state: absent`  
`  provider:`  
`    host: "{{ inventory_hostname_short }}"`  
`    username: admin`  
`    password: admin`  
`connection: local`

  
`name: Update an existing vlan`  
`infoblox.nios_modules.nios_vlan:`  
`  name: {new_name: ansible-new, old_name: ansible}`  
`  id: 10`  
`  parent: my_vlanview`  
`  state: present`  
`  provider:`  
`     host: "{{ inventory_hostname_short }}"`  
`     username: admin`  
`     password: admin`  
`connection: local`

  
`name: Create vlan with extensible attributes`  
`infoblox.nios_modules.nios_vlan:`  
`  name: ansible`  
`  id: 11`  
`  parent: my_vlanview`  
`  comment: "this is an example comment"`  
`  contact: "itlab@email.com"`  
`  department: "IT"`  
`  description: "test"`  
`  reserved: True`  
`  extattrs:`  
`    Site: "HQ"`  
`  state: present`  
`  provider:`  
`    host: "{{ inventory_hostname_short }}"`  
`    username: admin`  
`    password: admin`  
`connection: local`  


`name: Create a new vlan with next available id`  
`infoblox.nios_modules.nios_vlan:`  
`  name: ansible-vlan`  
`  id: "{{`  
`      lookup('infoblox.nios_modules.nios_next_vlan_id',`  
`        parent='my_vlanrange',`  
`        exclude=[1,2],`  
`        provider=nios_provider)[0]`  
`      }}"`  
`  parent: my_vlanrange`  
`  state: present`  
`  provider:`  
`    host: "{{ inventory_hostname_short }}"`  
`    username: admin`  
`    password: admin`  
`connection: local`