- Network Automation Cookbook
- Karim Okasha
- 66字
- 2025-04-04 13:10:13
How to do it...
- Update the group_vars/lan.yml file with the VLAN definition, as outlined in the following code:
$ cat group_vars/lan.yaml
vlans:
- name: Data
vlan_id: 10
- name: Voice
vlan_id: 20
- name: Web
vlan_id: 100
- Update the pb_build.yml playbook with the following task to provision the VLANs:
- name: "P1T4: Create L2 VLANs"
ios_vlan:
vlan_id: "{{ item.vlan_id }}"
name: "{{ item.name }}"
loop: "{{ vlans }}"
tags: vlan