Ansible in a Minute · Certified Collections ·
Add a VLAN to a Cisco IOS switch
Short answer
Use cisco.ios to create a VLAN on a Cisco IOS switch.
Subscribe for updates
Get an email whenever we publish new guides and blog posts. Unsubscribe anytime.
By subscribing you agree we may email you about Ansible in a Minute and related Level Up Labs updates. We store your address in the same lead sheet as our contact form.
Request
add vlan 110 named app-tier on a cisco ios switch
Example
A quick heads-up: Every environment is different. Review and test this example before you run it on systems you care about.
---
- name: Add VLAN on Cisco IOS
hosts: cisco_ios
gather_facts: false
tasks:
- name: Ensure VLAN exists
cisco.ios.ios_vlans:
config:
- name: "app-tier"
vlan_id: 110
state: active
state: mergedHow it works
The ios_vlans module merges the VLAN into the device configuration. Provide network device credentials through your inventory or Ansible Vault.
When to use it
- Adding an application VLAN during network change windows
- Keeping VLAN definitions in source control
Requirements
- Collection: cisco.ios
- Technology: Cisco IOS
- cisco.ios collection installed
- Reachable IOS devices in inventory
Validation
- Syntax validated
- Not execution-tested
- Last verified 2026-09-03
Notes
Test against a lab switch first. Confirm VLAN ID conflicts before you merge into production.
Built for every Ansible use case in every organization
BacklogZero can generate this kind of automation in your environment, just like it did here.