Hi
Is it possible to call a python function from Ansible template?
Something like this:
{{ add_number(input) }}
Hi
Is it possible to call a python function from Ansible template?
Something like this:
{{ add_number(input) }}
You can define new Jinja2 filters using filter plugins at least, as well as creating new lookup plugins.
There is no facility for defining new top level functions, but lookup plugins would provide most of the equivalence you’d want.
Hi
It working fine if I add the filter in lib/ansible/runner/filter_plugins/core.py
{{ variable|add_number }}
Can I somehow put it outside the Ansible codebase. I.e. in /home/user/custom_filters.py and then include it in my tasks yml? something like this:
Thx. It’s working fine.