# Nxos\_vlans range (via string) to database

**URL:** <https://forum.ansible.com/t/nxos-vlans-range-via-string-to-database/41307>\
**Category:** Get Help\
**Created:** [March 25, 2025, 4:03pm UTC](https://forum.ansible.com/t/nxos-vlans-range-via-string-to-database/41307 "2025-03-25T16:03:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![marky2376](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/marky2376/32/7983_2.png) [@marky2376](https://forum.ansible.com/u/marky2376)\
**Post date:** [March 25, 2025, 4:03pm UTC](https://forum.ansible.com/t/nxos-vlans-range-via-string-to-database/41307/1 "2025-03-25T16:03:37Z")

</div>

Is there a way to add a range of vlans to the vlan database? With nxos\_vlan I could input a string variable with either say vlan id 5 OR 5,6 OR 5-7, ect. Then use the code

```auto
 - name: Add Vlans to database
        nxos_vlan:
        vlan_range: "{{ vlans }}"

```

Then I could leverage the same vlans and add it to the l2interface as a single vlan, separate by a comma or a range with a dash:

```auto
nxos_l2_interfaces:
        name: "{{ interface_num }}"
        mode: trunk
        trunk_allowed_vlans: "{{ vlans }}"

```

- nxos\_vlans, cisco.nxos.nxos

The newer nxos\_vlans function is integer only I guess and can’t parse multiple vlans.

edit: Looks like I can work around this by using the nxos.commands module to add vlans to the database but it would be nice to have the vlan\_range from nxos\_vlan carry over.

Thanks for the help!
