Closed baburciu closed 2 years ago
Encountered this today (Netbox v2.11.6, netbox.netbox v3.1.1, Ansible 2.10.9) and after some brief testing this seems to occur when passing a list of strings like VIDs or VLAN names (i.e. tagged_vlans: [ '150', '200' ]
or tagged_vlans: [ 'DC1_PXE', 'DC1_Storage' ]
). If, however, the integer primary keys of the VLAN objects -- not the VIDs -- are directly passed (i.e. tagged_vlans: [ 7, 21 ]
), then all of the VLANs are correctly assigned to the interface.
As far as my understanding is here, this seems like it's working as expected. Let me know if I'm misunderstanding it.
ISSUE TYPE
SOFTWARE VERSIONS
Ansible:
ansible 2.9.19rc1
Netbox:
v2.10.6
Collection:
3.0.0
SUMMARY
Cannot use module _netbox_deviceinterface to pass multiple VLANs as allowed (tagged) on an interface. Regardless of how many VLANs are sent in list, only the last one will be applied. Similarly, passing first VLAN x as extra-var when running playbook, then passing VLAN y and running playbook again, will result in only VLAN y being showed as tagged under interface. Same is valid for Ansible module collection version 2.0.0, NetBox instance v2.10.3, with ansible 2.10.3.
STEPS TO REPRODUCE
Use the below playbook and run it with
ansible-playbook -i ./hosts -v update_interface.yml -e 'dot1q_mode="Tagged" tagged_vlan_id=["204","206","480"] interface_name="10GE1/0/1" interface_device="SWH-OoB-R2" ansible_python_interpreter="/usr/bin/python3" url_var="http://192.168.200.23:8001/" token_var="fe08a748abf3eb828203536f35e411fc8fbf8f9c"' -vv
.EXPECTED RESULTS
If I understand correctly the docs, you'd expect to see VLANs "204", "206" & "480" as tagged under interface 10GE1/0/1 of device SWH-OoB-R2.
ACTUAL RESULTS
__