ansible / ansible.netcommon / 6.1.0 / filter / vlan_parser The vlan_parser filter plugin. | "added in version" 1.0.0 of ansible.netcommon" Authors: Steve Dodd (@idahood)ansible.netcommon.vlan_parser (6.1.0) — filter
Install with ansible-galaxy collection install ansible.netcommon:==6.1.0
collections: - name: ansible.netcommon version: 6.1.0
The filter plugin converts a list of vlans to IOS like vlan configuration.
Converts list to a list of range of numbers into multiple lists.
C(vlans_data | ansible.netcommon.vlan_parser(first_line_len = 20, other_line_len=20))
# Using vlan_parser - name: Setting host facts for vlan_parser filter plugin ansible.builtin.set_fact: vlans: [ 100, 1688, 3002, 3003, 3004, 3005, 3102, 3103, 3104, 3105, 3802, 3900, 3998, 3999, ]
- name: Invoke vlan_parser filter plugin ansible.builtin.set_fact: vlans_ranges: "{{ vlans | ansible.netcommon.vlan_parser(first_line_len = 20, other_line_len=20) }}"
data: description: - This option represents a list containing vlans. required: true type: list first_line_len: default: 48 description: - The first line of the list can be first_line_len characters long. type: int other_line_len: default: 44 description: - The subsequent list lines can be other_line_len characters. type: int