`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
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`. On Wed, Feb 5, 2020 at 8:23 AM Devesh singh <[email protected]> wrote: > 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.: > > ========================= > fatal: [vlac475.netpost]: FAILED! => {"msg": "The conditional check > 'ansible_default_ipv4.network|match( bpost_mgmt_network )' failed. The > error was: template error while templating string: no filter named 'match'. > String: {% if ansible_default_ipv4.network|match( bpost_mgmt_network ) %} > True {% else %} False {% endif %}\n\nThe error appears to be in > '/root/playbooks/roles/bpost_facts/tasks/main.yml': line 19, column 3, but > may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe > offending line appears to be:\n\n# Server has multiple interface but > primary is mgmt\n- name: set fact bpost_has_backup_nic to 'false' if no > interface matching bpost mgmt subnet\n ^ here\n"} > > ========================= > Task syntax: > > # Server has multiple nic. primary is neither mgmt nor DMZ. Configured IP > match backup network. > - name: set fact Detrio_has_backup_nic to 'true' > set_fact: > Detrio_has_backup_nic: true > when: > - ansible_{{ Detrio_backup_nic}}.ipv4.network|*match*( > Detrio_backup_network ) > - _has_backup_nic is undefined > - Detrio_backup_nic is defined > > If any body can help to modify the syntax or what the new filter for > match in 2.9 will be appreciable. > > Thanks & Regards, > Devesh Kumar SIngh > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/d93b3cf3-f8f4-4168-b606-efdd4f3d4e90%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/d93b3cf3-f8f4-4168-b606-efdd4f3d4e90%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Matt Martz @sivel sivel.net -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAD8N0v_hGF06XTi5n5U%2Bq_1fd0CenJSvh-0erFEiXBN_rOn9ZA%40mail.gmail.com.
