Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 796
quicksilver Avatar asked Jul 19 '26 17:07

quicksilver


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.

like image 112
larsks Avatar answered Jul 21 '26 06:07

larsks