# I am new to ansible module i would like to understand the below code snippet in ios\_vlan.py module

**URL:** <https://forum.ansible.com/t/i-am-new-to-ansible-module-i-would-like-to-understand-the-below-code-snippet-in-ios-vlan-py-module/28333>\
**Category:** Ansible Developer\
**Created:** [August 14, 2018, 11:58pm UTC](https://forum.ansible.com/t/i-am-new-to-ansible-module-i-would-like-to-understand-the-below-code-snippet-in-ios-vlan-py-module/28333 "2018-08-14T23:58:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bharathi\_M](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@Bharathi\_M](https://forum.ansible.com/u/Bharathi_M)\
**Post date:** [August 14, 2018, 11:58pm UTC](https://forum.ansible.com/t/i-am-new-to-ansible-module-i-would-like-to-understand-the-below-code-snippet-in-ios-vlan-py-module/28333/1 "2018-08-14T23:58:56Z")

</div>

Hi all,  
I would like to understand the below code snippet in ios\_vlan.py,  
elif set(interfaces) != set(obj\_in\_have['interfaces']):  
On what scenario the above code snippet will get executed.

Thanks,  
Bharathi

---

<div class="post-metadata">

**Author:** ![nchakrab](https://avatars.discourse-cdn.com/v4/letter/n/919ad9/32.png) [@nchakrab](https://forum.ansible.com/u/nchakrab)\
**Post date:** [September 17, 2018, 11:25am UTC](https://forum.ansible.com/t/i-am-new-to-ansible-module-i-would-like-to-understand-the-below-code-snippet-in-ios-vlan-py-module/28333/2 "2018-09-17T11:25:58Z")

</div>

Hello Bharathi,

The code snippet you mentioned will be executed when a VLAN with the same VLAN ID(that you’re trying to configure) already exists in the device and you’re trying to associate interfaces to it.  
It will compare the existing interfaces with the interfaces you are trying to configure for that VLAN. If they are not “equal”, the module will take care of the missing and superfluous interfaces.

You can use the [“q module”](https://pypi.org/project/q/) to track code execution for Ansible modules.

Thank you,  
Nilashish Chakraborty  
Associate Software Engineer, Ansible by Red Hat  
Red Hat Bangalore, India  
Mobile : (+91) 8017535758
