# Match filter missing in Ansible version 2.9

**URL:** <https://forum.ansible.com/t/match-filter-missing-in-ansible-version-2-9/32146>\
**Category:** Ansible Project\
**Created:** [February 5, 2020, 2:23pm UTC](https://forum.ansible.com/t/match-filter-missing-in-ansible-version-2-9/32146 "2020-02-05T14:23:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Devesh\_singh](https://avatars.discourse-cdn.com/v4/letter/d/f6c823/32.png) [@Devesh\_singh](https://forum.ansible.com/u/Devesh_singh)\
**Post date:** [February 5, 2020, 2:23pm UTC](https://forum.ansible.com/t/match-filter-missing-in-ansible-version-2-9/32146/1 "2020-02-05T14:23:08Z")

</div>

Hello All,

Anybody can help for the below error. My system was patched recently and ansible version has been upgraded to 2.9.

After that my playbook started to throw below error.:

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [February 5, 2020, 2:31pm UTC](https://forum.ansible.com/t/match-filter-missing-in-ansible-version-2-9/32146/2 "2020-02-05T14:31:19Z")

</div>

`match` is not a filter, it is what is called a `test`. Ansible 2.5 deprecated the syntax to use a `test` like a `filter`. See [https://docs.ansible.com/ansible/latest/porting\_guides/porting\_guide\_2.5.html#jinja-tests-used-as-filters](https://docs.ansible.com/ansible/latest/porting_guides/porting_guide_2.5.html#jinja-tests-used-as-filters)

This should have been generating a deprecation warning since the 2.5 release. In any case, the most simple fix is just to replace `|match` with `is match`.

---

<div class="post-metadata">

**Author:** ![vbotka](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/vbotka/32/359_2.png) [@vbotka](https://forum.ansible.com/u/vbotka)\
**Post date:** [February 5, 2020, 3:20pm UTC](https://forum.ansible.com/t/match-filter-missing-in-ansible-version-2-9/32146/3 "2020-02-05T15:20:38Z")

</div>

There are 2 problems

1) "match" is a test. See "Testing strings"  
[https://docs.ansible.com/ansible/latest/user\_guide/playbooks\_tests.html#testing-strings](https://docs.ansible.com/ansible/latest/user_guide/playbooks_tests.html#testing-strings)

2) Use "lookup" and "vars" plugin to get value of dynamically created  
&nbsp;&nbsp;&nbsp;variable's name. See "vars – Lookup templated value of variables"  
[https://docs.ansible.com/ansible/latest/plugins/lookup/vars.html#vars-lookup-templated-value-of-variables](https://docs.ansible.com/ansible/latest/plugins/lookup/vars.html#vars-lookup-templated-value-of-variables)

For example

&nbsp;&nbsp;- set\_fact:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Detrio\_has\_backup\_nic: true  
&nbsp;&nbsp;&nbsp;&nbsp;vars:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;my\_nic: "{{ lookup('vars', 'ansible\_' ~ Detrio\_backup\_nic) }}  
&nbsp;&nbsp;&nbsp;&nbsp;when:  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- my\_nic.ipv4.network is match(Detrio\_backup\_network)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- \_has\_backup\_nic is undefined  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;- Detrio\_backup\_nic is defined

HTH,

&nbsp;&nbsp;-vlado
