jinja2.exceptions.TemplateRuntimeError: no filter named 'split'

Viewed 1336

My ansible script looks like,

- name: get dataset id
  set_fact : 
    dataset_ID: "{{ABC.json.datasets | json_query(query) | map('split', '/') | map(attribute=5) | list | first}}"
  vars:
    query: "[?displayName == 'My_dataset'].name"
  

it gives me this error

An exception occurred during task execution. To see the full traceback, use -vvv. The error was: jinja2.exceptions.TemplateRuntimeError: no filter named 'split'
fatal: [localhost]: FAILED! => changed=false

Not sure what's happening here. I mean the script was working fine before and when I ran this in new VM it throws this error. Any idea regrading this?

1 Answers

The split filter wasn't added until February 2021. I think that means if you're running anything earlier than Ansible 2.11 you won't have it.

Related