cisco_vlan
Manages VLANs on Cisco IOS/NX-OS switches over SSH. Checks the VLAN table before acting and only pushes configuration when drift is detected.
SSH connection parameters are auto-injected by the gateway proxy.
Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
vlan_id |
Yes | -- | VLAN number (1-4094) |
name |
Yes | -- | VLAN name |
state |
Yes | -- | present to create/update, absent to remove |
host |
Auto | -- | Target IP/hostname (auto-injected) |
port |
Auto | 22 |
SSH port (auto-injected) |
username |
Auto | -- | SSH user (auto-injected) |
credential |
Auto | -- | Password or SSH key (auto-injected) |
Idempotency
- Runs
show vlan briefon the device - Parses the VLAN table for the target
vlan_id - If
state: presentand the VLAN exists with the correct name, no change - If
state: absentand the VLAN does not exist, no change
Examples
Create a VLAN
resources:
- name: mgmt-vlan
type: cisco_vlan
vlan_id: "100"
name: Management
state: present
Remove a VLAN
resources:
- name: remove-old-vlan
type: cisco_vlan
vlan_id: "999"
name: Deprecated
state: absent