How to do it...

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