jinja2 - How to use Erlang configuration files with Python J2 template? -
i deploy ansible configuration files following way:
- name: deploying test configuration template: src={{ item }}.j2 dest={{ basho_bench_home_dir }}/conf/{{ item }} sudo: yes with_items: - http_fix_1min.conf.template - http_max_1min.conf
the files have lines these:
{mode, max}. {duration, 1}. {concurrent, 32}.
this breaks j2 rendering:
fatal: [192.168.99.135] => {'msg': "ansibleerror: file: roles/basho_bench/templates/http_fix_1min.conf.template.j2, line number: 24, error: expected token 'end of print statement', got 'content'", 'failed': true} fatal: [192.168.99.135] => {'msg': 'one or more items failed.', 'failed': true, 'changed': false, 'results': [{'msg': "ansibleerror: file: roles/basho_bench/templates/http_fix_1min.conf.template.j2, line number: 24, error: expected token 'end of print statement', got 'content'", 'failed': true}]}
i not sure how tell j2 handle template giant string. have tried {{' '}} documentation suggests. did work.
use {% raw %}
/{% endraw %}
blocks jinja2 documentation suggests.
before override jinja2 evironment settings placing
#jinja2: variable_end_string: [[, variable_start_string: ]]
on first line of template file {{ }}
weren't not treated tags. ansible devs have disabled feature because of security issues. right still not available. related issie on gihub here. follow referenced issues , pull requests on discussion feature.
Comments
Post a Comment