Debugging in python3 shell
Without custom enviroment:
1 from jinja2 import Template
2
3 template_str = "My name is {{name}}"
4 obj = {'name': 'Alex'}
5
6 print(Template(template_str).render(obj))
7 > My name is Alex
Using a custom enviroment:
1 from jinja2 import Environment
2 from jinja2_ansible_filters import AnsibleCoreFiltersExtension
3
4 env = Environment(extensions=[AnsibleCoreFiltersExtension])
5 template_str = "My name is {{name}}"
6 obj = {'name': 'Alex'}
7
8 print(env.get_template(template_str).render(obj))
9 > My name is Alex