# How to omit undefined vars in filters?

**URL:** <https://forum.ansible.com/t/how-to-omit-undefined-vars-in-filters/18253>\
**Category:** Ansible Project\
**Created:** [May 18, 2015, 4:38pm UTC](https://forum.ansible.com/t/how-to-omit-undefined-vars-in-filters/18253 "2015-05-18T16:38:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vladimir-csp](https://avatars.discourse-cdn.com/v4/letter/v/839c29/32.png) [@Vladimir-csp](https://forum.ansible.com/u/Vladimir-csp)\
**Post date:** [May 18, 2015, 4:38pm UTC](https://forum.ansible.com/t/how-to-omit-undefined-vars-in-filters/18253/1 "2015-05-18T16:38:43Z")

</div>

Hi!  
I have a syntax question.  
When putting variable in module’s parameter, you can omit it if it is undefined, like so:

`  
parameter: {{ variable | default(omit) }}

`

But how to do the same thing with list filters where either var can be undefined?

`  
parameter: {{ list1 | difference(list2) }}

`

How to make module work regardless of whether list1 or list2 defined or not?
