BacklogZero®

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.

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.

YAML
---
- 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: merged

How 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.

Try it with BacklogZero

Ask BacklogZero to generate this automation for your environment.

Get BacklogZero today

Related guides

Back to Ansible in a Minute

Add a VLAN to a Cisco IOS switch · Level Up Labs