我的 ansible 脚本看起来像,
- 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"
它给我这个错误
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
不确定这里发生了什么。我的意思是脚本在我在新 VM 中运行它之前和运行时都运行良好,它抛出了这个错误。有什么想法可以重新分级吗?
最佳答案
直到 February 2021 才添加 split
过滤器.我认为这意味着如果您运行的是早于 Ansible 2.11 的任何软件,您将无法使用它。
关于json - jinja2.exceptions.TemplateRuntimeError : no filter named 'split' 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70870792/