ansible.netcommon.vlan_expander filter – The vlan_expander filter plugin.

Note

This filter plugin is part of the ansible.netcommon collection (version 7.1.0).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install ansible.netcommon.

To use it in a playbook, specify: ansible.netcommon.vlan_expander.

New in ansible.netcommon 2.3.0

Synopsis

  • Expand shorthand list of VLANs to list all VLANs. Inverse of vlan_parser

  • Using the parameters below - vlans_data | ansible.netcommon.vlan_expander

Keyword parameters

This describes keyword parameters of the filter. These are the values key1=value1, key2=value2 and so on in the following example: input | ansible.netcommon.vlan_expander(key1=value1, key2=value2, ...)

Parameter

Comments

data

string / required

This option represents a string containing the range of vlans.

Notes

Note

  • The filter plugin extends vlans when data provided in range or comma separated.

Examples

# 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

Authors

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