The vlan_expander filter plugin.
Version added: 2.3.0
- Expand shorthand list of VLANs to list all VLANs. Inverse of vlan_parser
- Using the parameters below -
vlans_data | ansible.netcommon.vlan_expander
Parameter | Choices/Defaults | Configuration | Comments |
---|---|---|---|
data
string
/ required
|
This option represents a string containing the range of vlans.
|
Note
- The filter plugin extends vlans when data provided in range or comma separated.
# Using vlan_expander
- name: Setting host facts for vlan_expander filter plugin
ansible.builtin.set_fact:
vlan_ranges: "1,10-12,15,20-22"
- name: Invoke vlan_expander filter plugin
ansible.builtin.set_fact:
extended_vlans: "{{ vlan_ranges | ansible.netcommon.vlan_expander }}"
# Task Output
# -----------
#
# TASK [Setting host facts for vlan_expander filter plugin]
# ok: [host] => changed=false
# ansible_facts:
# vlan_ranges: 1,10-12,15,20-22
# TASK [Invoke vlan_expander filter plugin]
# ok: [host] => changed=false
# ansible_facts:
# extended_vlans:
# - 1
# - 10
# - 11
# - 12
# - 15
# - 20
# - 21
# - 22
- Akira Yokochi (@akira6592)
Hint
Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.